0
0

I get some strange results when I try to change volume on a channel in pause mode. For instance, if I insert the following code in the main loop in the PlaySound example the volume becomes random (0.1 or 1.0):

[code:3tfcrmp0] // ‘state’ is reset each time a sound is played
switch(state){
case 0: // do nothing on first Update()
state++;
break;
case 1: // pause and turn volume down on second Update()
channel->setPaused(true);
channel->setVolume(0.1f);
state++;
break;
case 2: // unpause and turn volume up on third Update()
channel->setPaused(false);
channel->setVolume(1.0f);
state++;
break;
default:
};[/code:3tfcrmp0]
It is only a problem with the software mixed sound. The hardware mixed sound works fine.

  • You must to post comments
0
0

The code below is just a test that provokes what to me looks like a bug. What it does is in the first frame a sound is started, in the second the sound is pause and the volume is turned down, in the third frame the volume is turned up and the sound is unpaused. After that the channel is left alone. With about 50% chance the voice will play with volume 0.1 i.e. the second volume setting is ignored.

  • You must to post comments
0
0

Are you saying that there must be 500ms between each setVolume() inorder to ensure they take effect??? Anyway, I tried it and it doesn’t remove the problem. Here is my updated example that can be pasted directly into the PlaySound example (more or less):

[code:2eagkak3]// state is reset each time a sound is played
switch(state){
case 0: // do nothing on first Update()
state++;
break;
case 1: // pause and turn volume down on second Update()
channel->setPaused(true);
channel->setVolume(0.1f);
t = clock();
state++;
break;
case 2: // wait 500ms, unpause and turn volume up on third Update()
if(clock()-t > 500){
channel->setPaused(false);
channel->setVolume(1.0f);
state++;
}
break;
default:
break;
};[/code:2eagkak3]

  • You must to post comments
Showing 2 results
Your Answer

Please first to submit.