AvrIO  1.4.5
Bibliothèque C modulaire pour ATMEL AVR
melody.h
1 
18 /* ========================================================================== */
19 #ifndef _AVRIO_MELODY_H_
20 # define _AVRIO_MELODY_H_
21 
22 # include <avrio/defs.h>
23 
24 __BEGIN_C_DECLS
25  /* ======================================================================== */
46  /* structures ============================================================= */
51  typedef struct xNote {
52  uint8_t pitch;
53  uint8_t length;
54 } xNote;
55 
56 /* internal public functions ================================================ */
57 
63 void vMelodyInit (uint8_t xDuration, uint8_t xInternote);
64 
69 void vMelodyPlay (const xNote * xMelody);
70 
75 void vMelodyPlayFlash (const xNote * xMelody);
76 
82 void vMelodyPlaySystem (uint8_t ucIndex);
83 
87 void vMelodyStop (void);
88 
96 extern void vMelodyTopChangedCB (uint16_t usNewTop);
97 
98 /* inline public functions ================================================== */
99 
103 void vMelodyBeep (void);
104 
109 void vMelodyPause (bool xPause);
110 
115 bool xMelodyIsPlay (void);
116 
121 void vMelodySetDuration (uint8_t xDuration);
122 
126 uint8_t ucMelodyDuration (void);
127 
134 void vMelodySetInternote (uint8_t xInternote);
135 
139 uint8_t ucMelodyInternote (void);
140 
141 /* constants ================================================================ */
145 # define MELODY_BEEP 0
146 
149 # define MELODY_WELCOME 1
150 
153 # define MELODY_WARNING 2
154 
157 # define MELODY_ERROR 3
158 
161 # define MELODY_SYS_MAX 4
162 
165 # define WHOLE 16
166 
169 # define HALF 8
170 
173 # define QUARTER 4
174 
177 # define EIGHTH 2
178 
183 # define PITCH_A0 0
184 # define PITCH_Am0 1
185 # define PITCH_H0 2
186 
189 # define PITCH_C1 3
190 
193 # define PITCH_Cm1 4
194 
197 # define PITCH_D1 5
198 
201 # define PITCH_Dm1 6
202 
205 # define PITCH_E1 7
206 
209 # define PITCH_F1 8
210 
213 # define PITCH_Fm1 9
214 
217 # define PITCH_G1 10
218 
221 # define PITCH_Gm1 11
222 
225 # define PITCH_A1 12
226 
229 # define PITCH_Am1 13
230 
233 # define PITCH_H1 14
234 # define PITCH_C2 15
235 # define PITCH_Cm2 16
236 # define PITCH_D2 17
237 # define PITCH_Dm2 18
238 # define PITCH_E2 19
239 # define PITCH_F2 20
240 # define PITCH_Fm2 21
241 # define PITCH_G2 22
242 # define PITCH_Gm2 23
243 # define PITCH_A2 24
244 # define PITCH_Am2 25
245 # define PITCH_H2 26
246 # define PITCH_C3 27
247 # define PITCH_Cm3 28
248 # define PITCH_D3 29
249 # define PITCH_Dm3 30
250 # define PITCH_E3 31
251 # define PITCH_F3 32
252 # define PITCH_Fm3 33
253 # define PITCH_G3 34
254 # define PITCH_Gm3 35
255 # define PITCH_A3 36
256 # define PITCH_Am3 37
257 # define PITCH_H3 38
258 # define PITCH_C4 39
259 # define PITCH_Cm4 40
260 # define PITCH_D4 41
261 # define PITCH_Dm4 42
262 # define PITCH_E4 43
263 # define PITCH_F4 44
264 # define PITCH_Fm4 45
265 # define PITCH_G4 46
266 # define PITCH_Gm4 47
267 
270 # define PITCH_A4 48
271 # define PITCH_Am4 49
272 # define PITCH_H4 50
273 # define PITCH_C5 51
274 # define PITCH_Cm5 52
275 # define PITCH_D5 53
276 # define PITCH_Dm5 54
277 # define PITCH_E5 55
278 # define PITCH_F5 56
279 # define PITCH_Fm5 57
280 # define PITCH_G5 58
281 # define PITCH_Gm5 59
282 # define PITCH_A5 60
283 # define PITCH_Am5 61
284 # define PITCH_H5 62
285 # define PITCH_C6 63
286 # define PITCH_Cm6 64
287 # define PITCH_D6 65
288 # define PITCH_Dm6 66
289 # define PITCH_E6 67
290 # define PITCH_F6 68
291 # define PITCH_Fm6 69
292 # define PITCH_G6 70
293 # define PITCH_Gm6 71
294 # define PITCH_A6 72
295 # define PITCH_Am6 73
296 # define PITCH_H6 74
297 # define PITCH_C7 75
298 # define PITCH_Cm7 76
299 # define PITCH_D7 77
300 # define PITCH_Dm7 78
301 # define PITCH_E7 79
302 # define PITCH_F7 80
303 # define PITCH_Fm7 81
304 # define PITCH_G7 82
305 # define PITCH_Gm7 83
306 # define PITCH_A7 84
307 # define PITCH_Am7 85
308 # define PITCH_H7 86
309 # define PITCH_C8 87
310 # define PITCH_Cm8 88
311 # define PITCH_D8 89
312 # define PITCH_Dm8 90
313 # define PITCH_E8 91
314 # define PITCH_F8 92
315 # define PITCH_Fm8 93
316 # define PITCH_G8 94
317 # define PITCH_Gm8 95
318 # define PITCH_A8 96
319 
322 # define PITCH_PAUSE 97
323 
326 # define PITCH_MAX 98
327 
330 # define PITCH_END 255
331 
335 # if defined(__DOXYGEN__)
336 /*
337  * __DOXYGEN__ defined
338  * Partie documentation ne devant pas être compilée.
339  * =============================================================================
340  */
341 
346 # else
347 /*
348  * __DOXYGEN__ not defined
349  * Partie ne devant pas être documentée.
350  * =============================================================================
351  */
352 
353 # endif /* __DOXYGEN__ not defined */
354 /* ========================================================================== */
355 __END_C_DECLS
356 #endif /* _AVRIO_MELODY_H_ */
void vMelodyBeep(void)
Joue un bip bref.
void vMelodyPlaySystem(uint8_t ucIndex)
void vMelodyInit(uint8_t xDuration, uint8_t xInternote)
Initialise le module son.
uint8_t ucMelodyDuration(void)
Lecture de la durée du 1/16 ième de note courante.
void vMelodyPause(bool xPause)
Met en pause ou reprend la lecture d&#39;un morceau.
void vMelodySetDuration(uint8_t xDuration)
Modifie la durée du 1/16 ième de note.
uint8_t length
Definition: melody.h:53
Structure Note de musique.
Definition: melody.h:51
void vMelodyPlay(const xNote *xMelody)
Joue une suite de notes (un morceau de musique) résidant en RAM.
void vMelodyStop(void)
Arrête brutalement la lecture du morceau en cours.
void vMelodySetInternote(uint8_t xInternote)
Modifie la durée de l&#39;espace internote (soustrait de la durée de note)
bool xMelodyIsPlay(void)
Indique si un lecture est en cours.
void vMelodyTopChangedCB(uint16_t usNewTop)
Fonction appelée par le module à chaque changement de TOP Si le timer est utilisé pour d&#39;autres fonct...
uint8_t ucMelodyInternote(void)
Lecture de la durée de l&#39;espace internote courant.
uint8_t pitch
Definition: melody.h:52
void vMelodyPlayFlash(const xNote *xMelody)
Joue un morceau de musique résidant en FLASH.