Пример #1
0
        public void SetDevice(SoundOutDevice device)
        {
            CheckForCreated();
            switch (_soundOutType)
            {
            case SoundOutType.WaveOut:
                var waveOut = (WaveOut)_soundOut;
                waveOut.Device = (int)device.NativeDevice;
                break;

            case SoundOutType.DirectSound:
                var dsound = (DirectSoundOut)_soundOut;
                dsound.Device = ((DirectSoundDevice)device.NativeDevice).Guid;
                break;

            case SoundOutType.Wasapi:
                var wasapi = (WasapiOut)_soundOut;
                wasapi.Device = (MMDevice)device.NativeDevice;
                break;

            default:
                throw new InvalidOperationException();
            }
        }
Пример #2
0
        public void SetDevice(SoundOutDevice device)
        {
            CheckForCreated();
            switch (_soundOutType)
            {
                case SoundOutType.WaveOut:
                    var waveOut = (WaveOut)_soundOut;
                    waveOut.Device = (int)device.NativeDevice;
                    break;

                case SoundOutType.DirectSound:
                    var dsound = (DirectSoundOut)_soundOut;
                    dsound.Device = ((DirectSoundDevice)device.NativeDevice).Guid;
                    break;

                case SoundOutType.Wasapi:
                    var wasapi = (WasapiOut)_soundOut;
                    wasapi.Device = (MMDevice)device.NativeDevice;
                    break;

                default:
                    throw new InvalidOperationException();
            }
        }