]> git.cworth.org Git - scherzo/commitdiff
Fix in-key note spelling for MIDI input
authorCarl Worth <cworth@cworth.org>
Tue, 1 Oct 2013 18:18:29 +0000 (11:18 -0700)
committerCarl Worth <cworth@cworth.org>
Thu, 3 Oct 2013 17:50:55 +0000 (10:50 -0700)
I originally wrote and tested the key-guided note spelling code while
at the computer, and not near a MIDI keyboard. So I failed to notice
that I added this code to a code path that only affected computer
keyboard input.

Shift this over to affect all notes pressed.

scherzo.c

index 665795977fcf4e2d5c9d397fe3b1579cab9af3ba..dacefa8e8e8e186ec9fa6f20b9f79f05ab34e420 100644 (file)
--- a/scherzo.c
+++ b/scherzo.c
@@ -280,8 +280,6 @@ on_key_press_event (GtkWidget *widget,
 
     if (pitch != PITCH_NOT_A_PITCH) 
     {
-       pitch = scherzo_key_spell_pitch (&scherzo->key, pitch);
-
        scherzo_press_note (scherzo, pitch);
 
        return TRUE;
@@ -389,8 +387,6 @@ on_key_release_event (unused (GtkWidget *widget),
 
     if (pitch != PITCH_NOT_A_PITCH)
     {
-       pitch = scherzo_key_spell_pitch (&scherzo->key, pitch);
-
        scherzo_release_note (scherzo, pitch);
 
        return TRUE;
@@ -1007,6 +1003,8 @@ scherzo_press_note (scherzo_t *scherzo, pitch_t pitch)
 {
     int i;
 
+    pitch = scherzo_key_spell_pitch (&scherzo->key, pitch);
+
 #define NUM_RECENT_PITCHES 7
     static pitch_t recent_pitches[NUM_RECENT_PITCHES];
 
@@ -1033,6 +1031,8 @@ scherzo_press_note (scherzo_t *scherzo, pitch_t pitch)
 static void
 scherzo_release_note (scherzo_t *scherzo, pitch_t pitch)
 {
+    pitch = scherzo_key_spell_pitch (&scherzo->key, pitch);
+
     pitch_group_remove_pitch_enharmonic (&scherzo->notes_pressed, pitch);
 
     scherzo_update_notes_and_chord (scherzo);