X-Git-Url: https://git.cworth.org/git?p=scherzo;a=blobdiff_plain;f=score.h;h=d2de1091c5cecdce1bd6cc6d4bb4d5d513c9e3f1;hp=6eef279f9d14b38b0e4ad8a8749e8d4f570cfd52;hb=HEAD;hpb=08ba627b61792c7d6e31d71831f062f5a8162248 diff --git a/score.h b/score.h index 6eef279..d2de109 100644 --- a/score.h +++ b/score.h @@ -24,67 +24,7 @@ #include #include -#include "pitch.h" - -/* Some compatibility naming until the code changes to use pitch_t and - * firedns in place of score_pitch_t and friends. */ -typedef pitch_accidental_t score_pitch_accidental_t; -typedef pitch_name_t score_pitch_name_t; -typedef pitch_t score_pitch_t; - -#define SCORE_PITCH_ACCIDENTAL(pitch) PITCH_ACCIDENTAL(pitch) -#define SCORE_PITCH_NAME(pitch) PITCH_NAME(pitch) -#define SCORE_PITCH(pitch, octave) PITCH(pitch, octave) - -#define SCORE_PITCH_ACCIDENTAL_DOUBLE_FLAT PITCH_ACCIDENTAL_DOUBLE_FLAT -#define SCORE_PITCH_ACCIDENTAL_FLAT PITCH_ACCIDENTAL_FLAT -#define SCORE_PITCH_ACCIDENTAL_NATURAL PITCH_ACCIDENTAL_NATURAL -#define SCORE_PITCH_ACCIDENTAL_SHARP PITCH_ACCIDENTAL_SHARP -#define SCORE_PITCH_ACCIDENTAL_DOUBLE_SHARP PITCH_ACCIDENTAL_DOUBLE_SHARP - -#define SCORE_PITCH_NAME_C PITCH_NAME_C -#define SCORE_PITCH_NAME_D PITCH_NAME_D -#define SCORE_PITCH_NAME_E PITCH_NAME_E -#define SCORE_PITCH_NAME_F PITCH_NAME_F -#define SCORE_PITCH_NAME_G PITCH_NAME_G -#define SCORE_PITCH_NAME_A PITCH_NAME_A -#define SCORE_PITCH_NAME_B PITCH_NAME_B - -#define SCORE_PITCH_Cff PITCH_Cff -#define SCORE_PITCH_Cf PITCH_Cf -#define SCORE_PITCH_C PITCH_C -#define SCORE_PITCH_Cs PITCH_Cs -#define SCORE_PITCH_Css PITCH_Css -#define SCORE_PITCH_Dff PITCH_Dff -#define SCORE_PITCH_Df PITCH_Df -#define SCORE_PITCH_D PITCH_D -#define SCORE_PITCH_Ds PITCH_Ds -#define SCORE_PITCH_Dss PITCH_Dss -#define SCORE_PITCH_Eff PITCH_Eff -#define SCORE_PITCH_Ef PITCH_Ef -#define SCORE_PITCH_E PITCH_E -#define SCORE_PITCH_Es PITCH_Es -#define SCORE_PITCH_Ess PITCH_Ess -#define SCORE_PITCH_Fff PITCH_Fff -#define SCORE_PITCH_Ff PITCH_Ff -#define SCORE_PITCH_F PITCH_F -#define SCORE_PITCH_Fs PITCH_Fs -#define SCORE_PITCH_Fss PITCH_Fss -#define SCORE_PITCH_Gff PITCH_Gff -#define SCORE_PITCH_Gf PITCH_Gf -#define SCORE_PITCH_G PITCH_G -#define SCORE_PITCH_Gs PITCH_Gs -#define SCORE_PITCH_Gss PITCH_Gss -#define SCORE_PITCH_Aff PITCH_Aff -#define SCORE_PITCH_Af PITCH_Af -#define SCORE_PITCH_A PITCH_A -#define SCORE_PITCH_As PITCH_As -#define SCORE_PITCH_Ass PITCH_Ass -#define SCORE_PITCH_Bff PITCH_Bff -#define SCORE_PITCH_Bf PITCH_Bf -#define SCORE_PITCH_B PITCH_B -#define SCORE_PITCH_Bs PITCH_Bs -#define SCORE_PITCH_Bss PITCH_Bss +#include "scherzo-key.h" typedef enum score_duration { @@ -111,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; - score_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; @@ -158,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 @@ -169,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, - score_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. * @@ -195,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, - score_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. *