Difficulty with AmbientSound

Started by Sughly, Sat 04/06/2011 08:50:31

Previous topic - Next topic

Sughly

I've been using the 'aSound20.Play()' rather than the old 'PlaySound(20)' and 'PlayAmbientSound(etc)', but I was wondering how ambient sound is declared using the 'aSound20.Play()' way?

I tried just using the old way for just ambient sounds, but the game hangs using the following loop:

Code: ags
while(Game.IsAudioPlaying(eAudioTypeSound)){
  Wait(1);
}


The hang only happens when I have the ambient sound playing, so I'm assuming it's reading the ambient as a sound playing and doesn't leave the loop. Which seems strange to me since I thought that was the point of having 'Game.IsAudioPlaying(eAudioTypeAmbientSound)'? I'm confused  :'(

Calin Leafshade

I dont think there is a global check for the new audio system.

If you just want to wait for an audio clip to finish before continuing use:

Code: ags

while (aSound20.IsPlaying()){ // dont remember the exact function.
Wait(1);
}

Sughly

#2
Thanks for the reply Calin! See I thought it might have been how you coded it, but the only functions of aSound20 are 'FileType', 'IsAvailable', 'Play', 'PlayFrom', 'PlayQueued', 'Stop', and 'Type'. None of which seem to do what you suggested  :'(

EDIT: So I guess my question is also, what is the command to check whether a SPECIFIC audio fie is currently being played? (similar to how Calin coded, but with the correct use of function)

Calin Leafshade

Oh well you need the channel then.

again from memory:

Code: ags

AudioChannel *c = aSound20.Play();

while (c.IsPlaying()){
Wait(1);
}

Sughly

Ah yep, that did it. Thanks so much Calin! Knew it would be something simple I didn't get 8) - I could kiss you!

SMF spam blocked by CleanTalk