diff --git a/libs/sst/sst-voicemanager b/libs/sst/sst-voicemanager index 66cfeb88..c814b3fc 160000 --- a/libs/sst/sst-voicemanager +++ b/libs/sst/sst-voicemanager @@ -1 +1 @@ -Subproject commit 66cfeb887f46094f3d5d10af334689e470b93556 +Subproject commit c814b3fcad63b0aa91ef1c9e40e4461cbe73a749 diff --git a/src/engine/engine_voice_responder.cpp b/src/engine/engine_voice_responder.cpp index eeada914..43a6dd95 100644 --- a/src/engine/engine_voice_responder.cpp +++ b/src/engine/engine_voice_responder.cpp @@ -287,7 +287,7 @@ void Engine::VoiceManagerResponder::moveAndRetriggerVoice(VMConfig::voice_t *v, v->key = key; v->originalMidiKey = key - dkey; v->calculateVoicePitch(); - v->isGated = true; + v->setIsGated(true); for (auto &eg : v->eg) { eg.attackFrom(eg.outBlock0); @@ -296,7 +296,6 @@ void Engine::VoiceManagerResponder::moveAndRetriggerVoice(VMConfig::voice_t *v, { eg.attackFrom(eg.outBlock0); } - SCLOG("TODO - Gate voice and Retrigger AEG and EG2"); } void Engine::MonoVoiceManagerResponder::setMIDIPitchBend(int16_t channel, int16_t pb14bit) diff --git a/src/modulation/voice_matrix.cpp b/src/modulation/voice_matrix.cpp index ea3b7308..5fbeab30 100644 --- a/src/modulation/voice_matrix.cpp +++ b/src/modulation/voice_matrix.cpp @@ -155,6 +155,9 @@ void MatrixEndpoints::Sources::bind(scxt::voice::modulation::Matrix &m, engine:: m.bindSourceValue(noteExpressions.pressure, v.noteExpressions[(int)Voice::ExpressionIDs::PRESSURE]); + m.bindSourceValue(voiceSources.isGated, v.isGatedF); + m.bindSourceValue(voiceSources.isReleased, v.isReleasedF); + for (int i = 0; i < scxt::numTransportPhasors; ++i) { m.bindSourceValue(transportSources.phasors[i], z.getEngine()->transportPhasors[i]); diff --git a/src/modulation/voice_matrix.h b/src/modulation/voice_matrix.h index ffad6bd3..f345bb0c 100644 --- a/src/modulation/voice_matrix.h +++ b/src/modulation/voice_matrix.h @@ -226,7 +226,7 @@ struct MatrixEndpoints Sources(engine::Engine *e) : lfoSources(e), midiCCSources(e), midiSources(e), noteExpressions(e), aegSource{'zneg', 'aeg ', 0}, eg2Source{'zneg', 'eg2 ', 0}, transportSources(e), - rngSources(e), macroSources(e), mpeSources(e) + rngSources(e), macroSources(e), mpeSources(e), voiceSources(e) { registerVoiceModSource(e, aegSource, "", "AEG"); registerVoiceModSource(e, eg2Source, "", "EG2"); @@ -292,6 +292,16 @@ struct MatrixEndpoints SR volume, pan, tuning, vibrato, expression, brightness, pressure; } noteExpressions; + struct VoiceSources + { + VoiceSources(engine::Engine *e) : isGated{'zvsr', 'gate'}, isReleased{'zvsr', 'reld'} + { + registerVoiceModSource(e, isGated, "Voice", "Is Gated"); + registerVoiceModSource(e, isReleased, "Voice", "Is Released"); + } + SR isGated, isReleased; + } voiceSources; + TransportSourceBase transportSources; struct RNGSources diff --git a/src/voice/voice.h b/src/voice/voice.h index 7e44b090..557c1027 100644 --- a/src/voice/voice.h +++ b/src/voice/voice.h @@ -189,6 +189,14 @@ struct alignas(16) Voice : MoveableOnly, * Voice Playback State Model. */ bool isGated{false}; + float isGatedF{0.f}, isReleasedF{0.f}; + void setIsGated(bool g) + { + isGated = g; + isGatedF = g ? 1.f : 0.f; + isReleasedF = g ? 0.f : 1.f; + }; + std::array isGeneratorRunning{}; bool isAnyGeneratorRunning{}; bool isAEGRunning{false}; @@ -202,7 +210,7 @@ struct alignas(16) Voice : MoveableOnly, void attack() { - isGated = true; + setIsGated(true); isAEGRunning = true; isVoicePlaying = true; @@ -212,7 +220,7 @@ struct alignas(16) Voice : MoveableOnly, voiceStarted(); } - void release() { isGated = false; } + void release() { setIsGated(false); } void beginTerminationSequence() { terminationSequence = blocksToTerminate; } void cleanupVoice();