/* ****************************************************** ** SOUND.JS - JS Sound-Processing Library ** ====================================== ** This library contains JS code to process sound. ** Enjoy ... and please maintain this header! ** ** To load this library in an HTML doc, put the following ** line in the doc's HEAD (before any other SCRIPT tags): ** ** ** ** Author Ver Date Comments ** ====== === ==== ======== ** Rick Scott 1.0 2/1/00 First release ** ** Copyright 2000, Rick Scott, all rights reserved. ****************************************************** */ var currSoundFile; // must keep track of current sound file // setting the SRC attribute of this BGSOUND element // (as in sound.src = soundFile) will cause the // specified soundFile to play in Internet Explorer // note: depending on your sound files, you might want // to change the VOLUME setting document.write(""); function playSound(soundFile) // play the sound file { // this if statement guarantees that: // incidental (click/rollover) sounds will overlap main sounds (Canon in D, etc.) // (provided that the browser plug-in can handle sound overlaps) // main sounds won't overlap each other // only main (not click/rollover) sounds will play when user clicks Go! if ((soundFile != "clicklow.wav") && (soundFile != "clickhi.wav") && (soundFile != "rollover.wav")) { stopSound(); currSoundFile = soundFile; } if (document.layers) // Netscape { var arr = soundFile.split("."); eval("document." + arr[0] + ".play()"); } else if (document.all) // Internet Explorer { sound.src = soundFile; // as explained above } } function stopSound() // stop all currently playing sounds { if (document.layers) // Netscape document.canon.StopAll(); else if (document.all) // IE sound.src = ""; }