0
0

Hello,

As title suggest, I am trying to play sounds sequentially (next starts after previous finishes).

Unfortunately I cannot use a loop to wait for the channels ‘isplaying’ since I will want to play more than 1 sound instance at the same time. (ie play 2 sound sequences at the same time)

I looked at the even system, but cannot figure out how I would be able to identify which instance has ended to play the appropriate next file.

Any suggestions/pointers on how to do this?

Thanks

  • You must to post comments
0
0

[quote="phillis":2fl1kdw8]Hello,

As title suggest, I am trying to play sounds sequentially (next starts after previous finishes).

Unfortunately I cannot use a loop to wait for the channels ‘isplaying’ since I will want to play more than 1 sound instance at the same time. (ie play 2 sound sequences at the same time)

I looked at the even system, but cannot figure out how I would be able to identify which instance has ended to play the appropriate next file.

Any suggestions/pointers on how to do this?

Thanks[/quote:2fl1kdw8]

Load the sequentialy played sounds in an array
pcode
sound[0] = SoundCreate("Track1.pm3")
sound[1] = SoundCreate("Track2.pm3")
sound[2] = SoundCreate("Track3.pm3")
sound[3] = SoundCreate("Track4.pm3")
sound[4] = SoundCreate("Track5.pm3")

Done = false;
at = 0;
channel = SounPlay(sound[at++])
//application loop
while(!Done)
{
systemUpdate();
sleep(10);
if(!ChannelsPlaying(channel)) channel = SounPlay(sound[at++])
Done = keyboard check ESCAPE
}

  • You must to post comments
0
0

Thanks for the reply. Unfortunately the result of this code is the same as mine…it only allows 1 sound to be played.

Following from your example, I would like to play multiple arrays of sound at the same time. IE:

Sound0[0]
Sound0[1]
Sound0[2]
Sound0[3]

Sound1[0]
Sound1[1]
Sound1[2]
Sound1[3]
….

play sound0 sequentially and start sound1 X ms afterwords. The number of sound arrays is not fixed, therefore I cannot use a WHILE loop with IFs inside.

Any other ideas?

Thanks again.

  • You must to post comments
0
0

[quote:1jbd3o07]play sound0 sequentially and start sound1 X ms afterwords. The number of sound arrays is not fixed, therefore I cannot use a WHILE loop with IFs inside. [/quote:1jbd3o07]
You’re going to need a while loop for the application to call System::update. You can put that if statement in another loop (for each sound array). If you have a FMOD::Channel per sound array, using the FMOD_CHANNEL_REUSE mode you can make sure that only one sound per array is playing at a time.

Alternatively you can use the Sound::setSubSound with Sound::setSubSoundSentence. This will allow you to create a single FMOD::Sound object which contains an array of integers which are indexes of it’s subsounds to play.

-Pete

  • You must to post comments
Showing 3 results
Your Answer

Please first to submit.