C#中如何控制播放音乐的声音大小
                                                            生活随笔
收集整理的這篇文章主要介紹了
                                C#中如何控制播放音乐的声音大小
小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.                        
                                
                            
                            
                            C# code:
[DllImport("winmm.dll", SetLastError=true, CallingConvention=CallingConvention.Winapi)] public static extern int waveOutSetVolume(int uDeviceID, int dwVolume); //Call waveOutSetVolume( 0, 100 );
第一個參數(shù)可以為0,表示首選設(shè)備
第二個參數(shù)為音量:0xFFFF為最大,0x0000為最小,其中高位(前兩位)表示右聲道音量,低位(后兩位)表示左聲道音量
int iVolume=50;//音量大小(0-100)
int left =Convert .ToInt32 ( Convert.ToInt32(iVolume));
int right = left;
int volume = (left << 8) | right ;
waveOutSetVolume(0,volume );
                        
                        
                        [DllImport("winmm.dll", SetLastError=true, CallingConvention=CallingConvention.Winapi)] public static extern int waveOutSetVolume(int uDeviceID, int dwVolume); //Call waveOutSetVolume( 0, 100 );
第一個參數(shù)可以為0,表示首選設(shè)備
第二個參數(shù)為音量:0xFFFF為最大,0x0000為最小,其中高位(前兩位)表示右聲道音量,低位(后兩位)表示左聲道音量
int iVolume=50;//音量大小(0-100)
int left =Convert .ToInt32 ( Convert.ToInt32(iVolume));
int right = left;
int volume = (left << 8) | right ;
waveOutSetVolume(0,volume );
轉(zhuǎn)載于:https://www.cnblogs.com/qqhfeng/archive/2013/05/14/3077690.html
總結(jié)
以上是生活随笔為你收集整理的C#中如何控制播放音乐的声音大小的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
 
                            
                        - 上一篇: Spring3 MVC+Spring+S
- 下一篇: js中prototype用法
