public AdsrSampleProvider(ISampleProvider source, float Attack, float Decay, float Sustain, float Release)
 {
     this.source       = source;
     adsr              = new EnvelopeGenerator();
     adsr.AttackRate   = Attack * WaveFormat.SampleRate;
     adsr.SustainLevel = Sustain;
     adsr.DecayRate    = Decay * WaveFormat.SampleRate;
     adsr.ReleaseRate  = Release * WaveFormat.SampleRate;
     adsr.Gate(true);
 }
 public AdsrSampleProvider(ISampleProvider source)
 {
     this.source       = source;
     adsr              = new EnvelopeGenerator();
     adsr.AttackRate   = attack * WaveFormat.SampleRate;
     adsr.SustainLevel = sustain;
     adsr.DecayRate    = decay * WaveFormat.SampleRate;
     adsr.ReleaseRate  = release * WaveFormat.SampleRate;
     adsr.Gate(true);
 }
示例#3
0
 /// <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);
 }
示例#4
0
 public new void NoteOn()
 {
     base.NoteOn();
     _filterEnvelope.Gate(true);
 }
示例#5
0
 /// <summary>
 /// Enters the Release phase
 /// </summary>
 public void Stop()
 {
     adsr.Gate(false);
 }
示例#6
0
 public void NoteOn()
 {
     _amplitudeEnvelope.Gate(true);
     _isPlaying = true;
 }