Skip to content

Commit

Permalink
key pattern for different edos doesn't shift
Browse files Browse the repository at this point in the history
  • Loading branch information
yuxshao committed Oct 17, 2021
1 parent 004c0e1 commit 178c1f8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/editor/SettingsDialog.ui
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@
<item>
<widget class="QLabel" name="label_4">
<property name="toolTip">
<string extracomment="Pattern of white and black keys to fill the octave. Use Snap-Y in the sidemenu to select input edo"/>
<string extracomment="Pattern of white and black keys to fill the octave, starting on A. Use Snap-Y in the sidemenu to select input edo"/>
</property>
<property name="text">
<string>Background piano pattern (?)</string>
Expand Down
7 changes: 5 additions & 2 deletions src/editor/views/KeyboardView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -437,15 +437,18 @@ void KeyboardView::paintEvent(QPaintEvent *event) {
octaveDisplayPainter.translate(-event->rect().topLeft());
for (int row = 0; true; ++row) {
QColor *brush, *leftBrush;
// Start the backgrounds on an A just so that the key pattern lines up
int a_above_max_key =
(EVENTMAX_KEY / PITCH_PER_OCTAVE + 1) * PITCH_PER_OCTAVE;
int pitch = quantize_pitch(
EVENTMAX_KEY - row * PITCH_PER_OCTAVE / displayEdo, displayEdo);
a_above_max_key - row * PITCH_PER_OCTAVE / displayEdo, displayEdo);
int nextPitch =
quantize_pitch(pitch - PITCH_PER_OCTAVE / displayEdo, displayEdo);
if (pitch == EVENTDEFAULT_KEY) {
brush = &rootNoteBrush;
leftBrush = &whiteLeftBrush;
} else {
if (displayEdoList[nonnegative_modulo(3 - row, displayEdo)]) {
if (displayEdoList[nonnegative_modulo(-row, displayEdo)]) {
brush = &blackNoteBrush;
leftBrush = &blackLeftBrush;
} else {
Expand Down

0 comments on commit 178c1f8

Please sign in to comment.