From 230b13dd011d5e5db616bc8ffe0698eb21b1caf5 Mon Sep 17 00:00:00 2001 From: Vincenzo Sicurella Date: Sat, 20 Jan 2024 01:31:46 -0500 Subject: [PATCH] fix some data structure bugs --- .../data/lumatone_board.cpp | 3 +-- .../lumatone_editor_library/data/lumatone_key.cpp | 14 +++++++------- .../data/lumatone_layout.cpp | 4 ++++ 3 files changed, 12 insertions(+), 9 deletions(-) diff --git a/Source/lumatone_editor_library/data/lumatone_board.cpp b/Source/lumatone_editor_library/data/lumatone_board.cpp index 7269239..58eda4a 100644 --- a/Source/lumatone_editor_library/data/lumatone_board.cpp +++ b/Source/lumatone_editor_library/data/lumatone_board.cpp @@ -48,8 +48,7 @@ LumatoneBoard::LumatoneBoard(juce::ValueTree stateIn) void LumatoneBoard::operator=(const LumatoneBoard& copyBoard) { numKeys = copyBoard.numKeys; - state.copyPropertiesAndChildrenFrom(copyBoard.state, nullptr); - + for (int i = 0; i < numKeys; i++) { theKeys[i] = copyBoard.getKey(i); diff --git a/Source/lumatone_editor_library/data/lumatone_key.cpp b/Source/lumatone_editor_library/data/lumatone_key.cpp index f4b7f99..12ff4fc 100644 --- a/Source/lumatone_editor_library/data/lumatone_key.cpp +++ b/Source/lumatone_editor_library/data/lumatone_key.cpp @@ -119,13 +119,13 @@ juce::ValueTree LumatoneKey::getState() const void LumatoneKey::updateState() { - juce::ValueTree newState(LumatoneKeyProperty::State); - newState.setProperty(LumatoneKeyProperty::Type, keyType, nullptr); - newState.setProperty(LumatoneKeyProperty::Colour, colour.toString(), nullptr); - newState.setProperty(LumatoneKeyProperty::MidiNote, noteNumber, nullptr); - newState.setProperty(LumatoneKeyProperty::MidiChnl, channelNumber, nullptr); - newState.setProperty(LumatoneKeyProperty::DefaultCCFader, ccFaderDefault, nullptr); - state.copyPropertiesFrom(newState, nullptr); + // juce::ValueTree newState(LumatoneKeyProperty::State); + state.setProperty(LumatoneKeyProperty::Type, keyType, nullptr); + state.setProperty(LumatoneKeyProperty::Colour, colour.toString(), nullptr); + state.setProperty(LumatoneKeyProperty::MidiNote, noteNumber, nullptr); + state.setProperty(LumatoneKeyProperty::MidiChnl, channelNumber, nullptr); + state.setProperty(LumatoneKeyProperty::DefaultCCFader, ccFaderDefault, nullptr); + // state.copyPropertiesFrom(newState, nullptr); } void LumatoneKey::refreshFromState() diff --git a/Source/lumatone_editor_library/data/lumatone_layout.cpp b/Source/lumatone_editor_library/data/lumatone_layout.cpp index 9698a16..bc93a6d 100644 --- a/Source/lumatone_editor_library/data/lumatone_layout.cpp +++ b/Source/lumatone_editor_library/data/lumatone_layout.cpp @@ -213,6 +213,10 @@ LumatoneLayout::LumatoneLayout(int numBoardsIn, int octaveBoardSizeIn, bool init , octaveBoardSize(octaveBoardSizeIn) { state = juce::ValueTree(LumatoneConfigProperty::State); + + for (int i = 0; i < numBoards; i++) + boards[i].board_idx = i; + clearAll(initWithNotes); }