Skip to content

Commit

Permalink
fix some data structure bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
vsicurella committed Jan 20, 2024
1 parent c9bab27 commit 230b13d
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 9 deletions.
3 changes: 1 addition & 2 deletions Source/lumatone_editor_library/data/lumatone_board.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
14 changes: 7 additions & 7 deletions Source/lumatone_editor_library/data/lumatone_key.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
4 changes: 4 additions & 0 deletions Source/lumatone_editor_library/data/lumatone_layout.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down

0 comments on commit 230b13d

Please sign in to comment.