]> git.cworth.org Git - scherzo/blobdiff - pitch.h
Fix key signature setting to accept an enharmonic pitch
[scherzo] / pitch.h
diff --git a/pitch.h b/pitch.h
index ffe9782c54b50cac05ba3470477f079afe31ddd6..d376a2217f3bb0cd225fc42ac92ad9a7c7e8870b 100644 (file)
--- a/pitch.h
+++ b/pitch.h
@@ -55,7 +55,7 @@ typedef uint32_t pitch_t;
     PITCH_LITERAL(literal_name, NATURAL, octave)
 
 /* PITCH_CLASS is useful for comparing pitches while ignoring any octave. */
-#define PITCH_CLASS(name, accidental) PITCH(name, accidental, 0)
+#define PITCH_CLASS(pitch) PITCH(PITCH_NAME(pitch), PITCH_ACCIDENTAL(pitch), 0)
 
 #define PITCH_CLASS_LITERAL(literal_name, literal_accidental) \
     PITCH_LITERAL(literal_name, literal_accidental, 0)
@@ -132,4 +132,12 @@ pitch_to_midi (pitch_t pitch);
 pitch_t
 pitch_from_midi (unsigned char midi_note);
 
+/* Return true if 'a' and 'b' sound identical, (even if spelled differently)
+ *
+ * This comparison considers octaves as significant. So Bb and A# in
+ * the same octave are considered enharmonic, but Bb and A# in
+ * different octaves are not. */
+int
+pitch_enharmonic_to (pitch_t a, pitch_t b);
+
 #endif /* PITCH_H */