1

How on earth can you control the volume of the sound played using SndPlayAsync on Windows Mobile 6??

It seems like no one knows! The documentation doesn't mention anything regarding it... So either there's no way, or it is kept top secret...

In addition, I am aware of the possibility of using the Windows Media Player, but I rather not, if possible.

Thanks for any help!

Aviv.

4

2 回答 2

2

我的建议是:

[DllImport("coredll.dll", SetLastError = true)]
protected static extern int waveOutSetVolume(IntPtr device, uint volume);

[DllImport("coredll.dll", SetLastError = true)]
internal static extern int waveOutGetVolume(IntPtr device, ref int volume);

然后你可以调用方法:

int before;
uint maxVol = uint.MaxValue; 
waveOutGetVolume(IntPtr.Zero, ref before);
waveOutSetVolume(IntPtr.Zero, maxVol);
//Do some playing
waveOutSetVolume(IntPtr.Zero, before);

您可以调试其他值。这会将其设置为最高。

希望能帮助到你?

于 2010-04-20T13:59:20.303 回答
0

You need to use the mixer... API functions to set the master volume. Here is a code sample:

http://www.csharp-home.com/index/tiki-read_article.php?articleId=134

To use this code in your Windows Mobile application, you need to change "winmm.dll" to "coredll.dll". Also, these methods may not be supported in Windows Mobile, but I'm pretty sure they are.

于 2009-10-10T17:23:33.420 回答