Why can't I set master volume for USB/Firewire Audio interface with IAudioEndpointVolume::SetMasterVolumeLevelScalar
Asked Answered
S

1

6

I am trying to fix an Audacity bug that revolves around portmixer. The output/input level is settable using the mac version of portmixer, but not always in windows. I am debugging portmixer's window code to try to make it work there.

Using IAudioEndpointVolume::SetMasterVolumeLevelScalar to set the master volume works fine for onboard sound, but using pro external USB or firewire interfaces like the RME Fireface 400, the output volume won't change, although it is reflected in Window's sound control panel for that device, and also in the system mixer.

Also, outside of our program, changing the master slider for the system mixer (in the taskbar) there is no effect - the soundcard outputs the same (full) level regardless of the level the system says it is at. The only way to change the output level is using the custom app that the hardware developers give with the card.

The IAudioEndpointVolume::QueryHardwareSupport function gives back ENDPOINT_HARDWARE_SUPPORT_VOLUME so it should be able to do this.

This behavior exists for both input and output on many devices.

Is this possibly a Window's bug?

It is possible to workaround this by emulating (scaling) the output, but this is not preferred as it is not functionally identical - better to let the audio interface do the scaling (esp. for input if it involves a preamp).

Sherfield answered 6/12, 2010 at 1:37 Comment(5)
Perhaps the device doesn't really implement the standard Windows methods. You could try to debug the vendor's application and see what it is doing. It's probably sending some custom commands or something.Chastitychasuble
Is this reproducible across devices? This might be a hardware bug specific to one device only.Amphetamine
Yes, there are many devices that are affected by this, and the behavior is reproducable.Sherfield
This question has nothing to do with C.Elveraelves
I understand what you are trying to say, but the portmixer code that Audacity depends on which calls SetMasterVolumeLevelScalar is written in C, and the IAudioEndpointInterface is accessible via several programming langues, including C/C++. For these reasons I put the c tag on it.Sherfield
I
0

The cards you talk about -like the RME- ones simply do not support setting the master or any other level through software, and there is not much you can do about it. This is not a Windows bug. One could argue that giving back ENDPOINT_HARDWARE_SUPPORT_VOLUME is a bug though, but that likely originates from the driver level, not Windows itself.

The only solution I found so far is hooking up a debugger (or adding a dll hook) to the vendor supplied software and looking at the DeviceIOControl calls it makes (those are the ones used to talk to the hardware) while setting the volume in the vendor software. Pretty hard to do this for every single card, but probably worth doing for a couple of pro cards. Especially for Audacity, for open source audio software it's actually not that bad so I can imagine some people being really happy if the volume on their card could be set by it. (at the time we were exclusively using an RME Multiface I spent quite some time in figuring out the DeviceIOControl calls, but in the end it was definitely worth it as I could set the volume in dB for any point in the matrix)

Imprest answered 21/9, 2011 at 8:50 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.