You should be able to P/Invoke the wavefore audio methods:
[DllImport ("coredll.dll")]
protected static extern Wave.MMSYSERR waveOutSetVolume(IntPtr hwo, uint
dwVolume);
I would imagine the problem may be with the volume you are passing. Volume
is a weird problem on devices...
Not all devices support volume changes. To determine whether the device
supports volume control, use the WAVECAPS_VOLUME flag to test the dwSupport
member of the WAVEOUTCAPS structure (filled by the waveOutGetDevCaps
function). To determine whether the device supports volume control on both
the left and right channels, use the WAVECAPS_LRVOLUME flag.
Most devices do not support the full 16 bits of volume-level control and
will not use the high-order bits of the requested volume setting. For
example, for a device that supports 4 bits of volume control, requested
volume level values of 0x4000, 0x4FFF, and 0x43BE all produce the same
physical volume setting: 0x4000. The waveOutGetVolume function returns the
full 16-bit setting set with waveOutSetVolume.
Volume settings are interpreted logarithmically. This means the perceived
increase in volume is the same when increasing the volume level from 0x5000
to 0x6000 as it is from 0x4000 to 0x5000.
As far as I have been able to determine, there is no way to tell how many
bits of volume are supported.
--
Geoff Schwab
Program Manager
Excell Data Corporation
http://msdn.com/mobility
http://msdn.microsoft.com/mobility/prodtechinfo/devtools/netcf/FAQ/default.aspx
This posting is provided "AS IS" with no warranties, and confers no rights.
Balint Toth said:
Hi all,
How can I change the volume level from a c# application? I tried
OpenNETCF.Multimedia.Audio but it doesnt work. It runs on the emulator OK,
but on my RED-E 1100 it halts when I create the player object:
OpenNETCF.Multimedia.Audio.Player player = new
OpenNETCF.Multimedia.Audio.Player();
Do I need some other initialization before this? Or is there any other
volume control in .NET CF?
Best regards,
Bálint Tóth