From d7410743ae0d13edaef714b308e84c88b341a6fd Mon Sep 17 00:00:00 2001 From: Vincenzo Sicurella Date: Thu, 15 Aug 2024 01:04:08 -0400 Subject: [PATCH] add selection-based update methods to controller --- .../data/application_state.cpp | 10 ++-------- .../device/lumatone_controller.cpp | 16 ++++++++++++++++ .../device/lumatone_controller.h | 5 ++++- 3 files changed, 22 insertions(+), 9 deletions(-) diff --git a/Source/lumatone_editor_library/data/application_state.cpp b/Source/lumatone_editor_library/data/application_state.cpp index 7934e29..a8c0396 100644 --- a/Source/lumatone_editor_library/data/application_state.cpp +++ b/Source/lumatone_editor_library/data/application_state.cpp @@ -346,10 +346,7 @@ void LumatoneApplicationState::sendSelectionParam(const juce::ArraysendKeyParam(mappedKey.boardIndex + 1, mappedKey.keyIndex, static_cast(mappedKey)); - } + controller->sendSelectionParam(selection, false, bufferKeyUpdates); //if (signalEditorListeners) editorListeners->call(&LumatoneEditor::EditorListener::keySetChanged, selection); @@ -359,10 +356,7 @@ void LumatoneApplicationState::sendSelectionColours(const juce::ArraysendKeyColourConfig(mappedKey.boardIndex + 1, mappedKey.keyIndex, static_cast(mappedKey)); - } + controller->sendSelectionColours(selection, false, bufferKeyUpdates); //if (signalEditorListeners) editorListeners->call(&LumatoneEditor::EditorListener::keySetChanged, selection); diff --git a/Source/lumatone_editor_library/device/lumatone_controller.cpp b/Source/lumatone_editor_library/device/lumatone_controller.cpp index cfc2dc4..43b1810 100644 --- a/Source/lumatone_editor_library/device/lumatone_controller.cpp +++ b/Source/lumatone_editor_library/device/lumatone_controller.cpp @@ -73,6 +73,22 @@ void LumatoneController::sendCurrentCompleteConfig(bool signalEditorListeners) setVelocityIntervalConfig(getMappingData()->getConfigTable(LumatoneConfigTable::velocityInterval)->velocityValues); } +void LumatoneController::sendSelectionParam(const juce::Array &keyParamSet, bool signalEditorListeners, bool bufferKeyUpdates) +{ + for (const MappedLumatoneKey& mappedKey : keyParamSet) + { + sendKeyParam(mappedKey.boardIndex + 1, mappedKey.keyIndex, static_cast(mappedKey), false, bufferKeyUpdates); + } +} + +void LumatoneController::sendSelectionColours(const juce::Array &keyColourSet, bool signalEditorListeners, bool bufferKeyUpdates) +{ + for (const MappedLumatoneKey& mappedKey : keyColourSet) + { + sendKeyColourConfig(mappedKey.boardIndex + 1, mappedKey.keyIndex, mappedKey.getColour(), false, bufferKeyUpdates); + } +} + void LumatoneController::sendGetMappingOfBoardRequest(int boardId) { getChannelConfig(boardId); diff --git a/Source/lumatone_editor_library/device/lumatone_controller.h b/Source/lumatone_editor_library/device/lumatone_controller.h index d309b07..91d26f3 100644 --- a/Source/lumatone_editor_library/device/lumatone_controller.h +++ b/Source/lumatone_editor_library/device/lumatone_controller.h @@ -41,10 +41,13 @@ class LumatoneController : private LumatoneState void sendAllParamsOfBoard(int boardId, const LumatoneBoard* boardData, bool signalEditorListeners=true, bool bufferKeyUpdates=false); // Send and save a complete key mapping - void sendCompleteMapping(const LumatoneLayout& mappingData, bool signalEditorListeners=true, bool bufferKeyUpdates=true); + void sendCompleteMapping(const LumatoneLayout& mappingData, bool signalEditorListeners=true, bool bufferKeyUpdates=false); void sendCurrentCompleteConfig(bool signalEditorListeners=true); + void sendSelectionParam(const juce::Array& keyParamSet, bool signalEditorListeners=true, bool bufferKeyUpdates=false) override; + void sendSelectionColours(const juce::Array& keyColourSet, bool signalEditorListeners=true, bool bufferKeyUpdates=false) override; + // Send request to receive the current mapping of one sub board on the controller void sendGetMappingOfBoardRequest(int boardId);