public void SetSoundTouchProfile(SoundTouchProfile soundTouchProfile)
 {
     if (currentSoundTouchProfile != null &&
         playbackRate != 1.0f &&
         soundTouchProfile.UseTempo != currentSoundTouchProfile.UseTempo)
     {
         if (soundTouchProfile.UseTempo)
         {
             soundTouch.SetRate(1.0f);
             soundTouch.SetPitchOctaves(0f);
             soundTouch.SetTempo(playbackRate);
         }
         else
         {
             soundTouch.SetTempo(1.0f);
             soundTouch.SetRate(playbackRate);
         }
     }
     this.currentSoundTouchProfile = soundTouchProfile;
     soundTouch.SetUseAntiAliasing(soundTouchProfile.UseAntiAliasing);
     soundTouch.SetUseQuickSeek(soundTouchProfile.UseQuickSeek);
 }
        public VarispeedSampleProvider(ISampleProvider sourceProvider, int readDurationMilliseconds, SoundTouchProfile soundTouchProfile)
        {
            soundTouch = new SoundTouch();
            // explore what the default values are before we change them:
            //Debug.WriteLine(String.Format("SoundTouch Version {0}", soundTouch.VersionString));
            //Debug.WriteLine("Use QuickSeek: {0}", soundTouch.GetUseQuickSeek());
            //Debug.WriteLine("Use AntiAliasing: {0}", soundTouch.GetUseAntiAliasing());

            SetSoundTouchProfile(soundTouchProfile);
            this.sourceProvider = sourceProvider;
            soundTouch.SetSampleRate(WaveFormat.SampleRate);
            channelCount = WaveFormat.Channels;
            soundTouch.SetChannels(channelCount);
            sourceReadBuffer     = new float[(WaveFormat.SampleRate * channelCount * (long)readDurationMilliseconds) / 1000];
            soundTouchReadBuffer = new float[sourceReadBuffer.Length * 10]; // support down to 0.1 speed
        }