/// <summary> /// Sets the volume level for one channel in the audio stream. /// </summary> /// <param name="index">The 0-based index into the channels to adjust the volume of.</param> /// <param name="level">The volume level between 0.0 and 1.0 for this channel of the audio stream.</param> public void SetChannelVolume(int index, float level) { CheckChannelIndex(index, nameof(index)); if (level < 0.0f) { throw new ArgumentOutOfRangeException(nameof(level), "Volume must be between 0.0 and 1.0"); } if (level > 1.0f) { throw new ArgumentOutOfRangeException(nameof(level), "Volume must be between 0.0 and 1.0"); } Marshal.ThrowExceptionForHR(audioStreamVolumeInterface.SetChannelVolume(unchecked ((uint)index), level)); }
/// <summary> /// get / set channel volume /// </summary> /// <param name="index">channel index</param> public float this[int index] { get { float level; int hr = _RealVolume.GetChannelVolume((uint)index, out level); Marshal.ThrowExceptionForHR(hr); return(level); } set { int hr = _RealVolume.SetChannelVolume((uint)index, value); Marshal.ThrowExceptionForHR(hr); } }