コード例 #1
0
        /// <summary>
        ///     Selects an audio output module.
        ///     Any change will take be effect only after playback is stopped and restarted. Audio output cannot be changed while
        ///     playing.
        /// </summary>
        /// <param name="audioOutput"></param>
        /// <returns></returns>
        public bool SetAudioOutput(AudioOutput audioOutput)
        {
            var handle = InteropHelper.StringToPtr(audioOutput.Name);
            var result = _setAudioOutputFunction.Delegate(InstancePointer, handle.AddrOfPinnedObject());

            handle.Free();
            return(result == 0);
        }
コード例 #2
0
        /// <summary>
        ///     Gets a list of audio output devices for a given audio output module.
        /// </summary>
        /// <param name="audioOutput"></param>
        /// <returns></returns>
        public AudioDeviceList GetAudioDeviceList(AudioOutput audioOutput)
        {
            var handle = InteropHelper.StringToPtr(audioOutput.Name);
            var result =
                new AudioDeviceList(_getAudioDeviceListFunction.Delegate(VlcInstance.InstancePointer,
                                                                         handle.AddrOfPinnedObject()));

            handle.Free();
            return(result);
        }
コード例 #3
0
        /// <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();
        }