Response title
This is preview!




Click on Join Now to Sign Up
class Audio { void playSound(int selected, float volume) { //loads a sound into a channel myChannel = (AudioChannel[])expand(myChannel, myChannel.length + 1); //expand the array to
make room for the new audio trackmyChannel[myChannel.length - 1] = new AudioChannel(selected + ".mp3"); //add the new rack myChannel[myChannel.length - 1].volume(volume); //set the volume myChannel[myChannel.length - 1].play(); //play the channel myChannel[myChannel.length - 1].cue(1); //increase the cue, to fix a problem where the cue
reads "0" for the first frame, setting off the terminator } void advance() { //runs every frame for (int i = 0; i < myChannel.length; i++) { //run for every channel if(myChannel[i].cue == 0) { //if the channel has finished playing... myChannel = (AudioChannel[])subset(myChannel,1,myChannel.length - 1); //delete the channel } } } }
Thanks for any help!
class Audio { AudioChannel[] myChannel = new AudioChannel[32]; void playSound(int selected, float volume) { //loads a sound into a channel myChannel[selected].stop(); //stop anything already playing myChannel[selected].volume(volume); //set the volume myChannel[selected].play(); //play the channel } void initilize() { myChannel[0] = new AudioChannel("1.mp3"); //add the new rack myChannel[1] = new AudioChannel("2.mp3"); } }