diff --git a/src/clap/six-sines-clap.cpp b/src/clap/six-sines-clap.cpp index 67e9581..a8c585b 100644 --- a/src/clap/six-sines-clap.cpp +++ b/src/clap/six-sines-clap.cpp @@ -55,7 +55,7 @@ struct SixSinesClap : public plugHelper_t, sst::clap_juce_shim::EditorProvider clapJuceShim = std::make_unique(this); clapJuceShim->setResizable(false); } - virtual ~SixSinesClap() {}; + virtual ~SixSinesClap(){}; std::unique_ptr engine; size_t blockPos{0}; diff --git a/src/dsp/node_support.h b/src/dsp/node_support.h index 5deb3ae..b32e92c 100644 --- a/src/dsp/node_support.h +++ b/src/dsp/node_support.h @@ -378,6 +378,9 @@ template struct ModulationSupport case ModMatrixConfig::Source::RELEASED: sourcePointers[which] = &voiceValues.ungatedFloat; break; + case ModMatrixConfig::Source::KEYTRACK_FROM_60: + sourcePointers[which] = &voiceValues.keytrackFrom60; + break; case ModMatrixConfig::Source::MPE_PRESSURE: sourcePointers[which] = &voiceValues.mpePressure; diff --git a/src/synth/mod_matrix.cpp b/src/synth/mod_matrix.cpp index 0b8f200..8658f3c 100644 --- a/src/synth/mod_matrix.cpp +++ b/src/synth/mod_matrix.cpp @@ -53,6 +53,7 @@ ModMatrixConfig::ModMatrixConfig() add(GATED, "Voice", "Gated"); add(RELEASED, "Voice", "Released"); add(UNISON_VAL, "Voice", "Unison Position"); + add(KEYTRACK_FROM_60, "Voice", "Keytrack from 60"); add(MPE_PRESSURE, "MPE", "Pressure"); add(MPE_TIMBRE, "MPE", "Timbre"); diff --git a/src/synth/mod_matrix.h b/src/synth/mod_matrix.h index 1a1422b..f29b0dc 100644 --- a/src/synth/mod_matrix.h +++ b/src/synth/mod_matrix.h @@ -49,6 +49,7 @@ struct ModMatrixConfig GATED = voiceLevel + 50, RELEASED = voiceLevel + 51, UNISON_VAL = voiceLevel + 60, + KEYTRACK_FROM_60 = voiceLevel + 61, MPE_PRESSURE = voiceLevel + 100, MPE_TIMBRE = voiceLevel + 101, diff --git a/src/synth/synth.h b/src/synth/synth.h index 66afe13..8ee3682 100644 --- a/src/synth/synth.h +++ b/src/synth/synth.h @@ -80,7 +80,7 @@ struct Synth void moveVoice(Voice *v, uint16_t p, uint16_t c, uint16_t k, float ve) { v->setupPortaTo(k, synth.patch.output.portaTime.value); - v->voiceValues.key = k; + v->voiceValues.setKey(k); v->voiceValues.velocity = ve; v->retriggerAllEnvelopesForKeyPress(); } @@ -88,7 +88,7 @@ struct Synth void moveAndRetriggerVoice(Voice *v, uint16_t p, uint16_t c, uint16_t k, float ve) { v->setupPortaTo(k, synth.patch.output.portaTime.value); - v->voiceValues.key = k; + v->voiceValues.setKey(k); v->voiceValues.velocity = ve; v->voiceValues.setGated(true); v->retriggerAllEnvelopesForReGate(); @@ -157,7 +157,7 @@ struct Synth obuf[vc].voice = &synth.voices[i]; synth.voices[i].used = true; synth.voices[i].voiceValues.setGated(true); - synth.voices[i].voiceValues.key = key; + synth.voices[i].voiceValues.setKey(key); synth.voices[i].voiceValues.channel = ch; synth.voices[i].voiceValues.velocity = vel; synth.voices[i].voiceValues.releaseVelocity = 0; diff --git a/src/synth/voice_values.h b/src/synth/voice_values.h index 4ad6fc1..bd10a35 100644 --- a/src/synth/voice_values.h +++ b/src/synth/voice_values.h @@ -25,7 +25,7 @@ namespace baconpaul::six_sines { struct VoiceValues { - VoiceValues() : gated(gatedV) {} + VoiceValues() : gated(gatedV), key(keyV) {} const bool &gated; float gatedFloat, ungatedFloat; @@ -35,7 +35,14 @@ struct VoiceValues gatedFloat = g ? 1.f : 0.f; ungatedFloat = 1.0 - gatedFloat; } - int key{0}, channel{0}; + void setKey(int k) + { + keyV = k; + keytrackFrom60 = (k - 60) / 12.0; + } + const int &key; + float keytrackFrom60; + int channel{0}; float velocity{0}, releaseVelocity{0}; float polyAt{0}; @@ -54,6 +61,7 @@ struct VoiceValues private: bool gatedV{false}; + int keyV{0}; }; }; // namespace baconpaul::six_sines #endif // MONO_VALUES_H