Adventure Game Studio

AGS Support => Advanced Technical Forum => Topic started by: Mouth for war on Wed 02/02/2011 19:15:28

Title: music/sound issues when room is loading
Post by: Mouth for war on Wed 02/02/2011 19:15:28
I've encountered something annoying.
When a room loads where I have both a song playing AND a looping soundeffect in the background it takes a few seconds before it starts playing. the music and sound starts and pauses several times before they play normally. Any idea why that's happening?
thanks in advance!
Title: Re: music/sound issues when room is loading
Post by: barefoot on Wed 02/02/2011 19:20:24
have you tried afterfadin?

barefoot
Title: Re: music/sound issues when room is loading
Post by: Mouth for war on Wed 02/02/2011 19:29:57
Yes I tried that too and it didn't help I'm afraid :)

*Edit* I did however script that the soundeffect starts playing when the player leave a room and then have the music start after fadein in the next room. That works ok
Title: Re: music/sound issues when room is loading
Post by: Knoodn on Wed 02/02/2011 19:46:21
Maybe it's the same like explained here:

http://www.adventuregamestudio.co.uk/yabb/index.php?topic=39057.0 (http://www.adventuregamestudio.co.uk/yabb/index.php?topic=39057.0)
Title: Re: music/sound issues when room is loading
Post by: Mouth for war on Wed 02/02/2011 19:50:23
I tried to search but I only ended up at a screen with the searchbox saying "Did you forget to put something to search for?"So i thought there were no topics for it. I couldn't even click on the link you provided. Maybe something's temporarily wrong with my connection or something...
Title: Re: music/sound issues when room is loading
Post by: Knoodn on Wed 02/02/2011 20:10:59
Sorry.
My fault.
Edited.
Title: Re: music/sound issues when room is loading
Post by: Calin Leafshade on Wed 02/02/2011 23:08:10
Yea this is a known bug on certain sound cards but i dont think the cause was ever identified.

Interestingly this also happens during the FadeIn() and FadeOut() commands so I would guess its not actually related to the room loading but actually the fading function.
If I were to guess I would say that the sound buffer is not being updated during the fades and cards with small buffers end up skipping.

CJ is logging in pretty regularly at the moment so you can probably expect a fairly speedy response.
Title: Re: music/sound issues when room is loading
Post by: Mouth for war on Thu 03/02/2011 09:55:44
Ah I see, I have a M-audio firewire solo. Mainly a soundcard for recording music. I increased the buffersize and I think it did help a little but still a short stuttering...oh well. thanks for the info Calin :)
Title: Re: music/sound issues when room is loading
Post by: Calin Leafshade on Wed 09/02/2011 15:08:10
304 and I have definitely isolated this to the fading function. The sound does not seem to stutter if the transition mode is set to 'Instant'.

From there you can use a gui to implement your own fades.
Title: Re: music/sound issues when room is loading
Post by: Ryan Timothy B on Wed 09/02/2011 18:54:50
Quote from: Calin Elephantsittingonface on Wed 09/02/2011 15:08:10
The sound does not seem to stutter if the transition mode is set to 'Instant'.

This is actually incorrect. The stutter may not be noticeable with low resolution games, but Journey of Iesir is 1024 x 768 and it stutters between room changes with the transition mode set to instant. It's not nearly as bad as with the Fading, but it's still present.

I'm actually glad you pointed this out to me, because the music stutter with Fading was almost unbearable. Now I'll just do it the way you mentioned above. Which is one reason why an on_event for room afterFadeIn would be much nicer instead of doing the workaround method.
Title: Re: music/sound issues when room is loading
Post by: Dualnames on Wed 09/02/2011 19:14:46
It stutters cause you're using mp3 or oggs, using wavs doesn't cause that.
Title: Re: music/sound issues when room is loading
Post by: Calin Leafshade on Wed 09/02/2011 19:23:33
Quote from: Ryan Timothy on Wed 09/02/2011 18:54:50
This is actually incorrect.

That's a shame. I would think that an issue with the fading function would be easier to solve than what is obviously a general buffer issue.

Quote from: Dualnames on Wed 09/02/2011 19:14:46
It stutters cause you're using mp3 or oggs, using wavs doesn't cause that.

That would increase most games' size by a factor of about 10.
Title: Re: music/sound issues when room is loading
Post by: Dualnames on Wed 09/02/2011 21:41:12
Quote from: Calin Elephantsittingonface on Wed 09/02/2011 19:23:33
Quote from: Ryan Timothy on Wed 09/02/2011 18:54:50
This is actually incorrect.

That's a shame. I would think that an issue with the fading function would be easier to solve than what is obviously a general buffer issue.

Quote from: Dualnames on Wed 09/02/2011 19:14:46
It stutters cause you're using mp3 or oggs, using wavs doesn't cause that.

That would increase most games' size by a factor of about 10.

Indeed, but it's unfortunately a great solution. Also ogg seems to be slightly better than mp3.
Title: Re: music/sound issues when room is loading
Post by: xenogia on Thu 10/02/2011 00:43:07
Ahh the sound issue.  I used to get it randomly within a scene sometimes as well when using external plugins.
Title: Re: music/sound issues when room is loading
Post by: Pumaman on Thu 10/02/2011 21:23:51
What colour depth is the game, and does the problem happen with both DX5 and D3D?
Title: Re: music/sound issues when room is loading
Post by: xenogia on Thu 10/02/2011 22:28:59
I sent you my game a while ago regarding sound stutters.  Run's at 640x400 32bit D3D.  Sound stutters get worse if you filter the game to a higher res.
Title: Re: music/sound issues when room is loading
Post by: Knoodn on Fri 11/02/2011 14:46:43
in my case it happens only in DirectDraw5 mode.
with Direct3D everything is fine.

game runs in 640x480 32-bit.
Title: Re: music/sound issues when room is loading
Post by: cat on Sun 01/01/2012 15:05:00
Sorry for digging this up, but the problem still exists.

Quote from: Knoodn on Fri 11/02/2011 14:46:43
in my case it happens only in DirectDraw5 mode.
with Direct3D everything is fine.

game runs in 640x480 32-bit.

This quick fix works for me. But with DirectDraw5 I had bad stuttering too. (640x480 32bit) However, Direct3D doesn't work on some old computers...

As code is now open source - any chance for a fix here?