Skip to content

Commit

Permalink
printADSR
Browse files Browse the repository at this point in the history
  • Loading branch information
vberthiaume committed Jul 5, 2024
1 parent 770090d commit 77a9b6c
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions source/DSP/ProPhatVoice.h
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,16 @@ class ProPhatVoice : public juce::SynthesiserVoice

//===========================================================================================================

inline void printADSR (juce::StringRef prefix, const juce::ADSR::Parameters& p)
{
juce::String str { prefix };
str << " a: " << p.attack;
str << " d: " << p.decay;
str << " s: " << p.sustain;
str << " r: " << p.release << "\n";
DBG (str);
}

template<std::floating_point T>
void ProPhatVoice<T>::renderNextBlockTemplate (juce::AudioBuffer<T>& outputBuffer, int startSample, int numSamples)
{
Expand Down Expand Up @@ -301,6 +311,7 @@ void ProPhatVoice<T>::prepare (const juce::dsp::ProcessSpec& spec)

ampADSR.setSampleRate (spec.sampleRate);
ampADSR.setParameters (ampParams);
printADSR ("prepare", ampADSR.getParameters());

filterADSR.setSampleRate (spec.sampleRate);
filterADSR.setParameters (filterEnvParams);
Expand Down Expand Up @@ -388,6 +399,7 @@ void ProPhatVoice<T>::setAmpParam (juce::StringRef parameterID, float newValue)
ampParams.release = newValue;

ampADSR.setParameters (ampParams);
printADSR ("setAmpParam", ampADSR.getParameters());
}

template <std::floating_point T>
Expand Down Expand Up @@ -535,6 +547,7 @@ void ProPhatVoice<T>::startNote (int midiNoteNumber, float velocity, juce::Synth
#endif

ampADSR.setParameters (ampParams);
printADSR ("startNote", ampADSR.getParameters());
ampADSR.reset();
ampADSR.noteOn();

Expand Down

0 comments on commit 77a9b6c

Please sign in to comment.