Commit 3da8bccd authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

mmdevice: print endpoint volume range to debug

parent 15e0df6c
...@@ -31,6 +31,7 @@ ...@@ -31,6 +31,7 @@
#include <assert.h> #include <assert.h>
#include <audiopolicy.h> #include <audiopolicy.h>
#include <mmdeviceapi.h> #include <mmdeviceapi.h>
#include <endpointvolume.h>
DEFINE_PROPERTYKEY(PKEY_Device_FriendlyName, 0xa45c254e, 0xdf1c, 0x4efd, DEFINE_PROPERTYKEY(PKEY_Device_FriendlyName, 0xa45c254e, 0xdf1c, 0x4efd,
0x80, 0x20, 0x67, 0xd1, 0x46, 0xa8, 0x50, 0xe0, 14); 0x80, 0x20, 0x67, 0xd1, 0x46, 0xa8, 0x50, 0xe0, 14);
...@@ -695,6 +696,7 @@ static HRESULT MMSession(audio_output_t *aout, IMMDeviceEnumerator *it) ...@@ -695,6 +696,7 @@ static HRESULT MMSession(audio_output_t *aout, IMMDeviceEnumerator *it)
IAudioSessionManager *manager; IAudioSessionManager *manager;
IAudioSessionControl *control; IAudioSessionControl *control;
ISimpleAudioVolume *volume; ISimpleAudioVolume *volume;
IAudioEndpointVolume *endpoint;
void *pv; void *pv;
HRESULT hr; HRESULT hr;
...@@ -783,6 +785,23 @@ static HRESULT MMSession(audio_output_t *aout, IMMDeviceEnumerator *it) ...@@ -783,6 +785,23 @@ static HRESULT MMSession(audio_output_t *aout, IMMDeviceEnumerator *it)
volume = NULL; volume = NULL;
} }
hr = IMMDevice_Activate(sys->dev, &IID_IAudioEndpointVolume,
CLSCTX_ALL, NULL, &pv);
endpoint = pv;
if (SUCCEEDED(hr))
{
float min, max, inc;
hr = IAudioEndpointVolume_GetVolumeRange(endpoint, &min, &max, &inc);
if (SUCCEEDED(hr))
msg_Dbg(aout, "volume from %+f dB to %+f dB with %f dB increments",
min, max, inc);
else
msg_Err(aout, "cannot get volume range (error 0x%lx)", hr);
}
else
msg_Err(aout, "cannot activate endpoint volume (error %lx)", hr);
/* Main loop (adjust volume as long as device is unchanged) */ /* Main loop (adjust volume as long as device is unchanged) */
while (sys->device == NULL) while (sys->device == NULL)
{ {
...@@ -832,6 +851,9 @@ static HRESULT MMSession(audio_output_t *aout, IMMDeviceEnumerator *it) ...@@ -832,6 +851,9 @@ static HRESULT MMSession(audio_output_t *aout, IMMDeviceEnumerator *it)
} }
LeaveCriticalSection(&sys->lock); LeaveCriticalSection(&sys->lock);
if (endpoint != NULL)
IAudioEndpointVolume_Release(endpoint);
if (manager != NULL) if (manager != NULL)
{ /* Deregister callbacks *without* the lock */ { /* Deregister callbacks *without* the lock */
if (volume != NULL) if (volume != NULL)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment