1

I've learned everything I can about WinMM (opening/closing mixers, enumerating controls, etc.) Where I'm stumped is that it seems WPF's MediaElement ignores my settings through WinMM, but Window's Volume Mixer shows I'm correctly changing the settings.

So I can essentially mute the volume with my control, see that it's muted in the Volume Mixer, play the sound and hear it, then double click the mute button in the Volume Mixer, play the sound and not hear it.

Something is done through the Window's Volume Mixer that is more than just WinMM api calls, but the display is using WinMM settings.

Is there something I'm missing?

I've used every line, and only Speaker/WaveOut work. I'm getting the Volume and Mute controls from the line and both have the same effect.

This is only the MediaElement causing this. If I play a sound through WinMM or if I have a native control or explorer embedded, I can mute that with my volume control.

My first theory is that because I'm testing in Windows7, the MediaElement is assigned to a separate session than the application's default session, and somehow the Volume Mixer is affecting all sessions in an application. At which point I'd have to choose depending on OS whether to use WinMM or WASAPI. If that's true, then WinMM really isn't supported like Windows claims (for backwards compatibility), but maybe they meant for older technologies (like Winforms and AFX/MFC).

EDIT: I'm using the code at this answer: https://stackoverflow.com/a/294525/491837

Community
  • 1
  • 1
Lee Louviere
  • 5,162
  • 30
  • 54
  • what version of Windows are you using? WinMM is the old audio API model, which was superceded by WASAPI from Vista onwards. You'd be better off using those APIs instead if you aren't working with XP. – Mark Heath Feb 26 '13 at 18:43
  • @Mark I have to be compatible with XP, which is why I'm using this API. But I'm seeing this issue on Windows 7. – Lee Louviere Feb 26 '13 at 19:12
  • doesn't surprise me. It is really hard to use the mixer api and get it to work on both XP and Windows 7 at the same time. I've had exactly the same problem trying to set microphone recording levels – Mark Heath Feb 26 '13 at 23:32
  • @Mark Is it that the MediaElement uses a different audio session? What's worse is that MediaPlayer ignores Volume Mixer settings as well, so you can only set it's volume by the control or master volume. Which leads me to believe that possibly MediaPlayer uses a different process even, and that MediaElement is stuck to your process because it's in the visual tree of the window. – Lee Louviere Feb 27 '13 at 17:33
  • yes, that sounds like a plausible explanation. WASAPI does not let you do anything with audio sessions you don't know the GUID to. – Mark Heath Feb 28 '13 at 07:56

0 Answers0