1 /** 2 * denemo_objects.h 3 * 4 * Description: Contains definitions for denemo data structures 5 * 6 * 7 * Author: Adam Tee <adam@ajtee.plus.com>, (C) 2005 8 * 9 * Copyright: See COPYING file that comes with this distribution 10 * 11 */ 12 13 #include <gtk/gtk.h> 14 15 #ifndef DENEMOOBJECTS_H 16 #define DENEMOOBJECTS_H 17 18 19 20 /** 21 * enum containing notehead 22 * definitions 23 */ 24 typedef enum headtype 25 { 26 DENEMO_NORMAL_NOTEHEAD, /*!< Enum value DENEMO_NORMAL_NOTEHEAD */ 27 DENEMO_CROSS_NOTEHEAD, 28 DENEMO_HARMONIC_NOTEHEAD, 29 DENEMO_DIAMOND_NOTEHEAD 30 }headtype; 31 32 /** 33 * structure encapsulating a 34 * grace note 35 */ 36 typedef struct grace 37 { 38 gboolean on_beat; 39 gint duration; 40 }grace; 41 42 43 /** 44 * structure encapsulating a 45 * musical note 46 */ 47 typedef struct note 48 { 49 gint mid_c_offset;/**< This is used to define (the pitch of) a note. 50 A positive number is the number of half 51 steps above middle c. A negative number is below middle c.*/ 52 gint enshift;/**< Enharmonic shift. Should the note be notated as sharp (1) double-sharp (2) or flat (-1) double-flat (-2) or natural (0). No other values are legal. */ 53 gboolean reversealign; 54 gboolean showaccidental;/**< This tells denemo to show all possible accidentals?? cautionary accidental?? */ 55 gint position_of_accidental; /**< Holds number of pixels to the left of the notehead that the 56 accidental should be drawn at. */ 57 gint y; /**< Holds y co-ordinate for drawing rather than recalculating it each 58 run through the drawing loop. see calculateheight. The coordinate is based on the top line of the staff = 0, above the staff is negative 59 * below is positive. The staff space is 10 */ 60 enum headtype noteheadtype; /**< Holds note head type. */ 61 GList *directives;/**< list of DenemoDirective to apply to the note */ 62 } 63 note; 64 65 /** 66 * Enum defining ornament types 67 * 68 */ 69 typedef enum ornament { 70 STACCATO=1, 71 D_ACCENT, 72 CODA, 73 FERMATA, 74 TENUTO, 75 TRILL, 76 TURN, 77 REVERSETURN, 78 MORDENT, 79 STACCATISSIMO, 80 MARCATO, 81 UBOW, 82 DBOW, 83 RHEEL, 84 LHEEL, 85 RTOE, 86 LTOE, 87 FLAGEOLET, 88 OPEN, 89 PRALLMORDENT, 90 PRALL, 91 PRALLPRALL, 92 SEGNO, 93 SFORZATO,/*unused is a dynamic */ 94 STOPPED, 95 THUMB, 96 TRILL_ELEMENT, 97 TRILLELEMENT, 98 UPPRALL, 99 D_ARPEGGIO 100 }Ornament; 101 102 103 104 105 /** 106 * Structure describing a chord 107 * 1;7B 108 * 109 */ 110 typedef struct chord 111 { 112 GList *notes; /**< NULL if the chord is a rest 113 else Glist of the notes of the chord 114 (in order of mid_c_offset value) 115 notes->data fields are of type note* 116 */ 117 GList *dynamics; /**< test for new dynamic handling */ 118 gboolean has_dynamic; 119 gint highestpitch; 120 gint lowestpitch; 121 gint highesty; 122 gint lowesty; 123 gint baseduration; /**< Value to denote the basic chord length, 0 = whole note, 1 = 1/2 note etc. A negative value specifies the basic chord length in terms of ticks, used for longer durations. */ 124 gint numdots; /**< Number of dots that are applied to the note */ 125 gint sum_mid_c_offset; 126 gint numnotes; 127 gboolean chordize;/**< TRUE if this chord is to be treated as a multi-note chord even if it only has one note */ 128 129 gboolean is_tied; 130 gboolean is_stemup; 131 gboolean is_reversealigned; 132 gboolean slur_begin_p; /**< Is this note a beginning of a slur? */ 133 gboolean slur_end_p; /**< Is this note an end of a slur? */ 134 gboolean crescendo_begin_p; 135 gboolean crescendo_end_p; 136 gboolean diminuendo_begin_p; 137 gboolean diminuendo_end_p; 138 gboolean hasanacc; 139 gboolean is_grace; /**< Flag to show whether note is a grace note */ 140 gboolean struck_through; /**< Flag for a struck through stem*/ 141 gint stemy; /**< Stores the y position of the end of the stem */ 142 GString *lyric; /**< Pointer to the lyrics applied to that chord */ 143 gboolean is_syllable; /**< Is the lyric a syllable? */ 144 gboolean center_lyric; /**< Should the lyrics be centered or 145 should it be directly under the note? 146 that it is attatched to? */ 147 148 gboolean is_figure; /**< the reason for using this boolean is to exploit 149 the fact that all the spacing and printing of 150 figures can use the code for the CHORD type */ 151 gpointer figure; /**< when this chord is a bass note 152 (figure !=NULL && is_figure==FALSE) this 153 pointer points to an objnode in a FiguredBassStaff. 154 That objnode's data is a DenemoObject of type CHORD. 155 It is linked into the corresponding FiguredBassStaff if 156 one exists. 157 When this chord is_figure then figure is a 158 GString* containing the 159 figures in lilypond format. */ 160 GList *tone_node; /**< which tone this note was extracted from */ 161 gboolean is_fakechord; /**< This is the actual value of the fake chord if is_fakechord */ 162 gpointer fakechord; /**< This is the actual fake chord string if is_fakechord */ 163 164 GList *directives;/**< list of DenemoDirective to apply to the chord */ 165 166 } 167 chord; 168 169 /** 170 * Structure defining an indicator that a tuplet is starting 171 */ 172 typedef struct tupopen 173 { 174 gint numerator; 175 gint denominator; 176 GList *directives;/**< list of DenemoDirective to apply to the tuplet */ 177 } 178 tupopen; 179 180 typedef tupopen tuplet; //used for tupclose or tupopen 181 182 /** 183 * Enum defining clef values 184 * 185 */ 186 typedef enum clefs 187 { 188 DENEMO_TREBLE_CLEF=0, 189 DENEMO_BASS_CLEF, 190 DENEMO_ALTO_CLEF, 191 DENEMO_G_8_CLEF, 192 DENEMO_TENOR_CLEF, 193 DENEMO_SOPRANO_CLEF, 194 DENEMO_F_8_CLEF, 195 DENEMO_FRENCH_CLEF, 196 DENEMO_INVALID_CLEF 197 }clefs; 198 199 /** 200 * Indicator for a clef change 201 */ 202 typedef struct clef 203 { 204 enum clefs type; 205 GList *directives; 206 } 207 clef; 208 209 /** 210 * Indicator for a time-signature change. Only appears at the 211 * beginning of a measure 212 */ 213 typedef struct timesig 214 { 215 gint time1; /**< This is the numerator for a time signature */ 216 gint time2; /**< This is the denominator for a time signature */ 217 GList *directives; 218 } 219 timesig; 220 221 /** 222 * Indicator for a key-signature change. 223 */ 224 typedef struct keysig 225 { 226 gint number; /**< key number -7 to 7 for major/minor 0 to 40 for mode */ 227 gint isminor; /**< Type of key 0-major 1-minor 2-mode */ 228 gint mode; /**< Mode indicator */ 229 gint accs[7]; 230 GList *directives; 231 } 232 keysig; 233 234 /* Dynamic */ 235 236 typedef struct dynamic 237 { 238 GString *type; 239 } 240 dynamic; 241 242 /** 243 * Enum defining barline types 244 * 245 */ 246 typedef enum barline_type { 247 ORDINARY_BARLINE, 248 DOUBLE_BARLINE, /**< Double Bar */ 249 END_BARLINE, 250 OPENREPEAT_BARLINE, 251 CLOSE_REPEAT, 252 OPEN_CLOSE_REPEAT 253 } barline_type; 254 255 /** 256 * Structure encapsulating a barline 257 * 258 */ 259 typedef struct barline 260 { 261 barline_type type; 262 } 263 barline; 264 265 266 267 /** 268 * Lyric datastructure 269 */ 270 typedef struct lyric 271 { 272 GString *lyrics; /**< This is the text string containing the lyrics */ 273 gint position; 274 gboolean is_syllable; /**< Is the lyric a syllable? */ 275 gboolean center_lyric; /**< Should the lyrics be centered? */ 276 }lyric; 277 278 279 /* A standalone DenemoDirective. lilydirective is an obsolete name */ 280 281 #define lilydirective DenemoDirective 282 #if 0 283 typedef struct lilydirective DenemoDirective; 284 285 { 286 GString *directive;/**< the LilyPond text */ 287 gboolean locked;/**< If true the directive cannot be deleted easily */ 288 GString *display;/**< Something for Denemo to display (to indicate what the directive is doing*/ 289 gint x;/**< horizontal offset of display text */ 290 gint y;/**< vertical offset of display text */ 291 GdkBitmap *graphic; /**< bitmap to draw for this directive */ 292 gint width, height; /**< width and height of the bitmap */ 293 } 294 lilydirective; 295 #endif 296 297 /** 298 * Enum defining stem direction values 299 * 300 */ 301 typedef enum stemdirections 302 { 303 DENEMO_STEMDOWN=1, 304 DENEMO_STEMBOTH, 305 DENEMO_STEMUP 306 }stemdirections; 307 308 /** 309 * Indicator that the following music should be all stemup, all 310 * stemdown, or stemmed normally 311 */ 312 typedef struct stemdirective 313 { 314 enum stemdirections type; 315 GList *directives;/**< list of DenemoDirective to apply to the stemdirective */ 316 } 317 stemdirective; 318 319 320 /** 321 * a note and duration (e.g. obtained by pitch recognition) 322 * plus field to indicate if the tone is spurious 323 */ 324 typedef struct tone 325 { 326 gint duration; 327 gint step; 328 gint octave; 329 gint enshift; 330 gboolean valid; 331 } 332 tone; 333 334 #define NOTE0 "\xF0\x9D\x85\x9D" 335 #define NOTE1 "\xF0\x9D\x85\x9E" 336 #define NOTE2 "\xF0\x9D\x85\x9F" 337 #define NOTE3 "\xF0\x9D\x85\xA0" 338 #define NOTE4 "\xF0\x9D\x85\xA1" 339 #define NOTE5 "\xF0\x9D\x85\xA2" 340 #define NOTE6 "\xF0\x9D\x85\xA3" 341 #define NOTE7 "\xF0\x9D\x85\xA4" 342 #define NOTE8 "\xF0\x9D\x85\xA5" 343 344 #define REST0 "\xF0\x9D\x84\xBB" 345 #define REST1 "\xF0\x9D\x84\xBC" 346 #define REST2 "\xF0\x9D\x84\xBD" 347 #define REST3 "\xF0\x9D\x84\xBE" 348 #define REST4 "\xF0\x9D\x84\xBF" 349 #define REST5 "\xF0\x9D\x85\x80" 350 #define REST6 "\xF0\x9D\x85\x81" 351 #define REST7 "\xF0\x9D\x85\x82" 352 #define REST8 "\xF0\x9D\x85\x83" 353 354 #endif 355