Adventure Game Studio

AGS Support => Advanced Technical Forum => Topic started by: tzachs on Mon 06/07/2009 22:07:34

Title: 2 possible bugs in SetDigitalMasterVolume
Post by: tzachs on Mon 06/07/2009 22:07:34
Hi, I am using version 3.1.2 SP1, and I think I've found two bugs in SetDigitalMasterVolume...
The only sound I have is an mp3 that plays on loading the room. I call the SetDigitalMasterVolume on the on_Load function of the room.

Bug #1
--------
If I write:


SetDigitalMasterVolume(100);


or:


SetDigitalMasterVolume(1);
SetDigitalMasterVolume(100);


Then everything works fine, I can hear the mp3. However, if I write:


SetDigitalMasterVolume(0);
SetDigitalMasterVolume(100);

Then I don't hear anything... It seems that if I turn the volume to 0, I can't turn it back on  ???

Bug #2 (probably related to #1)
--------
If I write:


int i=50;
 while (i<100)
 {
   SetDigitalMasterVolume(i);    
   i++;
 }

Then I hear the mp3 at volume 100, as expected. Also, if I write:


int i=100;
 while (i>50)
 {
   SetDigitalMasterVolume(i);    
   i--;
 }

or


int i=50;
 while (i<100)
 {
   SetDigitalMasterVolume(i);    
   i++;
 }
while (i>50)
 {
   SetDigitalMasterVolume(i);    
   i--;
 }


Then I hear the mp3 at volume 50, as expected. However, if I write:


int i = 100;
while (i>50)
 {
   SetDigitalMasterVolume(i);    
   i--;
 }
while (i<100)
 {
   SetDigitalMasterVolume(i);    
   i++;
 }

then I hear the mp3 at volume 50, a weird behaviour  :-\....

Any thoughts?


Title: Re: 2 possible bugs in SetDigitalMasterVolume
Post by: Gilbert on Tue 07/07/2009 01:50:20
I'm not quite sure, but that's probably because the volume is set several times at the same instance, that the engine/system won''t always be able to handle all the changes at the same time. Try to add a Wait(1) between each change and see if it makes a different. If it works as expected when the wait is introduced I think it's no big deal, as normally you won;t set the volume multiple times within the same frame anyway.

As there will be an overhaul of the audio system in V3.2 chances for fixing stuff in the same system is low (but if this problem is carried on to the new system it might be fixed).
Title: Re: 2 possible bugs in SetDigitalMasterVolume
Post by: Pumaman on Tue 07/07/2009 20:47:23
The volume system in current versions of AGS is dodgy to say the least -- as Gilbet says it is being re-written for the next version, which will deal with these problems.
Title: Re: 2 possible bugs in SetDigitalMasterVolume
Post by: tzachs on Tue 07/07/2009 21:41:01
The wait did not help  :-[ (I tried Wait(100) also just to be sure).
I actually wanted to create a bunch of new functions for the tween module, and I thought a tween for the digital master volume would be nice for fade-out/in effects, I guess I'll just have to wait for the new versions (at least the SetMasterMusicVolume works, although it's not useful in all of the scenarios).
Anyways, thank you for your replies, just be aware of this when creating the new sound system...