/// <summary> /// Allows sending a SampleProvider directly to an IWavePlayer without needing to convert /// back to an IWaveProvider /// </summary> /// <param name="wavePlayer">The WavePlayer</param> /// <param name="sampleProvider"></param> /// <param name="convertTo16Bit"></param> public static Task InitAsync(this IWavePlayer wavePlayer, ISampleProvider sampleProvider, bool convertTo16Bit = false) { IWaveProvider provider = convertTo16Bit ? (IWaveProvider) new SampleToWaveProvider16(sampleProvider) : new SampleToWaveProvider(sampleProvider); return(wavePlayer.InitAsync(provider)); }