Skip to content

Commit

Permalink
- fix assertion in MPE modulator
Browse files Browse the repository at this point in the history
- fix false positive error when calling setActiveGroup outside onNoteOn callback
  • Loading branch information
christoph-hart committed Dec 17, 2023
1 parent 3c6ea63 commit e5874ea
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions hi_core/hi_modules/modulators/mods/MPEModulators.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ void MPEModulator::setInternalAttribute(int parameterIndex, float newValue)
switch (getMode())
{
case Modulation::GainMode: defaultValue = jlimit<float>(0.0f, 1.0f, newValue); break;
case Modulation::GlobalMode:defaultValue = jlimit<float>(0.0f, 1.0f, newValue); break;
case Modulation::PitchMode: defaultValue = jlimit<float>(0.0f, 1.0f, newValue / 24.0f + 0.5f); break;
case Modulation::PanMode: defaultValue = jlimit<float>(0.0f, 1.0f, newValue / 200.0f + 0.5f); break;
default: jassertfalse; break;
Expand Down
3 changes: 2 additions & 1 deletion hi_scripting/scripting/api/ScriptingApi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3867,9 +3867,10 @@ void ScriptingApi::Sampler::setActiveGroupForEventId(int eventId, int activeGrou
return;
}

if(s->getMainController()->getKillStateHandler().getCurrentThread() != MainController::KillStateHandler::TargetThread::AudioThread)
if(eventId != -1 && s->getMainController()->getKillStateHandler().getCurrentThread() != MainController::KillStateHandler::TargetThread::AudioThread)
{
reportScriptError("This method is only available in the onNoteOnCallback");
return;
}

bool ok = s->setCurrentGroupIndex(activeGroupIndex, eventId);
Expand Down

0 comments on commit e5874ea

Please sign in to comment.