Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hook up legato mode from the voice manager #1450

Merged
merged 1 commit into from
Nov 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 16 additions & 2 deletions src-ui/app/edit-screen/components/GroupSettingsCard.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,15 @@ void GroupSettingsCard::rebuildFromInfo()
if (info.vmPlayModeInt == (int32_t)engine::Engine::voiceManager_t::PlayMode::MONO_NOTES)
{
polyMenu->setEnabled(false);
polyModeMenu->setLabel("MONO");
if (info.vmPlayModeFeaturesInt &
(int32_t)engine::Engine::voiceManager_t::MonoPlayModeFeatures::MONO_LEGATO)
{
polyModeMenu->setLabel("LEG");
}
else
{
polyModeMenu->setLabel("MONO");
}
repaint();
}
else
Expand Down Expand Up @@ -232,9 +240,15 @@ void GroupSettingsCard::showPolyModeMenu()
w->rebuildFromInfo();
w->sendToSerialization(messaging::client::UpdateGroupOutputInfoPolyphony{w->info});
});
p.addItem("Legato", false, false, [w = juce::Component::SafePointer(this)]() {
p.addItem("Legato", true, false, [w = juce::Component::SafePointer(this)]() {
if (!w)
return;
w->info.vmPlayModeInt = (uint32_t)engine::Engine::voiceManager_t::PlayMode::MONO_NOTES;
w->info.vmPlayModeFeaturesInt =
(uint64_t)engine::Engine::voiceManager_t::MonoPlayModeFeatures::NATURAL_LEGATO;

w->rebuildFromInfo();
w->sendToSerialization(messaging::client::UpdateGroupOutputInfoPolyphony{w->info});
});
p.addSeparator();
p.addSectionHeader("Mono Release Priority");
Expand Down
6 changes: 5 additions & 1 deletion src/engine/engine.h
Original file line number Diff line number Diff line change
Expand Up @@ -215,8 +215,12 @@ struct Engine : MoveableOnly<Engine>, SampleRateSupport
void terminateVoice(voice::Voice *v);
void retriggerVoiceWithNewNoteID(voice::Voice *v, int32_t noteid, float velocity)
{
SCLOG("Retrigger Voice Unimplemented")
SCLOG("Retrigger Voice Unimplemented");
assert(false);
}
void moveVoice(typename VMConfig::voice_t *, uint16_t, uint16_t, uint16_t, float);
void moveAndRetriggerVoice(typename VMConfig::voice_t *, uint16_t, uint16_t, uint16_t,
float);

void setVoiceMIDIMPEChannelPitchBend(voice::Voice *v, uint16_t pb14bit);
void setVoiceMIDIMPEChannelPressure(voice::Voice *v, int8_t val);
Expand Down
28 changes: 28 additions & 0 deletions src/engine/engine_voice_responder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,34 @@ void Engine::VoiceManagerResponder::setVoiceMIDIMPETimbre(voice::Voice *v, int8_
v->mpeTimbre = val / 127.0;
}

void Engine::VoiceManagerResponder::moveVoice(VMConfig::voice_t *v, uint16_t port, uint16_t channel,
uint16_t key, float vel)
{
auto dkey = v->key - v->originalMidiKey;
v->key = key;
v->originalMidiKey = key - dkey;
v->calculateVoicePitch();
}

void Engine::VoiceManagerResponder::moveAndRetriggerVoice(VMConfig::voice_t *v, uint16_t port,
uint16_t channel, uint16_t key, float vel)
{
auto dkey = v->key - v->originalMidiKey;
v->key = key;
v->originalMidiKey = key - dkey;
v->calculateVoicePitch();
v->isGated = true;
for (auto &eg : v->eg)
{
eg.attackFrom(eg.outBlock0);
}
for (auto &eg : v->egOS)
{
eg.attackFrom(eg.outBlock0);
}
SCLOG("TODO - Gate voice and Retrigger AEG and EG2");
}

void Engine::MonoVoiceManagerResponder::setMIDIPitchBend(int16_t channel, int16_t pb14bit)
{
auto fv = (pb14bit - 8192) / 8192.f;
Expand Down
Loading