Advertisement Jump to content
Sign in to follow this  

dInput and openAL problem

This topic is 5001 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I use DirectInput for mouse/keyboard and OpenAL for sound. I have the following problem: In my game - I check the keyboard and mouse - if correct button/key then = play a fire bullet sound: Note that both options call the same function. In addition both options work correctly - I can see things get shot and = die using the mouse and the keyboard. However, the mouse option results in a choppy barely audible sound, = whereas the keypress results in a perfect sound. Obviously I'd like both to work ! Note that both keypress and mouse are recognised correctly and apart from the sound they both work well. I downloaded the latest directx sdk and that made no difference either. (if you're bored you can download the game and openal at ~ 40 seconds) Thanks Ade
OnMouseDownL(float x, float y)

OnKeyDown(int nVirtKey)
case VK_NUMPAD1:
case DIK_M:


if ((bulletTime > 0.1f) && (bulletsRemaining>0))
//check for collisions etc

//OPENAL sound-
//now play it
ALuint ret =3D AL_NONE;
ALint value;
//check to see if source is currently playing if so then don't play =
(void)alGetSourcei(PlayerSrc[SOUND_SRC_GUN], AL_SOURCE_STATE, &value);
if (value !=3D AL_PLAYING)
   //ie don't start it if it's already playing
return ret;

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using, you agree to our community Guidelines, Terms of Use, and Privacy Policy. is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!