Beispiel #1
0
 public ISampleProvider play(ISampleProvider source)
 {
     lock (_lock) {
         try {
             source = SFXUtilities.ConvertSampleFormat(source, mixer.WaveFormat);
             mixer.AddMixerInput(source);
             return(source);
         } catch (UnsupportedAudioException) {
             return(null);
         }
     }
 }
Beispiel #2
0
 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);
 }