roneos
Operating System for the r-one robot
 All Data Structures Files Functions Variables Typedefs Groups
audio.h
Go to the documentation of this file.
1 
10 #ifndef AUDIO_H_
11 #define AUDIO_H_
12 
13 /******** Defines ********/
14 
15 #define OCTAVE_MAX 10
16 #define NOTES_IN_ONE_OCTAVE 12
17 #define MajorThird 4
18 #define MinorThird 3
19 #define Perfect5th 7
20 #define oneOctave NOTES_IN_ONE_OCTAVE
21 #define twoOctaves (NOTES_IN_ONE_OCTAVE * 2)
22 #define threeOctaves (NOTES_IN_ONE_OCTAVE * 3)
23 #define fourOctaves (NOTES_IN_ONE_OCTAVE * 4)
24 #define middleC 0x3C
25 
26 #define CNote 0
27 #define CsNote 1
28 #define DNote 2
29 #define DsNote 3
30 #define ENote 4
31 #define FNote 5
32 #define FsNote 6
33 #define GNote 7
34 #define GsNote 8
35 #define ANote 9
36 #define AsNote 10
37 #define BNote 11
38 #define CNoteUp 12
39 
40 #include "VS1053_PatchTable.h"
41 
42 #define AUDIO_VOLUME_MAX 255
43 #define AUDIO_VOLUME_MIN 0
44 
45 #define AUDIO_VELOCITY_MIN 0
46 #define AUDIO_VELOCITY_MAX 127
47 
48 /******** Structs ********/
49 
50 /******** Functions ********/
51 
57 void audioInit(void);
58 
59 
68 void audioNoteOn(uint8 instrument, uint8 key, uint8 velocity, uint32 duration);
69 
70 
78 void audioNoteOff(uint8 instrument, uint8 key);
79 
80 
85 void audioNoteOffAll(void);
86 
87 
94 void audioVolume(uint8 volume);
95 
96 //TODO: what does this actually do?
103 void soundChipTest(uint8 test);
104 
105 
115 void playMajorChord(uint8 instrument, uint8 baseNote, uint8 volume, uint32 duration);
116 
117 
127 void playMinorChord(uint8 instrument, uint8 baseNote, uint8 volume, uint32 duration);
128 #endif /* AUDIO_H_ */