Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: Sughly on Sat 04/06/2011 08:50:31

Title: Difficulty with AmbientSound
Post by: Sughly on Sat 04/06/2011 08:50:31
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:

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  :'(
Title: Re: Difficulty with AmbientSound
Post by: Calin Leafshade on Sat 04/06/2011 09:19:36
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:


while (aSound20.IsPlaying()){ // dont remember the exact function.
Wait(1);
}
Title: Re: Difficulty with AmbientSound
Post by: Sughly on Sat 04/06/2011 09:27:13
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)
Title: Re: Difficulty with AmbientSound
Post by: Calin Leafshade on Sat 04/06/2011 09:28:37
Oh well you need the channel then.

again from memory:


AudioChannel *c = aSound20.Play();

while (c.IsPlaying()){
Wait(1);
}
Title: Re: Difficulty with AmbientSound
Post by: Sughly on Sat 04/06/2011 09:35:59
Ah yep, that did it. Thanks so much Calin! Knew it would be something simple I didn't get 8) - I could kiss you!