I am having a basic problem with some scripting that I am doing. Basically, I have a script that allows for random files to be played sequentially, but the problem is that when it pulls up the second file to play there is a slight pause. Now I have read the tutorials etc, and have the sounds as wav files and set to event rather than stream and I have checked the wav files and they are fine. I even set one of these loops with the pause to play itself over and over again and had no problems. It seems as though the problem arises when the script has to do some math (i.e. random loop picking from an array)
Any help would be greatly appreciated.
Thanks for your time
James
below is the code
[AS]
songNumber == undefined
subNumber == undefined
subNumber = random(8);
songNumber = random(5);
subSound = new Sound (this);
arrayNumber = songNumber;
songName = new Array (“base”,“guitar fade”,“chill birds”,“wurlitzer fade”,“just music”);
if (songNumber == 0) {
EgSound = new Sound(this);
EgSound.attachSound(songName[songNumber]);
EgSound.start(0, 1);
}
if (songNumber == 1) {
EgSound = new Sound(this);
EgSound.attachSound(songName[songNumber]);
subarraySong = new Array (“base”,“guitar shred”);
if (subNumber <= 6) {
playSub = subarraySong[0];
} else if (subNumber > 6) {
playSub = subarraySong[1];
}
subSound.attachSound (playSub);
EgSound.onSoundComplete = function() {
subSound.start (0,1);
}
EgSound.start(0, 1);
}
if (songNumber == 2) {
EgSound = new Sound(this);
EgSound.attachSound(songName[songNumber]);
subarraySong = new Array ("chill birds and tuba","full orchestra chill","base");
if (subNumber <= 2) {
playSub = subarraySong[0];
} else if (subNumber > 2 <= 5) {
playSub = subarraySong[1];
} else if (subNumber > 5) {
playSub = subarraySong[2];
}
subSound.attachSound (playSub);
EgSound.onSoundComplete = function() {
subSound.start (0,1);
}
EgSound.start(0, 1);
}
if (songNumber == 3) {
EgSound = new Sound(this);
EgSound.attachSound(songName[songNumber]);
EgSound.onSoundComplete = function() {
subSound.start (0,2);
}
EgSound.start(0, 1);
}
if (songNumber == 4) {
EgSound = new Sound(this);
EgSound.attachSound(songName[songNumber]);
EgSound.onSoundComplete = function() {
subSound.start (0,2);
}
EgSound.start(0, 1);
}
[/AS]