From e34889241b574eb0de3c96b4a3b6ce60fd06e20b Mon Sep 17 00:00:00 2001 From: Alexandra Date: Thu, 11 Apr 2019 06:39:27 +0800 Subject: [PATCH 1/3] Added check for chord to notes recorded from keyboard --- src/gui/editors/PianoRoll.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/gui/editors/PianoRoll.cpp b/src/gui/editors/PianoRoll.cpp index fef788885db..7a1985583d0 100644 --- a/src/gui/editors/PianoRoll.cpp +++ b/src/gui/editors/PianoRoll.cpp @@ -3522,6 +3522,24 @@ void PianoRoll::finishRecordNote(const Note & n ) it->key(), it->getVolume(), it->getPanning() ); n1.quantizeLength( quantization() ); + + //ADDED CODE + const InstrumentFunctionNoteStacking::Chord & chord = InstrumentFunctionNoteStacking::ChordTable::getInstance() + .getChordByName( m_chordModel.currentText() ); + + if( ! chord.isEmpty() ) + { + // if a chord is selected, create following notes in chord mode + for( int i = 1; i < chord.size(); i++ ) + { + Note new_note( n.length(), it->pos(), it->key() + chord[i] ); + new_note.setPanning( it->getPanning() ); + new_note.setVolume( it->getVolume() ); + m_pattern->addNote( new_note ); + } + } + //END ADDED CODE + m_pattern->addNote( n1 ); update(); m_recordingNotes.erase( it ); From 76156ba1e5766cd8c45f8732a7bef37e4056d7b1 Mon Sep 17 00:00:00 2001 From: Alexandra Date: Thu, 11 Apr 2019 06:50:44 +0800 Subject: [PATCH 2/3] Remove addition comments and added line documenting change --- src/gui/editors/PianoRoll.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/gui/editors/PianoRoll.cpp b/src/gui/editors/PianoRoll.cpp index 7a1985583d0..a79012c1df8 100644 --- a/src/gui/editors/PianoRoll.cpp +++ b/src/gui/editors/PianoRoll.cpp @@ -3523,7 +3523,7 @@ void PianoRoll::finishRecordNote(const Note & n ) it->getPanning() ); n1.quantizeLength( quantization() ); - //ADDED CODE + //Get selected chordModel const InstrumentFunctionNoteStacking::Chord & chord = InstrumentFunctionNoteStacking::ChordTable::getInstance() .getChordByName( m_chordModel.currentText() ); @@ -3538,7 +3538,6 @@ void PianoRoll::finishRecordNote(const Note & n ) m_pattern->addNote( new_note ); } } - //END ADDED CODE m_pattern->addNote( n1 ); update(); From 952ff025df8776946e76dcf9ca03c44e66557e79 Mon Sep 17 00:00:00 2001 From: Alexandra Dutton Date: Fri, 12 Apr 2019 22:35:24 -0400 Subject: [PATCH 3/3] Fixed formatting --- src/gui/editors/PianoRoll.cpp | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/src/gui/editors/PianoRoll.cpp b/src/gui/editors/PianoRoll.cpp index a79012c1df8..7d9f95257a6 100644 --- a/src/gui/editors/PianoRoll.cpp +++ b/src/gui/editors/PianoRoll.cpp @@ -3523,21 +3523,20 @@ void PianoRoll::finishRecordNote(const Note & n ) it->getPanning() ); n1.quantizeLength( quantization() ); - //Get selected chordModel + //Get selected chord const InstrumentFunctionNoteStacking::Chord & chord = InstrumentFunctionNoteStacking::ChordTable::getInstance() - .getChordByName( m_chordModel.currentText() ); + .getChordByName( m_chordModel.currentText() ); - if( ! chord.isEmpty() ) + if( !chord.isEmpty() ) + { + for( int i = 1; i < chord.size(); i++ ) { - // if a chord is selected, create following notes in chord mode - for( int i = 1; i < chord.size(); i++ ) - { - Note new_note( n.length(), it->pos(), it->key() + chord[i] ); - new_note.setPanning( it->getPanning() ); - new_note.setVolume( it->getVolume() ); - m_pattern->addNote( new_note ); - } + Note new_note( n.length(), it->pos(), it->key() + chord[i] ); + new_note.setPanning( it->getPanning() ); + new_note.setVolume( it->getVolume() ); + m_pattern->addNote( new_note ); } + } m_pattern->addNote( n1 ); update();