Ambience volume change produces sound artifacts

Started by strazer, Sat 07/02/2004 18:38:11

Previous topic - Next topic

strazer

Hi!

I use this code

   int volume=0;
   PlayAmbientSound(1,12,255,0,0);
   SetChannelVolume (1,volume);
   while (volume<255) {
   volume=volume+3;
   SetChannelVolume (1,volume);
   Wait(1);
   }

in "Player enters screen (after fadein)" to fade in the ambience channel (rain starts falling).
It works basically, but there are artifacts introduced while doing this (listen to it here).

I had the same problem when trying to use a slider to set the ambience channel volume in my settings gui (with another ambience sound).
The sounds are uncompressed wave files, I use AGS 2.6 SP1, Win2k & SBLive! 1024 Player.

Strangely, this affects the ambience sounds only.
Does anyone else have this problem?

Pumaman

If you try using another file type (eg. mp3/ogg), does it still happen?

And conversely, if you use uncompressed wave for music, does the problem occur if you try to change the music volume?

The reason I ask is that SetChannelVolume doesn't care whether it's being used on ambient sounds, music or whatever, it always does the same thing.

strazer

QuoteIf you try using another file type (eg. mp3/ogg), does it still happen?

Yes.

QuoteAnd conversely, if you use uncompressed wave for music, does the problem occur if you try to change the music volume?

According to the manual "Changes the currently playing background music to MUSICx.OGG, MUSICx.MP3, MUSICx.MID, MUSICx.MOD or MUSICx.XM", so using a wave file plays no music at all.

But using SetChannelVolume on the music channel (MP3) produces no artifacts, no.

QuoteThe reason I ask is that SetChannelVolume doesn't care whether it's being used on ambient sounds, music or whatever, it always does the same thing.

Not here.  :(

Btw, I tried it with increments of 1 instead of 3 too, same thing.

Pumaman

Could you upload the ambient sound file that causes the problem? I tried out your script code in a test game, and it worked without problems.

strazer

It's the same behaviour with other sound files.
But here it is.

Pumaman

Hmm yeah, I tried it out and it sounded fine.

If you try changing your digital sound driver in setup to WaveOut rather than DirectSound, does that help?

strazer

No, same thing.
Anyway, if it works at your comp, it probably will on all others too.
So I'll go with the code.

Thank you!

Pumaman

Yeah, it is rather bizarre though. Has anyone else experienced anything like this?

SMF spam blocked by CleanTalk