Skip to content

Commit

Permalink
Merge branch 'dan2' of github.com:davispolito/bitKlavier2 into dan2
Browse files Browse the repository at this point in the history
  • Loading branch information
dantrueman committed Oct 18, 2024
2 parents 40023f5 + 2373a3a commit 87da7b2
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 12 deletions.
36 changes: 29 additions & 7 deletions source/synthesis/framework/DirectProcessor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,34 @@ DirectProcessor::DirectProcessor (const juce::ValueTree& v) : PluginBase (v, nul
//chowdsp::Serialization::deserialize<chowdsp::XMLSerializer>(xml,state);
adsrCallbacks += {

state.addParameterListener (*state.params.gainParam,
chowdsp::ParameterListenerThread::AudioThread,
[this] {
mainSynth.setSynthGain (juce::Decibels::decibelsToGain (state.params.gainParam->get()));
DBG ("direct gain: " + juce::String (state.params.gainParam->get()));
}),

state.addParameterListener (*state.params.hammerParam,
chowdsp::ParameterListenerThread::AudioThread,
[this] {
hammerSynth.setSynthGain (juce::Decibels::decibelsToGain (state.params.hammerParam->get()));
DBG ("hammer gain: " + juce::String (state.params.hammerParam->get()));
}),

state.addParameterListener (*state.params.releaseResonanceParam,
chowdsp::ParameterListenerThread::AudioThread,
[this] {
releaseResonanceSynth.setSynthGain (juce::Decibels::decibelsToGain (state.params.releaseResonanceParam->get()));
DBG ("release resonance gain: " + juce::String (state.params.releaseResonanceParam->get()));
}),

state.addParameterListener (*state.params.pedalParam,
chowdsp::ParameterListenerThread::AudioThread,
[this] {
pedalSynth.setSynthGain (juce::Decibels::decibelsToGain (state.params.pedalParam->get()));
DBG ("pedal gain: " + juce::String (state.params.pedalParam->get()));
}),

state.addParameterListener (*state.params.attackParam,
chowdsp::ParameterListenerThread::AudioThread,
[this] {
Expand All @@ -54,14 +82,8 @@ DirectProcessor::DirectProcessor (const juce::ValueTree& v) : PluginBase (v, nul
[this] {
mainSynth.globalADSR.release = state.params.releaseParam->get() * .001f;
DBG ("release: " + juce::String (state.params.releaseParam->get()));
}),

state.addParameterListener (*state.params.gainParam,
chowdsp::ParameterListenerThread::AudioThread,
[this] {
mainSynth.setSynthGain (juce::Decibels::decibelsToGain (state.params.gainParam->get()));
DBG ("direct gain: " + juce::String (state.params.gainParam->get()));
})

};

// these synths play their stuff on noteOff rather than noteOn
Expand Down
10 changes: 5 additions & 5 deletions source/synthesis/framework/DirectProcessor.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ struct DirectParams : chowdsp::ParamHolder
// Adds the appropriate parameters to the Direct Processor
DirectParams() : chowdsp::ParamHolder ("direct")
{
add (gainParam, hammerParam, resonanceParam, pedalParam, velocityParam, attackParam, decayParam, sustainParam, releaseParam);
add (gainParam, hammerParam, releaseResonanceParam, pedalParam, velocityParam, attackParam, decayParam, sustainParam, releaseParam);
}

// juce::Gain param
Expand All @@ -42,14 +42,14 @@ struct DirectParams : chowdsp::ParamHolder
};

// Resonance param
chowdsp::GainDBParameter::Ptr resonanceParam {
juce::ParameterID { "resonance", 100 },
"Resonance",
chowdsp::GainDBParameter::Ptr releaseResonanceParam {
juce::ParameterID { "releaseResonance", 100 },
"Release Resonance",
juce::NormalisableRange { rangeStart, rangeEnd, 0.0f, skewFactor, false },
-6.0f
};

// Resonance param
// Pedal param
chowdsp::GainDBParameter::Ptr pedalParam {
juce::ParameterID { "pedal", 100 },
"Pedal",
Expand Down

0 comments on commit 87da7b2

Please sign in to comment.