Discussion:
auxGetVolume problem
(too old to reply)
cnickl
2007-07-08 05:40:00 UTC
Permalink
Hi,

I’m trying to get the volume of my soundcard using the Win API auxGetVolume
in a C# program:

I declare the function like this:

[DllImport("winmm.dll")]
public static extern int auxGetVolume(int uDeviceID, out long lpdwVolume);

later I call it:

long AuxVol;
auxGetVolume(0, out AuxVol);

regardless what I try, it returns 0, even so I hear music playing. The whole
thing works fine using waveGetVolume. What am I doing wrong? Is there a good
code example using C#?

thanks
Chris P.
2007-07-08 14:29:00 UTC
Permalink
Post by cnickl
Hi,
I’m trying to get the volume of my soundcard using the Win API auxGetVolume
[DllImport("winmm.dll")]
public static extern int auxGetVolume(int uDeviceID, out long lpdwVolume);
long AuxVol;
auxGetVolume(0, out AuxVol);
regardless what I try, it returns 0, even so I hear music playing. The whole
thing works fine using waveGetVolume. What am I doing wrong? Is there a good
code example using C#?
"Not all devices support volume control. To determine whether a device
supports volume control, use the AUXCAPS_VOLUME flag to test the dwSupport
member of the AUXCAPS structure (filled by the auxGetDevCaps function)."

What does auxGetNumDevs() and auxGetDevCaps(n) return?
--
http://www.chrisnet.net/code.htm
[MS MVP for DirectShow / MediaFoundation]
cnickl
2007-07-08 19:54:02 UTC
Permalink
Post by Chris P.
Hi,
Iʼm trying to get the volume of my soundcard using the Win API auxGetVolume
[DllImport("winmm.dll")]
public static extern int auxGetVolume(int uDeviceID, out long lpdwVolume);
long AuxVol;
auxGetVolume(0, out AuxVol);
regardless what I try, it returns 0, even so I hear music playing. The whole
thing works fine using waveGetVolume. What am I doing wrong? Is there a good
code example using C#?
"Not all devices support volume control. To determine whether a device
supports volume control, use the AUXCAPS_VOLUME flag to test the dwSupport
member of the AUXCAPS structure (filled by the auxGetDevCaps function)."
What does auxGetNumDevs() and auxGetDevCaps(n) return?
--
http://www.chrisnet.net/code.htm
[MS MVP for DirectShow / MediaFoundation]
Well, apparently I’m not skilled enough to get the easiest things to work. I
can’t get the AUXCAPS structure defined in any way. Maybe the reason is that
I’m using C# and obviously things work different than in C++. Anyway
auxGetNumDevs returns 0.

What I’m trying to accomplish is to read and set the volume of the speakers
like its done using the Speaker volume control in Windows. I know that it
works since the external soundcard I’m using (Creative X-mod) has a volume
dial on it and when I turn it, the trackbar in the Windows Speaker settings
changes. Is auxGetVolume and auxSetVolume actually the correct way to go?
waveSetVolume works, but it’s not the volume of the Soundcard that’s changed.
I hope I was able to make myself clear enough.

Thanks, (a very frustrated) cnickl
cnickl
2007-07-08 20:24:01 UTC
Permalink
Post by cnickl
Post by Chris P.
Hi,
Iʼm trying to get the volume of my soundcard using the Win API auxGetVolume
[DllImport("winmm.dll")]
public static extern int auxGetVolume(int uDeviceID, out long lpdwVolume);
long AuxVol;
auxGetVolume(0, out AuxVol);
regardless what I try, it returns 0, even so I hear music playing. The whole
thing works fine using waveGetVolume. What am I doing wrong? Is there a good
code example using C#?
"Not all devices support volume control. To determine whether a device
supports volume control, use the AUXCAPS_VOLUME flag to test the dwSupport
member of the AUXCAPS structure (filled by the auxGetDevCaps function)."
What does auxGetNumDevs() and auxGetDevCaps(n) return?
--
http://www.chrisnet.net/code.htm
[MS MVP for DirectShow / MediaFoundation]
Well, apparently I’m not skilled enough to get the easiest things to work. I
can’t get the AUXCAPS structure defined in any way. Maybe the reason is that
I’m using C# and obviously things work different than in C++. Anyway
auxGetNumDevs returns 0.
What I’m trying to accomplish is to read and set the volume of the speakers
like its done using the Speaker volume control in Windows. I know that it
works since the external soundcard I’m using (Creative X-mod) has a volume
dial on it and when I turn it, the trackbar in the Windows Speaker settings
changes. Is auxGetVolume and auxSetVolume actually the correct way to go?
waveSetVolume works, but it’s not the volume of the Soundcard that’s changed.
I hope I was able to make myself clear enough.
Thanks, (a very frustrated) cnickl
I actually got auxGetDevCaps to work. (stupid mistake on my side). However,
since auxGetNumDevs returns 0 there is naturally no info available. I
appreciate any input.
Chris P.
2007-07-10 14:45:17 UTC
Permalink
Post by cnickl
I actually got auxGetDevCaps to work. (stupid mistake on my side). However,
since auxGetNumDevs returns 0 there is naturally no info available. I
appreciate any input.
Not surprising as the auxDev's are seldom implemented. What your actually
after is the "Mixer". The mixer contains a list of all the controls you
see in the sndvol32 program (and the creative version) and lets you get and
set the values.

See the previous discussions about the mixer in this group, mixerOpen()
mixerGetLineInfo(), mixerGetLineControls(). Sadly it's a very complicated
API so implementing it from C# is going to be difficult to say the least.
But a simple volume control shouldn't be too bad.
--
http://www.chrisnet.net/code.htm
[MS MVP for DirectShow / MediaFoundation]
cnickl
2007-07-09 04:32:03 UTC
Permalink
Post by Chris P.
Hi,
Iʼm trying to get the volume of my soundcard using the Win API auxGetVolume
[DllImport("winmm.dll")]
public static extern int auxGetVolume(int uDeviceID, out long lpdwVolume);
long AuxVol;
auxGetVolume(0, out AuxVol);
regardless what I try, it returns 0, even so I hear music playing. The whole
thing works fine using waveGetVolume. What am I doing wrong? Is there a good
code example using C#?
"Not all devices support volume control. To determine whether a device
supports volume control, use the AUXCAPS_VOLUME flag to test the dwSupport
member of the AUXCAPS structure (filled by the auxGetDevCaps function)."
What does auxGetNumDevs() and auxGetDevCaps(n) return?
--
http://www.chrisnet.net/code.htm
[MS MVP for DirectShow / MediaFoundation]
I would like to add to my question. When I open the Speaker control in
Windows (Control Panel – Sound and Audio Devices – Advanced) I get to a
speaker control with several trackbars. (Speaker, Wave, SW Synth and CD
Player) I know that the winmm.dll function waveSetVolume controls the volume
that’s also controlled by the Wave trackbar of this control.

My question is: is the function auxSetVolume responsible for the volume
controlled by the Speaker trackbar? If not what function is and if yes why
does the code I posted earlier not work?
Loading...