Main Page
Related Pages
Modules
Classes
Files
File List
File Members
dsound.h
Go to the documentation of this file.
1
6
/*
7
* The contents of this file are subject to the Mozilla Public License
8
* Version 1.0 (the "License"); you may not use this file except in
9
* compliance with the License. You may obtain a copy of the License
10
* at http://www.mozilla.org/MPL/
11
*
12
* Software distributed under the License is distributed on an "AS IS"
13
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14
* the License for the specific language governing rights and
15
* limitations under the License.
16
*
17
* The Original Code is legOS code, released October 17, 1999.
18
*
19
* The Initial Developer of the Original Code is Markus L. Noga.
20
* Portions created by Markus L. Noga are Copyright (C) 1999
21
* Markus L. Noga. All Rights Reserved.
22
*
23
* Contributor(s): Markus L. Noga <markus@noga.de>
24
* Froods <froods@alphalink.com.au>
25
*/
26
27
#ifndef __dsound_h__
28
#define __dsound_h__
29
30
#ifdef __cplusplus
31
extern
"C"
{
32
#endif
33
34
#include <
config.h
>
35
36
#ifdef CONF_DSOUND
37
38
#include <
time.h
>
39
40
#include <
unistd.h
>
41
43
//
44
// Definitions
45
//
47
56
typedef
struct
{
57
unsigned
char
pitch
;
58
unsigned
char
length
;
59
}
note_t
;
60
61
63
64
66
#define WHOLE 16
67
69
#define HALF 8
70
72
#define QUARTER 4
73
75
#define EIGHTH 2
76
78
79
80
// PITCH_H is European equivalent to American B note.
81
83
84
86
#define PITCH_A0 0
87
#define PITCH_Am0 1
88
#define PITCH_H0 2
89
#define PITCH_C1 3
90
#define PITCH_Cm1 4
91
#define PITCH_D1 5
92
#define PITCH_Dm1 6
93
#define PITCH_E1 7
94
#define PITCH_F1 8
95
#define PITCH_Fm1 9
96
#define PITCH_G1 10
97
#define PITCH_Gm1 11
98
#define PITCH_A1 12
99
#define PITCH_Am1 13
100
#define PITCH_H1 14
101
#define PITCH_C2 15
102
#define PITCH_Cm2 16
103
#define PITCH_D2 17
104
#define PITCH_Dm2 18
105
#define PITCH_E2 19
106
#define PITCH_F2 20
107
#define PITCH_Fm2 21
108
#define PITCH_G2 22
109
#define PITCH_Gm2 23
110
#define PITCH_A2 24
111
#define PITCH_Am2 25
112
#define PITCH_H2 26
113
#define PITCH_C3 27
114
#define PITCH_Cm3 28
115
#define PITCH_D3 29
116
#define PITCH_Dm3 30
117
#define PITCH_E3 31
118
#define PITCH_F3 32
119
#define PITCH_Fm3 33
120
#define PITCH_G3 34
121
#define PITCH_Gm3 35
122
#define PITCH_A3 36
123
#define PITCH_Am3 37
124
#define PITCH_H3 38
125
#define PITCH_C4 39
126
#define PITCH_Cm4 40
127
#define PITCH_D4 41
128
#define PITCH_Dm4 42
129
#define PITCH_E4 43
130
#define PITCH_F4 44
131
#define PITCH_Fm4 45
132
#define PITCH_G4 46
133
#define PITCH_Gm4 47
134
#define PITCH_A4 48
135
#define PITCH_Am4 49
136
#define PITCH_H4 50
137
#define PITCH_C5 51
138
#define PITCH_Cm5 52
139
#define PITCH_D5 53
140
#define PITCH_Dm5 54
141
#define PITCH_E5 55
142
#define PITCH_F5 56
143
#define PITCH_Fm5 57
144
#define PITCH_G5 58
145
#define PITCH_Gm5 59
146
#define PITCH_A5 60
147
#define PITCH_Am5 61
148
#define PITCH_H5 62
149
#define PITCH_C6 63
150
#define PITCH_Cm6 64
151
#define PITCH_D6 65
152
#define PITCH_Dm6 66
153
#define PITCH_E6 67
154
#define PITCH_F6 68
155
#define PITCH_Fm6 69
156
#define PITCH_G6 70
157
#define PITCH_Gm6 71
158
#define PITCH_A6 72
159
#define PITCH_Am6 73
160
#define PITCH_H6 74
161
#define PITCH_C7 75
162
#define PITCH_Cm7 76
163
#define PITCH_D7 77
164
#define PITCH_Dm7 78
165
#define PITCH_E7 79
166
#define PITCH_F7 80
167
#define PITCH_Fm7 81
168
#define PITCH_G7 82
169
#define PITCH_Gm7 83
170
#define PITCH_A7 84
171
#define PITCH_Am7 85
172
#define PITCH_H7 86
173
#define PITCH_C8 87
174
#define PITCH_Cm8 88
175
#define PITCH_D8 89
176
#define PITCH_Dm8 90
177
#define PITCH_E8 91
178
#define PITCH_F8 92
179
#define PITCH_Fm8 93
180
#define PITCH_G8 94
181
#define PITCH_Gm8 95
182
#define PITCH_A8 96
183
185
187
#define PITCH_PAUSE 97
188
190
#define PITCH_MAX 98
191
193
#define PITCH_END 255
194
195
197
#define DSOUND_BEEP 0
198
200
#define DSOUND_SYS_MAX 1
201
202
204
#define DSOUND_DEFAULT_16th_ms 200
205
207
#define DSOUND_DEFAULT_internote_ms 15
208
210
//
211
// Variables
212
//
214
215
#ifndef DOXYGEN_SHOULD_SKIP_INTERNALS
216
217
extern
unsigned
dsound_16th_ms
;
218
extern
unsigned
dsound_internote_ms
;
219
extern
volatile
note_t
*
dsound_next_note
;
220
extern
volatile
time_t
dsound_next_time
;
221
222
extern
const
note_t
*
dsound_system_sounds
[];
223
224
#endif // DOXYGEN_SHOULD_SKIP_INTERNALS
225
226
228
//
229
// User functions
230
//
232
234
static
inline
void
dsound_play
(
const
note_t
*notes) {
235
dsound_next_note=(
volatile
note_t
*) notes;
236
dsound_next_time=0;
237
}
238
240
static
inline
void
dsound_system
(
unsigned
nr) {
241
if
(nr<
DSOUND_SYS_MAX
)
242
dsound_play
(dsound_system_sounds[nr]);
243
}
244
246
static
inline
unsigned
dsound_set_duration
(
unsigned
duration) {
247
unsigned
orig_duration = dsound_16th_ms;
248
dsound_16th_ms=duration;
249
return
orig_duration;
250
}
251
253
255
static
inline
void
dsound_set_internote
(
unsigned
duration) {
256
dsound_internote_ms=duration;
257
}
258
260
static
inline
int
dsound_playing
(
void
) {
261
return
dsound_next_note!=0;
262
}
263
265
extern
wakeup_t
dsound_finished
(
wakeup_t
data);
266
268
extern
void
dsound_stop
(
void
);
269
270
#endif // CONF_DSOUND
271
272
#ifdef __cplusplus
273
}
274
#endif
275
276
#endif
/* __dsound_h__ */
brickOS
is released under the
Mozilla Public License
.
Original code copyright 1998-2005 by the authors.
Generated on Sat Mar 15 2014 11:28:21 for brickOS Kernel Developer by
1.8.1.2