Esempio n. 1
0
        private void InitializeOutputDevices()
        {
            OutputList.Clear();

            if (ShowAdvancedControls)
                foreach (var device in DirectSoundOut.Devices)
                {
                    OutputList.Add(new OutputDeviceModel(device));
                }

            if (ShowAdvancedControls)
                for (int n = 0; n < WaveOut.DeviceCount; n++)
                {
                    var capabilities = WaveOut.GetCapabilities(n);
                    OutputList.Add(new OutputDeviceModel(n, capabilities));
                }

            foreach (var device in MMDevices.deviceEnum.EnumerateAudioEndPoints(DataFlow.Render, DeviceState.Active).ToList())
            {
                var model = new OutputDeviceModel(device);
                OutputList.Add(model);
            }
        }
Esempio n. 2
0
 public static IWavePlayer InstanciateWavePlayerForOutput(OutputDeviceModel SelectedOutput, int desiredLatency, AudioClientShareMode shareMode, bool useWaveEvent)
 {
     switch (SelectedOutput.Provider)
     {
         case DeviceProvider.Wave:
             {
                 if (useWaveEvent)
                     return new WaveOutEvent() { DeviceNumber = SelectedOutput.WavDeviceNumber, DesiredLatency = desiredLatency };
                 else
                     return new WaveOut() { DeviceNumber = SelectedOutput.WavDeviceNumber, DesiredLatency = desiredLatency };
             }
         case DeviceProvider.DirectSound:
             return new DirectSoundOut(SelectedOutput.DirectSoundDeviceInfo.Guid, desiredLatency);
         case DeviceProvider.Wasapi:
             return new WasapiOut(SelectedOutput.MMDevice, shareMode, useEventSync, desiredLatency);
     }
     return new DirectSoundOut(DirectSoundOut.DSDEVID_DefaultVoicePlayback, desiredLatency);
 }