internal AudioDevice(IntPtr pointer) { _pointer = pointer; if (pointer != IntPtr.Zero) { _struct = (Interop.MediaPlayer.AudioDevice) Marshal.PtrToStructure(pointer, typeof(Interop.MediaPlayer.AudioDevice)); Device = InteropHelper.PtrToString(_struct.Device); Description = InteropHelper.PtrToString(_struct.Description); } }
/// <summary> /// Configures an explicit audio output device. If the module paramater is NULL, /// audio output will be moved to the device specified by the device identifier string immediately. /// This is the recommended usage. A list of adequate potential device strings can be obtained with /// <see cref="EnumAudioDeviceList" />. /// However passing NULL is supported in LibVLC version 2.2.0 and later only; in earlier versions, this function would /// have no effects when the module parameter was NULL. /// If the module parameter is not NULL, the device parameter of the corresponding audio output, if it exists, will be /// set to the specified string. /// Note that some audio output modules do not have such a parameter (notably MMDevice and PulseAudio). /// A list of adequate potential device strings can be obtained with <see cref="GetAudioDeviceList" />. /// </summary> public void SetAudioDevice(AudioOutput audioOutput, AudioDevice audioDevice) { var outputHandle = audioOutput == null ? null : new GCHandle?(InteropHelper.StringToPtr(audioOutput.Name)); var deviceHandle = InteropHelper.StringToPtr(audioDevice.Device); _setAudioDeviceFunction.Delegate(InstancePointer, outputHandle == null ? IntPtr.Zero : outputHandle.Value.AddrOfPinnedObject(), deviceHandle.AddrOfPinnedObject()); if (outputHandle.HasValue) { outputHandle.Value.Free(); } deviceHandle.Free(); }