Sound Mixing Using Active Movie Control






<!-- This code uses two hidden active movie objects to mix two sounds together one of a bass instrument and the second of drums. The simple scripts below set up the buttons for the two channels A & B. --> &lt;NPUT NAME=Sound1 TYPE=BUTTON VALUE="A Channel" STYLE="position:absolute; LEFT:20; TOP:80; color:white;"> &lt;INPUT NAME=Sound2 TYPE=BUTTON VALUE="B Channel" STYLE="position:absolute; LEFT:20; TOP:120; color:white;"> <!-- Use the object with the properties specified below for hidden operation--> &lt;OBJECT ID="AM1" WIDTH=0 HEIGHT=0 STYLE = "visibility:hidden" CLASSID="CLSID:05589FA1-C356-11CE-BF01-00AA0055595A"> &lt;PARAM NAME="showcontrols" VALUE="false"> &lt;PARAM NAME="showdisplay" VALUE="false"> &lt;PARAM NAME="AutoStart" VALUE="false"> &lt;PARAM NAME="AutoRewind" VALUE="false"> &lt;PARAM NAME="PlayCount" VALUE="5"> &lt;PARAM NAME="FileName" VALUE="bass.wav"> &lt;/OBJECT> &lt;OBJECT ID="AM2" WIDTH=0 HEIGHT=0 STYLE = "visibility:hidden" CLASSID="CLSID:05589FA1-C356-11CE-BF01-00AA0055595A"> &lt;PARAM NAME="showcontrols" VALUE="false"> &lt;PARAM NAME="showdisplay" VALUE="false"> &lt;PARAM NAME="AutoStart" VALUE="false"> &lt;PARAM NAME="AutoRewind" VALUE="false"> &lt;PARAM NAME="PlayCount" VALUE="5"> &lt;PARAM NAME="FileName" VALUE="drums.wav"> &lt;/OBJECT> &lt;script language="VBScript"> ' here we define a: Dim achan ' bit to define whether channel A it is playing or not Dim bchan ' bit to define whether channel B it is playing or not achan=2 ' make sure if that if loading button is clicked it does not bchan=2 ' try to play files before they are loaded, to avoid error sub AM1_ReadyStateChange() 'This event is fired when Channel A Media (wave file) is finished loading achan=0 sound1_onclick 'Make button display "play" end sub sub AM2_ReadyStateChange() 'This event is fired when Channel A Media (wave file) is finished loading bchan=0 sound2_onclick 'Make button display "play" end sub ' The following two routines take care of toggling the ' Buttons between their two states play and Stop ' as well as starting and stopping their respective ' ActiveMovie Control Sub Sound1_onclick select case achan case 0: AM1.Stop Sound1.innerText="Play Channel A" Sound1.style.backgroundColor="green" achan = 1 case 1: AM1.run Sound1.innerText="Stop Channel A" Sound1.style.backgroundColor="red" achan = 0 end select end sub Sub Sound2_onclick select case bchan case 0: AM2.Stop Sound2.innerText="Play Channel B" Sound2.style.backgroundColor="green" bchan = 1 case 1: AM2.run Sound2.innerText="Stop Channel A" Sound2.style.backgroundColor="red" bchan = 0 end select end sub &lt;/SCRIPT>