Skip to content

Commit

Permalink
add selection-based update methods to controller
Browse files Browse the repository at this point in the history
  • Loading branch information
vsicurella committed Aug 15, 2024
1 parent 13075a6 commit d741074
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 9 deletions.
10 changes: 2 additions & 8 deletions Source/lumatone_editor_library/data/application_state.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -346,10 +346,7 @@ void LumatoneApplicationState::sendSelectionParam(const juce::Array<MappedLumato
{
LumatoneState::sendSelectionParam(selection);

for (auto mappedKey : selection)
{
controller->sendKeyParam(mappedKey.boardIndex + 1, mappedKey.keyIndex, static_cast<const LumatoneKey&>(mappedKey));
}
controller->sendSelectionParam(selection, false, bufferKeyUpdates);

//if (signalEditorListeners)
editorListeners->call(&LumatoneEditor::EditorListener::keySetChanged, selection);
Expand All @@ -359,10 +356,7 @@ void LumatoneApplicationState::sendSelectionColours(const juce::Array<MappedLuma
{
LumatoneState::sendSelectionColours(selection);

for (auto mappedKey : selection)
{
controller->sendKeyColourConfig(mappedKey.boardIndex + 1, mappedKey.keyIndex, static_cast<const LumatoneKey&>(mappedKey));
}
controller->sendSelectionColours(selection, false, bufferKeyUpdates);

//if (signalEditorListeners)
editorListeners->call(&LumatoneEditor::EditorListener::keySetChanged, selection);
Expand Down
16 changes: 16 additions & 0 deletions Source/lumatone_editor_library/device/lumatone_controller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,22 @@ void LumatoneController::sendCurrentCompleteConfig(bool signalEditorListeners)
setVelocityIntervalConfig(getMappingData()->getConfigTable(LumatoneConfigTable::velocityInterval)->velocityValues);
}

void LumatoneController::sendSelectionParam(const juce::Array<MappedLumatoneKey> &keyParamSet, bool signalEditorListeners, bool bufferKeyUpdates)
{
for (const MappedLumatoneKey& mappedKey : keyParamSet)
{
sendKeyParam(mappedKey.boardIndex + 1, mappedKey.keyIndex, static_cast<const LumatoneKey&>(mappedKey), false, bufferKeyUpdates);
}
}

void LumatoneController::sendSelectionColours(const juce::Array<MappedLumatoneKey> &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);
Expand Down
5 changes: 4 additions & 1 deletion Source/lumatone_editor_library/device/lumatone_controller.h
Original file line number Diff line number Diff line change
Expand Up @@ -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<MappedLumatoneKey>& keyParamSet, bool signalEditorListeners=true, bool bufferKeyUpdates=false) override;
void sendSelectionColours(const juce::Array<MappedLumatoneKey>& 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);

Expand Down

0 comments on commit d741074

Please sign in to comment.