XAudio2 lose volume control

Started by
1 comment, last by lomateron 9 years, 4 months ago

In my laptop I have a physical key that controls the master volume of windows 7

when I launch my app that uses XAudio2, the key no longer works

anyone knows how to fix this?

I already know that XAudio2 API has functions that can control its volume but I still want the volume keys to work

Advertisement

Saying the key no longer works could mean several things.

With a bit of searching I don't see anyone online that has described a case where the API actually disabled the system functionality.

My first guess that the physical keys are triggering the VK_VOLUME_UP and VK_VOLUME_DOWN commands. When your app is up you get the first opportunity to handle the events Are you consuming the events in your app? Or are you passing them along to the system handlers?

My next guess is that the volume buttons might be passed along, but perhaps your system is forcing the volume levels back to the old levels frequently. I've seen cases where games inadvertently emit commands to the system ever frame, and perhaps that is what is going on here. Maybe you are setting the system volume level somewhere, so even though the user bumps the volume up your app is immediately resetting the volume.

I am using RAWINPUTDEVICE to get input form keyboard and mouse

I get the messages using


if (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE))
{
	TranslateMessage(&msg);

	if (WM_INPUT == msg.message && RIM_INPUT == msg.wParam)
	{
	   //pressed keys or mouse
	}			
	DispatchMessage(&msg);
}

and one of thosekeys is called VK_VOLUME_UP

what do I have to do with that key when I get it?

Are you consuming the events in your app? Or are you passing them along to the system handlers?

I don't know

This topic is closed to new replies.

Advertisement