internal static void SetWaveOutVolume(float value, IntPtr hWaveOut, object lockObject) { if (value < 0f) { throw new ArgumentOutOfRangeException("value", "Volume must be between 0.0 and 1.0"); } if (value > 1f) { throw new ArgumentOutOfRangeException("value", "Volume must be between 0.0 and 1.0"); } int dwVolume = (int)(value * 65535f) + ((int)(value * 65535f) << 16); MmResult result; lock (lockObject) { result = WaveInterop.waveOutSetVolume(hWaveOut, dwVolume); } MmException.Try(result, "waveOutSetVolume"); }
internal static void SetWaveOutVolume(float value, IntPtr hWaveOut, object lockObject) { if (value < 0) { throw new ArgumentOutOfRangeException("value", "Volume must be between 0.0 and 1.0"); } if (value > 1) { throw new ArgumentOutOfRangeException("value", "Volume must be between 0.0 and 1.0"); } float left = value; float right = value; int stereoVolume = (int)(left * 0xFFFF) + ((int)(right * 0xFFFF) << 16); MmResult result; lock (lockObject) { result = WaveInterop.waveOutSetVolume(hWaveOut, stereoVolume); } MmException.Try(result, "waveOutSetVolume"); }
private void SetVolume(int stereoVolume) { MmException.Try(WaveInterop.waveOutSetVolume(hWaveOut, stereoVolume), "waveOutSetVolume"); }