X-Git-Url: https://git.cworth.org/git?p=scherzo;a=blobdiff_plain;f=scherzo.c;h=7288d5fdbe7efb98b7b4c87879b6549cbbf8f23d;hp=0ef44ea1b362bba96e6b3edc63160cfdd6e97af0;hb=dd714c0284f6c61d2a802f2626463524b75a1933;hpb=8ad0ae52c3d5bdbbe8757ed530e9e51ba2e3afe0 diff --git a/scherzo.c b/scherzo.c index 0ef44ea..7288d5f 100644 --- a/scherzo.c +++ b/scherzo.c @@ -999,9 +999,13 @@ scherzo_press_note (scherzo_t *scherzo, pitch_t pitch) (NUM_RECENT_PITCHES - 1) * sizeof (pitch_t)); recent_pitches[NUM_RECENT_PITCHES - 1] = pitch; - if (pitches_are_diatonic_scale (recent_pitches, NUM_RECENT_PITCHES)) + if (pitches_are_diatonic_scale (recent_pitches, NUM_RECENT_PITCHES)) { scherzo_set_key (scherzo, recent_pitches[0]); + /* Respell pitch according to new key. */ + pitch = scherzo_key_spell_pitch (&scherzo->key, pitch); + } + /* Do nothing if this note is already pressed. */ for (i = 0; i < scherzo->notes_pressed.num_pitches; i++) if (scherzo->notes_pressed.pitches[i] == pitch)