public static int GetAudioVolume(this LibMWCapture.MWCAP_AUDIO_VOLUME audioStatus) { var volume = audioStatus.asVolume.LastOrDefault(); var volumeIndex = Array.IndexOf(AudioVolumes, volume); volumeIndex = Math.Min(Math.Max(volumeIndex, 0), AudioVolumes.Length - 1); return((int)(volumeIndex * 100.0 / AudioVolumes.Length)); }
public static void SetMute(this LibMWCapture.MWCAP_AUDIO_VOLUME audioStatus, IntPtr videoChannel, bool mute) { for (int i = 0; i < audioStatus.abMute.Length; i++) { audioStatus.abMute[i] = mute; } PInvokeTools.WriteStruct(audioStatus, ptr => LibMWCapture.MWSetAudioVolume(videoChannel, LibMWCapture.MWCAP_AUDIO_NODE.MWCAP_AUDIO_EMBEDDED_CAPTURE, ptr)); }
public static void SetAudioVolume(this LibMWCapture.MWCAP_AUDIO_VOLUME audioStatus, IntPtr videoChannel, int percent) { var volumeIndex = (int)(AudioVolumes.Length / 100.0 * percent); volumeIndex = Math.Min(Math.Max(volumeIndex, 0), AudioVolumes.Length - 1); var volume = AudioVolumes[volumeIndex]; for (int i = 0; i < audioStatus.asVolume.Length; i++) { audioStatus.asVolume[i] = volume; } PInvokeTools.WriteStruct(audioStatus, ptr => LibMWCapture.MWSetAudioVolume(videoChannel, LibMWCapture.MWCAP_AUDIO_NODE.MWCAP_AUDIO_EMBEDDED_CAPTURE, ptr)); }
public static bool GetMute(this LibMWCapture.MWCAP_AUDIO_VOLUME audioStatus) { var mute = audioStatus.abMute.LastOrDefault(); return(mute); }