Make note octave highlight in piano roll obey microtonality (#6663)

This commit is contained in:
Lost Robot
2023-03-26 12:30:12 -07:00
committed by GitHub
parent 2baa23ee1a
commit fb529a19c5
2 changed files with 13 additions and 2 deletions

View File

@@ -149,6 +149,8 @@ public:
{
return m_midiClip != nullptr;
}
int trackOctaveSize() const;
Song::PlayModes desiredPlayModeForAccompany() const;

View File

@@ -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++ )
{
@@ -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 )
{
@@ -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);
}