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

Send notification when MIDI ccs cleared #398

Merged
merged 1 commit into from Jul 17, 2023
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -439,7 +439,7 @@ void CustomSettingsWindow::buttonClicked(Button* b)
{
ScopedLock sl(mc->getLock());

mc->getMacroManager().getMidiControlAutomationHandler()->clear();
mc->getMacroManager().getMidiControlAutomationHandler()->clear(sendNotification);
}
else if (b == debugButton)
{
Expand Down
9 changes: 6 additions & 3 deletions hi_core/hi_core/MainControllerHelpers.cpp
Expand Up @@ -42,7 +42,7 @@ ccName("MIDI CC")
{
tempBuffer.ensureSize(2048);

clear();
clear(sendNotification);
}

void MidiControllerAutomationHandler::addMidiControlledParameter(Processor *interfaceProcessor, int attributeIndex, NormalisableRange<double> parameterRange, int macroIndex)
Expand Down Expand Up @@ -137,7 +137,7 @@ void MidiControllerAutomationHandler::refreshAnyUsedState()
}
}

void MidiControllerAutomationHandler::clear()
void MidiControllerAutomationHandler::clear(NotificationType notifyListeners)
{
for (int i = 0; i < 128; i++)
{
Expand All @@ -147,6 +147,9 @@ void MidiControllerAutomationHandler::clear()
unlearnedData = AutomationData();

anyUsed = false;

if (notifyListeners == sendNotification)
sendChangeMessage();
}

void MidiControllerAutomationHandler::removeMidiControlledParameter(Processor *interfaceProcessor, int attributeIndex, NotificationType notifyListeners)
Expand Down Expand Up @@ -680,7 +683,7 @@ void MidiControllerAutomationHandler::restoreFromValueTree(const ValueTree &v)
{
if (v.getType() != Identifier("MidiAutomation")) return;

clear();
clear(sendNotification);

for (int i = 0; i < v.getNumChildren(); i++)
{
Expand Down
2 changes: 1 addition & 1 deletion hi_core/hi_core/MainControllerHelpers.h
Expand Up @@ -117,7 +117,7 @@ class MidiControllerAutomationHandler : public RestorableObject,
int getMidiControllerNumber(Processor *interfaceProcessor, int attributeIndex) const;

void refreshAnyUsedState();
void clear();
void clear(NotificationType notifyListeners);

/** The main routine. Call this for every MidiBuffer you want to process and it handles both setting parameters as well as MIDI learning. */
void handleParameterData(MidiBuffer &b);
Expand Down
2 changes: 1 addition & 1 deletion hi_scripting/scripting/api/ScriptingApi.cpp
Expand Up @@ -2770,7 +2770,7 @@ void ScriptingApi::Settings::setVoiceMultiplier(int newVoiceAmount)

void ScriptingApi::Settings::clearMidiLearn()
{
mc->getMacroManager().getMidiControlAutomationHandler()->clear();
mc->getMacroManager().getMidiControlAutomationHandler()->clear(sendNotification);
}

var ScriptingApi::Settings::getMidiInputDevices()
Expand Down