public ISampleProvider play(ISampleProvider source) { lock (_lock) { try { source = SFXUtilities.ConvertSampleFormat(source, mixer.WaveFormat); mixer.AddMixerInput(source); return(source); } catch (UnsupportedAudioException) { return(null); } } }
public static ISampleProvider ConvertSampleFormat(ISampleProvider source, WaveFormat dFormat) { // resample, if required if (source.WaveFormat.SampleRate != dFormat.SampleRate) { source = new WdlResamplingSampleProvider(source, dFormat.SampleRate); } // adjust channel count, if required if (source.WaveFormat.Channels != dFormat.Channels) { source = SFXUtilities.AdjustChannelCount(source, (uint)dFormat.Channels); } return(source); }