0
0

Heya,

I have recently added code to my game to slow all audio for a while and after the timer runs out, set it back to its default value. For then unknown reasons, the game caused system crashes, namely IRQL_NOT_LESS_OR_EQUAL. The type of the crash was never the same and never seemed to be at the same point in my game loop. (Caused, I suppose, by the fact that audio is in a different thread, if I’m using the term correctly.)

After some investigation I am 90% sure that the crash was caused solely by the function which set the frequency back to its default level. I hereby include the code of that function. This code is 99% the same as in my SetFreq function, apart from the fact that one multiplies fre by a value (in my case 0.5, to cut the frequency in half).

[code:2xe8tooe] int num_channels = 0;
FMOD_SOUND * s ;
FMOD_CHANNEL * c ;
result = FMOD_ChannelGroup_GetNumChannels(soundGroup, &num_channels);
ERRCHECK(result);
for(int i = 0; i < num_channels; i++){
result = FMOD_ChannelGroup_GetChannel(soundGroup, i, &c);
ERRCHECK(result);
result = FMOD_Channel_GetCurrentSound(c, &s);
ERRCHECK(result);
float fre ;
float vol ;
float pan ;
int pri ;
result = FMOD_Sound_GetDefaults(s, &fre, &vol, &pan, &pri);
ERRCHECK(result);
result = FMOD_Channel_SetFrequency(c, fre);
ERRCHECK(result);
}[/code:2xe8tooe]

What could cause this crash? Could it crash if fre was already the same value of the current frequency of the channel? This happens in the game, you see.

When a sound is already playing, this code sets it frequency back to normal immediately. It turns out that my system would crash if that were to be the case. Still beats me why, though.

Note: all newly created sounds during this event get initiated with the altered frequency elsewhere in the game.

Anyone able to clarify this disturbing behaviour? I don’t mind getting an error and checking it out in my log with ERRCHECK, but these system crashes are nasty. Had to repair my Firefox :(

Cheers and thanks in advance,
Newbie in training, Dysprosium

  • You must to post comments
0
0

Why don’t you put all those channels in the same group and simply use

ChannelGroup::setPitch()

  • You must to post comments
0
0

I’m not trying to change the pitch of those sounds. I’m trying to temporarily change the frequency of all audio in the game. All sounds playing during the event should be slowed. The active channels as well as the channels to be instantiated during it.
Btw, as you can see I already have 2 channelgroups: soundGroup and musicGroup. You cannot change the frequency of an entire group of different sounds.

Furthermore, no matter the solution to my problems here, I want to know how my program could crash my system with this code right here. Thanks for the reply, tho. 😉

  • You must to post comments
0
0

[quote="Dysprosium":1iin5bo1]I’m not trying to change the pitch of those sounds. I’m trying to temporarily change the frequency of all audio in the game. All sounds playing during the event should be slowed. The active channels as well as the channels to be instantiated during it.
Btw, as you can see I already have 2 channelgroups: soundGroup and musicGroup. You cannot change the frequency of an entire group of different sounds.

Furthermore, no matter the solution to my problems here, I want to know how my program could crash my system with this code right here. Thanks for the reply, tho. ;)[/quote:1iin5bo1]

Well, I can’t see why it would crash

Pitch and frequency, it’s the same difference. Not saying you did not find a problem. But I’m telling you, use the group setPitch. It will change the frequency of all the playing sounds AND any other sounds you will instanciate.

It’s a much easier/safer setup, You can set the group pitch only once. It’s a fire and forget solution. No need to loop every time to make sure new sounds will play at the wanted frequency.

cheap example. Here I set it every game step, to provide a transition from normal to slow back to normal
[code:1iin5bo1]
if (BulletTime)
theGameEffectsGroup.setPitch(max(theGameEffectsGroup.getPitch()-.01,.1)) //bullet speed
else
theGameEffectsGroup.setPitch(min(theGameEffectsGroup.getPitch()+.01,1)) //done bullet speed
[/code:1iin5bo1]

  • You must to post comments
0
0

If you get a bluescreen then you have a driver problem, not an fmod problem. Try using FMOD_SOFTWARE to verify this.

  • You must to post comments
0
0

Thanks Brett! That seems to be the case indeed. I have switched to software mixing and now it all works like a charm. I’ll stick to that and consider this problem solved! :)

Thanks for your time, man!

Oh, and icuurd12b42, I’ll give your idea a try, because it seems rather flexible to me. Thanks for the tip!

  • You must to post comments
Showing 5 results
Your Answer

Please first to submit.