]> git.cworth.org Git - scherzo/blobdiff - score.h
Fix high octave numbers (8+) to not be interpreted as 0.
[scherzo] / score.h
diff --git a/score.h b/score.h
index 5dd61887d340da2bbb5ca5420af8dc23bd968bc4..d2de1091c5cecdce1bd6cc6d4bb4d5d513c9e3f1 100644 (file)
--- a/score.h
+++ b/score.h
@@ -24,7 +24,7 @@
 #include <talloc.h>
 #include <cairo.h>
 
-#include "pitch.h"
+#include "scherzo-key.h"
 
 typedef enum score_duration
 {
@@ -51,20 +51,6 @@ typedef enum score_duration
 typedef struct score score_t;
 typedef struct score_staff score_staff_t;
 
-typedef struct score_note
-{
-    score_staff_t *staff;
-    pitch_t pitch;
-    int octave;
-    score_duration_t duration;
-
-    struct {
-       double r;
-       double g;
-       double b;
-    } color;
-} score_note_t;
-
 typedef struct score_chord
 {
     score_staff_t *staff;
@@ -98,6 +84,10 @@ score_set_staff_height (score_t *score, int height);
 void
 score_set_width (score_t *score, int width);
 
+/* Set the key for this score */
+void
+score_set_key (score_t *score, pitch_t key);
+
 /* Add a brace to the score, connecting the given number of staves.
  *
  * The staves to be connected are those that will next be added to the
@@ -109,20 +99,21 @@ score_add_brace (score_t *score, int staves);
 score_staff_t *
 score_add_staff (score_t *score, score_clef_t clef);
 
-/* Add a note to a staff of the given pitch, octave, and duration.
- *
- * Octave numbers are ISO octave numbers [0:8], (so Octave 4 is from
- * middle C to the B above middle C).
+/* Add a note to a staff of the given pitch and duration.
  *
  * Duration values can be symbolic (SCORE_DURATION_WHOLE, _QUARTER,
  * _EIGHTH, etc.) or numerical as simply the denominator (WHOLE=1,
  * QUARTER=4, EIGHTH=8, etc.)
  */
-score_note_t *
-score_add_note (score_staff_t *staff,
-               pitch_t pitch,
-               int octave,
-               score_duration_t);
+void
+score_staff_add_note (score_staff_t *staff,
+                     pitch_t pitch,
+                     score_duration_t duration);
+
+/* Add a note to the score, (automatically selecting the nearest
+ * staff) */
+void
+score_add_note (score_t *score, pitch_t pitch, score_duration_t duration);
 
 /* Add a chord symbol of 'name' to a staff.
  *
@@ -135,27 +126,21 @@ score_chord_t *
 score_add_chord (score_staff_t *staff,
                 const char * name);
 
-/* Remove the given chord from its staff. */
+/* Remove all chords from the given staff. */
+void
+score_staff_remove_chords (score_staff_t *staff);
+
+/* Remove all chords from the score. */
 void
-score_remove_chord (score_chord_t *chord);
+score_remove_chords (score_t *score);
 
-/* Remove the given note from its staff. */
+/* Remove all notes from the given staff. */
 void
-score_remove_note (score_note_t *note);
+score_staff_remove_notes (score_staff_t *staff);
 
+/* Remove all notes from the score. */
 void
-score_set_note_color_rgb (score_note_t *note,
-                         double r,
-                         double g,
-                         double b);
-
-/* Return the first note on the given staff with the given pitch,
- * octave, and durations. Returns NULL if no match is found. */
-score_note_t *
-score_staff_find_note (score_staff_t *staff,
-                      pitch_t pitch,
-                      int octave,
-                      score_duration_t duration);
+score_remove_notes (score_t *score);
 
 /* Draw the given score_t onto the given cairo_t.
  *