summaryrefslogtreecommitdiff
path: root/include/denemo/denemo_objects.h
blob: ce39932e2801eb4230414b2d4a0c5908dc65a846 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
/**
 * denemo_objects.h
 *
 * Description: Contains definitions for denemo data structures
 *
 *
 * Author: Adam Tee <adam@ajtee.plus.com>, (C) 2005
 *
 * Copyright: See COPYING file that comes with this distribution
 *
 */
 
#include <gtk/gtk.h>

#ifndef DENEMOOBJECTS_H
#define DENEMOOBJECTS_H



/**
 * enum containing notehead 
 * definitions
 */
typedef enum headtype
{ 
  DENEMO_NORMAL_NOTEHEAD, /*!< Enum value DENEMO_NORMAL_NOTEHEAD */ 
  DENEMO_CROSS_NOTEHEAD,
  DENEMO_HARMONIC_NOTEHEAD,
  DENEMO_DIAMOND_NOTEHEAD
}headtype;

/**
 * structure encapsulating a 
 * grace note
 */
typedef struct grace
{
  gboolean on_beat;
  gint duration;
}grace;
  
  
/**
 * structure encapsulating a 
 * musical note
 */
typedef struct note
{
  gint mid_c_offset;/**< This is used to define (the pitch of) a note. 
		       A positive number is the number of half 
		       steps above middle c. A negative number is below middle c.*/
  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. */
  gboolean reversealign;
  gboolean showaccidental;/**< This tells denemo to show all possible accidentals?? cautionary accidental?? */
  gint position_of_accidental; /**< Holds number of pixels to the left of the notehead that the
  				   accidental should be drawn at.  */
  gint y; /**< Holds y co-ordinate for drawing rather than recalculating it each
  		   run through the drawing loop. see calculateheight  */
  enum headtype noteheadtype; /**< Holds note head type.  */
  GList *directives;/**< list of DenemoDirective to apply to the note */
}
note;

/**
 * Enum defining ornament types
 * 
 */
typedef enum ornament {
  STACCATO=1,
  D_ACCENT,
  CODA,
  FERMATA,
  TENUTO,
  TRILL,
  TURN,
  REVERSETURN,
  MORDENT,
  STACCATISSIMO,
  MARCATO,
  UBOW,
  DBOW,
  RHEEL,
  LHEEL,
  RTOE,
  LTOE,
  FLAGEOLET,
  OPEN,
  PRALLMORDENT,
  PRALL,
  PRALLPRALL,
  SEGNO,
  SFORZATO,/*unused is a dynamic */
  STOPPED,
  THUMB,
  TRILL_ELEMENT,
  TRILLELEMENT,
  UPPRALL,
  D_ARPEGGIO
}Ornament;
 



/**
 * Structure describing a chord
 * 1;7B
 * 
 */
typedef struct chord
{
  GList *notes;	/**< NULL if the chord is a rest 
		   else Glist of the notes of the chord 
		   (in order of mid_c_offset value) 
		   notes->data fields are of type note*
		*/
  GList *dynamics;  /**< test for new dynamic handling */
  gboolean has_dynamic;
  gint highestpitch;
  gint lowestpitch;
  gint highesty;
  gint lowesty;
  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. */
  gint numdots; /**< Number of dots that are applied to the note */
  gint sum_mid_c_offset;
  gint numnotes;
  gboolean chordize;/**< TRUE if this chord is to be treated as a multi-note chord even if it only has one note */

  gboolean is_tied;
  gboolean is_stemup;
  gboolean is_reversealigned;
  gboolean slur_begin_p; /**< Is this note a beginning of a slur? */
  gboolean slur_end_p; /**< Is this note an end of a slur? */
  gboolean crescendo_begin_p;
  gboolean crescendo_end_p;
  gboolean diminuendo_begin_p;
  gboolean diminuendo_end_p;
  gboolean hasanacc;
  gboolean is_grace;  /**< Flag to show whether note is a grace note */
  gboolean struck_through; /**< Flag for a struck through stem*/
  gint stemy;		/**< Stores the y position of the end of the stem */
  GList *ornamentlist;
  gboolean is_highlighted; /**< If set true changes the notes color */
  GString *lyric; /**< Pointer to the lyrics applied to that chord */
  gboolean is_syllable; /**< Is the lyric a syllable? */
  gboolean center_lyric; /**< Should the lyrics be centered or 
			    should it be directly under the note?
			    that it is attatched to? */

  gboolean is_figure; /**< the reason for using this boolean is to exploit 
			 the fact that all the spacing and printing of 
			 figures can use the code for the CHORD type */
  gpointer figure; /**< when this chord is a bass note 
		      (figure !=NULL && is_figure==FALSE) this
		      pointer points to an objnode in a FiguredBassStaff.
		      That objnode's data is a DenemoObject of type CHORD.
		      It is linked into the corresponding FiguredBassStaff if
		      one exists.
		      When this chord is_figure then figure is a 
		      GString* containing the
		      figures in lilypond format. */
  GList *tone_node; /**< which tone this note was extracted from */
  gboolean is_fakechord; /**< This is the actual value of the fake chord if is_fakechord */
  gpointer fakechord; /**< This is the actual value of the fake chord if is_fakechord */
  gpointer fakechord_extension; /**< This is the extension to the fake chord. It may be a 7, sus4, 9, 11, 13 etc... */
  
  GList *directives;/**< list of DenemoDirective to apply to the chord */

}
chord;

/**
 * Structure defining an indicator that a tuplet is starting 
 */
typedef struct tupopen
{
  gint numerator;
  gint denominator;
  GList *directives;/**< list of DenemoDirective to apply to the tuplet */
}
tupopen;

typedef tupopen tuplet; //used for tupclose or tupopen

/**
 * Enum defining clef values
 * 
 */
typedef enum clefs
{
  DENEMO_TREBLE_CLEF=0,
  DENEMO_BASS_CLEF,
  DENEMO_ALTO_CLEF,
  DENEMO_G_8_CLEF,
  DENEMO_TENOR_CLEF,
  DENEMO_SOPRANO_CLEF,
  DENEMO_F_8_CLEF,
  DENEMO_FRENCH_CLEF,
  DENEMO_INVALID_CLEF
}clefs;

/**
 * Indicator for a clef change 
 */
typedef struct clef
{
  enum clefs type;
  GList *directives;
}
clef;

/**
 * Indicator for a time-signature change. Only appears at the
 * beginning of a measure 
 */
typedef struct timesig
{
  gint time1; /**< This is the numerator for a time signature */
  gint time2; /**< This is the denominator for a time signature */
  GList *directives;
}
timesig;

/** 
 * Indicator for a key-signature change. 
 */
typedef struct keysig
{
  gint number; /**< key number -7 to 7 for major/minor 0 to 40 for mode */
  gint isminor; /**< Type of key 0-major 1-minor 2-mode */
  gint mode;  /**< Mode indicator */
  gint accs[7];
  GList *directives;
}
keysig;

/* Dynamic */

typedef struct dynamic 
{
  GString *type;
}
dynamic;

/**
 * Enum defining barline types
 * 
 */
typedef enum barline_type {
  ORDINARY_BARLINE,
  DOUBLE_BARLINE, /**< Double Bar */
  END_BARLINE,
  OPENREPEAT_BARLINE,
  CLOSE_REPEAT,
  OPEN_CLOSE_REPEAT
} barline_type;

/**
 * Structure encapsulating a barline
 * 
 */
typedef struct barline
{
  barline_type type;
}
barline;



/**
 * Lyric datastructure 
 */
typedef struct lyric
{
  GString *lyrics;  /**< This is the text string containing the lyrics */
  gint position;
  gboolean is_syllable; /**< Is the lyric a syllable? */
  gboolean center_lyric; /**< Should the lyrics be centered? */
}lyric;


/* A standalone DenemoDirective. lilydirective is an obsolete name */

#define lilydirective DenemoDirective
#if 0
typedef struct lilydirective DenemoDirective;

{
  GString *directive;/**< the LilyPond text */
  gboolean locked;/**< If true the directive cannot be deleted easily */
  GString *display;/**< Something for Denemo to display (to indicate what the directive is doing*/
  gint x;/**< horizontal offset of display text */
  gint y;/**< vertical offset of display text */
  GdkBitmap *graphic; /**< bitmap to draw for this directive */
  gint width, height; /**< width and height of the bitmap */
}
lilydirective;
#endif

/**
 * Enum defining stem direction values
 * 
 */
typedef enum stemdirections
{
  DENEMO_STEMDOWN=1,
  DENEMO_STEMBOTH,
  DENEMO_STEMUP
}stemdirections;

/**
 * Indicator that the following music should be all stemup, all
 * stemdown, or stemmed normally 
 */
typedef struct stemdirective
{
  enum stemdirections type;
  GList *directives;/**< list of DenemoDirective to apply to the stemdirective */
}
stemdirective;


/**
 * a note and duration (e.g. obtained by pitch recognition)
 * plus field to indicate if the tone is spurious
 */
typedef struct tone
{
  gint duration;
  gint step;
  gint octave;
  gint enshift;
  gboolean valid;
}
tone;

#endif