// // FlashVis.as // // Copyright (c) 2001, neoMantra. All rights reserved. // // Version 1.0 Nov.25.2001 // // // This file contains all the support your Flash movie needs for // making it work with FlashVis. // // FlashVis calls the root label HandleFlashVis whenever it gets new data. // The Flash developer must provide this label. // // The conversion of FlashVis data is time consuming. If you don't need // particular data, you can disable it by setting the variables // fvbConvertW0, fvbConvertW1, fvbConvertS0, and/or fvbConvertS1 to false. // [They default to true.] You should also set the appropriate values in // the .ini file. // // If you don't need many data values, you can disable the conversion and // explicitly call GetWaveform0, GetWaveform1, GetSpectrum0, and GetSpectrum1. // // Flags specifying whether to convert a particular data var fvbConvertW0 = true; var fvbConvertW1 = true; var fvbConvertS0 = true; var fvbConvertS1 = true; // Music Data Strings, set by FlashVis var fvsW0, fvsW1, fvsS0, fvsS1; // Music Data Arrays for use by Flash, filled by FlashVisRender var fvWaveform0 = new Array(576); var fvWaveform1 = new Array(576); var fvSpectrum0 = new Array(576); var fvSpectrum1 = new Array(576); // // FlashVisConvert // // This function is called by your FlashVisHandler if you want to convert the // entire array of new data. If will convert data depending on the setting // of the fvbConvert flags. // function FlashVisConvert() { if ( fvbConvertW0 ) for (i = 0; i < 575; i++) fvWaveform0[i] = ord( substring( fvsW0, i, 1) ); if ( fvbConvertW1 ) for (i = 0; i < 575; i++) fvWaveform1[i] = ord( substring( fvsW1, i, 1) ); if ( fvbConvertS0 ) for (i = 0; i < 575; i++) fvSpectrum0[i] = ord( substring( fvsS0, i, 1) ); if ( fvbConvertS1 ) for (i = 0; i < 575; i++) fvSpectrum1[i] = ord( substring( fvsS1, i, 1) ); } // // GetWaveform0(i), GetWaveform1(i), GetSpectrum0(i), GetSpectrum1(i) // // // These are functions for directly extracting the values from the "arrays". // // You should definitely use these instead of converting in FlashVisRender, // if you do not need many of the values from the array. // // If you can handle the ugliness, you'll get even more speed by just copy/pasting // the simple functions directly in place. // function GetWaveform0( i ) { return ord( substring( fvsW0, i, 1 ) ); } function GetWaveform1( i ) { return ord( substring( fvsW1, i, 1 ) ); } function GetSpectrum0( i ) { return ord( substring( fvsS0, i, 1 ) ); } function GetSpectrum1( i ) { return ord( substring( fvsS1, i, 1 ) ); }