public static AudioPlaybackEngine CreateAudioPlaybackEngine(DeviceInterfaceType type, SampleRate sampleRate, Channels channels, int latency) { IWavePlayer deviceInterface = null; switch (type) { case DeviceInterfaceType.WaveOut: deviceInterface = new WaveOut() { DesiredLatency = latency }; break; case DeviceInterfaceType.WaveOutEvent: deviceInterface = new WaveOutEvent() { DesiredLatency = latency }; break; case DeviceInterfaceType.WasapiOut: deviceInterface = new WasapiOut(AudioClientShareMode.Shared, latency); break; case DeviceInterfaceType.DirectSoundOut: deviceInterface = new DirectSoundOut(latency); break; default: throw new ArgumentException("type"); } return(new AudioPlaybackEngine(deviceInterface, (int)sampleRate, (int)channels)); }
public static IAudioPlaybackEngine CreateAudioPlaybackEngine(DeviceInterfaceType type) { return(CreateAudioPlaybackEngine(type, SampleRate.CD, Channels.Stereo, 200)); }