Skip to content

Commit

Permalink
Make note octave highlight in piano roll obey microtonality (#6663)
Browse files Browse the repository at this point in the history
  • Loading branch information
LostRobotMusic committed Mar 26, 2023
1 parent 2baa23e commit fb529a1
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
2 changes: 2 additions & 0 deletions include/PianoRoll.h
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,8 @@ class PianoRoll : public QWidget
{
return m_midiClip != nullptr;
}

int trackOctaveSize() const;

Song::PlayModes desiredPlayModeForAccompany() const;

Expand Down
13 changes: 11 additions & 2 deletions src/gui/editors/PianoRoll.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -600,7 +600,7 @@ void PianoRoll::markSemiTone(int i, bool fromMenu)

const int first = chord->isScale() ? 0 : key;
const int last = chord->isScale() ? NumKeys : key + chord->last();
const int cap = ( chord->isScale() || chord->last() == 0 ) ? KeysPerOctave : chord->last();
const int cap = (chord->isScale() || chord->last() == 0) ? trackOctaveSize() : chord->last();

for( int i = first; i <= last; i++ )
{
Expand Down Expand Up @@ -937,6 +937,14 @@ void PianoRoll::hideMidiClip( MidiClip* clip )
}
}


int PianoRoll::trackOctaveSize() const
{
auto ut = m_midiClip->instrumentTrack()->microtuner();
return ut->enabled() ? ut->octaveSize() : KeysPerOctave;
}


void PianoRoll::selectRegionFromPixels( int xStart, int xEnd )
{

Expand Down Expand Up @@ -3950,7 +3958,8 @@ QList<int> PianoRoll::getAllOctavesForKey( int keyToMirror ) const
{
QList<int> keys;

for (int i=keyToMirror % KeysPerOctave; i < NumKeys; i += KeysPerOctave)
int trackKeysPerOctave = trackOctaveSize();
for (int i = keyToMirror % trackKeysPerOctave; i < NumKeys; i += trackKeysPerOctave)
{
keys.append(i);
}
Expand Down

0 comments on commit fb529a1

Please sign in to comment.