X-Git-Url: https://git.cworth.org/git?a=blobdiff_plain;f=score.h;h=ea363538b95d47a5c75bf4dc78882f017a9797df;hb=f60f0cb3dd6fb75ee17e237e87ef0c9088e5bec4;hp=531710348a6a2caad7b1222e622fc8b8d8146cb6;hpb=3f6a9cdbf572c83c323f40cc66e301bdf128f076;p=scherzo diff --git a/score.h b/score.h index 5317103..ea36353 100644 --- a/score.h +++ b/score.h @@ -46,18 +46,18 @@ typedef enum score_pitch_accidental typedef enum score_pitch_name { - SCORE_PITCH_NAME_C = 0 << SCORE_PITCH_NAME_SHIFT, - SCORE_PITCH_NAME_D = 1 << SCORE_PITCH_NAME_SHIFT, - SCORE_PITCH_NAME_E = 2 << SCORE_PITCH_NAME_SHIFT, - SCORE_PITCH_NAME_F = 3 << SCORE_PITCH_NAME_SHIFT, - SCORE_PITCH_NAME_G = 4 << SCORE_PITCH_NAME_SHIFT, - SCORE_PITCH_NAME_A = 5 << SCORE_PITCH_NAME_SHIFT, - SCORE_PITCH_NAME_B = 6 << SCORE_PITCH_NAME_SHIFT + SCORE_PITCH_NAME_C, + SCORE_PITCH_NAME_D, + SCORE_PITCH_NAME_E, + SCORE_PITCH_NAME_F, + SCORE_PITCH_NAME_G, + SCORE_PITCH_NAME_A, + SCORE_PITCH_NAME_B, } score_pitch_name_t; #define SCORE_PITCH_NAME(pitch) (((pitch) & SCORE_PITCH_NAME_MASK) >> SCORE_PITCH_NAME_SHIFT) -#define SCORE_PITCH_VALUE(name, accidental) ((SCORE_PITCH_NAME_##name) + (SCORE_PITCH_ACCIDENTAL_##accidental)) +#define SCORE_PITCH_VALUE(name, accidental) ((SCORE_PITCH_NAME_##name << SCORE_PITCH_NAME_SHIFT) + (SCORE_PITCH_ACCIDENTAL_##accidental)) typedef enum score_pitch { @@ -132,8 +132,22 @@ typedef struct score_note 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; + + char *name; + double width; +} score_chord_t; + typedef enum score_clef { SCORE_CLEF_G, @@ -185,10 +199,28 @@ score_add_note (score_staff_t *staff, int octave, score_duration_t); -/* Remove the given note from the given staff. */ +/* Add a chord symbol of 'name' to a staff. + * + * For now, the chord symbols are free-form names. + */ +score_chord_t * +score_add_chord (score_staff_t *staff, + const char * name); + +/* Remove the given chord from its staff. */ +void +score_remove_chord (score_chord_t *chord); + +/* Remove the given note from its staff. */ void score_remove_note (score_note_t *note); +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 *