Envelope generator (ADSR)
 /// <summary>
 /// Creates a new AdsrSampleProvider with default values
 /// </summary>
 public AdsrSampleProvider(ISampleProvider source)
 {
     if (source.WaveFormat.Channels > 1) throw new ArgumentException("Currently only supports mono inputs");
     this.source = source;
     adsr = new EnvelopeGenerator();
     AttackSeconds = 0.01f;
     adsr.SustainLevel = 1.0f;
     adsr.DecayRate = 0.0f * WaveFormat.SampleRate;
     ReleaseSeconds = 0.3f;
     adsr.Gate(true);
 }
        public ADSRSignalGenerator(int sampleRate, int channel)
        {
            phi = 0;
            waveFormat = WaveFormat.CreateIeeeFloatWaveFormat(sampleRate, channel);

            // Default
            Type = SignalGeneratorType.Sin;
            Frequency = 440.0;
            Gain = 1;
            PhaseReverse = new bool[channel];
            SweepLengthSecs = 2;

            env = new EnvelopeGenerator();
            env.AttackRate = 0f;
            env.DecayRate = 0f;
            env.SustainLevel = .8f;
            env.ReleaseRate = 0f;
        }