Guest User

Untitled

a guest
Oct 23rd, 2017
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.34 KB | None | 0 0
  1. [DllImport("winmm.dll")]
  2. private static extern int waveOutSetVolume(IntPtr hwo, uint dwVolume);
  3. private void SetVolume(int volume)
  4. {
  5. int NewVolume = ((ushort.MaxValue / 10) * volume);
  6. uint NewVolumeAllChannels = ((Convert.ToUInt32(NewVolume) & 0xffff) | (Convert.ToUInt32(NewVolume) << 16));
  7. waveOutSetVolume(IntPtr.Zero, NewVolumeAllChannels);
  8. }
Add Comment
Please, Sign In to add comment