[Openal] Random crashes with MMSYSTEM and DirectSound backends

Nicolas Martin Flekenstein nicolasmf at hotmail.com
Mon Jul 5 19:26:11 PDT 2004


OK, I finally took a look at it again and decided to find a fix.

The crash was caused by a negative pitch in aluMixData.
The negative pitch (as well as the weird pitch some sounds got) come from 
aluCalculateSourceParameters. I fixed both issues by simply normalizing the 
Position and Velocity vectors right before this code:

			//6. Calculate doppler
			if ((DopplerFactor!=0.0f)&&(Distance!=0.0f))
				pitch[0]=(ALfloat)((Pitch*DopplerFactor)/(1.0+(aluDotproduct(Velocity,Position)/(343.0f*Distance))));
			else
				pitch[0]=(ALfloat)((Pitch			   
)/(1.0+(aluDotproduct(Velocity,Position)/(343.0f         ))));

---------------------------------------------------------------------------------------------------------------------------------------

I'm not sure if I should actually be normalizing them, but it sounds fine to 
me and it doesn't crash anymore.

BTW, the doppler shift is broken since it gives all kinds of weird sound 
effects (it was broken before I messed with the code).

_________________________________________________________________
MSN 8 helps eliminate e-mail viruses. Get 2 months FREE*. 
http://join.msn.com/?page=features/virus




More information about the Openal mailing list