Mercurial > sdl-ios-xcode
comparison src/audio/mint/SDL_mintaudio_dma8.c @ 2060:866052b01ee5
indent is evil
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Sat, 28 Oct 2006 16:48:03 +0000 |
parents | 5f6550e5184f |
children | 29e07f91bc1f |
comparison
equal
deleted
inserted
replaced
2059:4685ccd33d0e | 2060:866052b01ee5 |
---|---|
99 Jdisint(MFP_DMASOUND); | 99 Jdisint(MFP_DMASOUND); |
100 | 100 |
101 DEBUG_PRINT((DEBUG_NAME "closeaudio: interrupt disabled\n")); | 101 DEBUG_PRINT((DEBUG_NAME "closeaudio: interrupt disabled\n")); |
102 | 102 |
103 /* Wait if currently playing sound */ | 103 /* Wait if currently playing sound */ |
104 while (SDL_MintAudio_mutex != 0) {} | 104 while (SDL_MintAudio_mutex != 0) { |
105 } | |
105 | 106 |
106 DEBUG_PRINT((DEBUG_NAME "closeaudio: no more interrupt running\n")); | 107 DEBUG_PRINT((DEBUG_NAME "closeaudio: no more interrupt running\n")); |
107 | 108 |
108 /* Clear buffers */ | 109 /* Clear buffers */ |
109 if (SDL_MintAudio_audiobuf[0]) { | 110 if (SDL_MintAudio_audiobuf[0]) { |
125 | 126 |
126 DEBUG_PRINT((DEBUG_NAME "asked: %d bits, ", | 127 DEBUG_PRINT((DEBUG_NAME "asked: %d bits, ", |
127 SDL_AUDIO_BITSIZE(this->spec.format))); | 128 SDL_AUDIO_BITSIZE(this->spec.format))); |
128 DEBUG_PRINT(("float=%d, ", SDL_AUDIO_ISFLOAT(this->spec.format))); | 129 DEBUG_PRINT(("float=%d, ", SDL_AUDIO_ISFLOAT(this->spec.format))); |
129 DEBUG_PRINT(("signed=%d, ", SDL_AUDIO_ISSIGNED(this->spec.format))); | 130 DEBUG_PRINT(("signed=%d, ", SDL_AUDIO_ISSIGNED(this->spec.format))); |
130 DEBUG_PRINT(("big endian=%d, ", SDL_AUDIO_ISBIGENDIAN(this->spec.format))); | 131 DEBUG_PRINT(("big endian=%d, ", |
132 SDL_AUDIO_ISBIGENDIAN(this->spec.format))); | |
131 DEBUG_PRINT(("channels=%d, ", this->spec.channels)); | 133 DEBUG_PRINT(("channels=%d, ", this->spec.channels)); |
132 DEBUG_PRINT(("freq=%d\n", this->spec.freq)); | 134 DEBUG_PRINT(("freq=%d\n", this->spec.freq)); |
133 | 135 |
134 if (this->spec.channels > 2) { | 136 if (this->spec.channels > 2) { |
135 this->spec.channels = 2; /* no more than stereo! */ | 137 this->spec.channels = 2; /* no more than stereo! */ |
136 } | 138 } |
137 | 139 |
138 /* Check formats available */ | 140 /* Check formats available */ |
139 this->spec.format = AUDIO_S8; | 141 this->spec.format = AUDIO_S8; |
140 | 142 |
182 | 184 |
183 DEBUG_PRINT((DEBUG_NAME "obtained: %d bits, ", | 185 DEBUG_PRINT((DEBUG_NAME "obtained: %d bits, ", |
184 SDL_AUDIO_BITSIZE(this->spec.format))); | 186 SDL_AUDIO_BITSIZE(this->spec.format))); |
185 DEBUG_PRINT(("float=%d, ", SDL_AUDIO_ISFLOAT(this->spec.format))); | 187 DEBUG_PRINT(("float=%d, ", SDL_AUDIO_ISFLOAT(this->spec.format))); |
186 DEBUG_PRINT(("signed=%d, ", SDL_AUDIO_ISSIGNED(this->spec.format))); | 188 DEBUG_PRINT(("signed=%d, ", SDL_AUDIO_ISSIGNED(this->spec.format))); |
187 DEBUG_PRINT(("big endian=%d, ", SDL_AUDIO_ISBIGENDIAN(this->spec.format))); | 189 DEBUG_PRINT(("big endian=%d, ", |
190 SDL_AUDIO_ISBIGENDIAN(this->spec.format))); | |
188 DEBUG_PRINT(("channels=%d, ", this->spec.channels)); | 191 DEBUG_PRINT(("channels=%d, ", this->spec.channels)); |
189 DEBUG_PRINT(("freq=%d\n", this->spec.freq)); | 192 DEBUG_PRINT(("freq=%d\n", this->spec.freq)); |
190 | 193 |
191 return 0; | 194 return 0; |
192 } | 195 } |
253 return 0; | 256 return 0; |
254 } | 257 } |
255 | 258 |
256 /* Initialize all variables that we clean on shutdown */ | 259 /* Initialize all variables that we clean on shutdown */ |
257 this->hidden = (struct SDL_PrivateAudioData *) | 260 this->hidden = (struct SDL_PrivateAudioData *) |
258 SDL_malloc((sizeof *this->hidden)); | 261 SDL_malloc((sizeof *this->hidden)); |
259 if (this->hidden == NULL) { | 262 if (this->hidden == NULL) { |
260 SDL_OutOfMemory(); | 263 SDL_OutOfMemory(); |
261 return 0; | 264 return 0; |
262 } | 265 } |
263 SDL_memset(this->hidden, 0, (sizeof *this->hidden)); | 266 SDL_memset(this->hidden, 0, (sizeof *this->hidden)); |
265 SDL_CalculateAudioSpec(&this->spec); | 268 SDL_CalculateAudioSpec(&this->spec); |
266 | 269 |
267 /* Allocate memory for audio buffers in DMA-able RAM */ | 270 /* Allocate memory for audio buffers in DMA-able RAM */ |
268 DEBUG_PRINT((DEBUG_NAME "buffer size=%d\n", this->spec.size)); | 271 DEBUG_PRINT((DEBUG_NAME "buffer size=%d\n", this->spec.size)); |
269 | 272 |
270 SDL_MintAudio_audiobuf[0] = Atari_SysMalloc(this->spec.size * 2, MX_STRAM); | 273 SDL_MintAudio_audiobuf[0] = |
274 Atari_SysMalloc(this->spec.size * 2, MX_STRAM); | |
271 if (SDL_MintAudio_audiobuf[0] == NULL) { | 275 if (SDL_MintAudio_audiobuf[0] == NULL) { |
272 SDL_free(this->hidden); | 276 SDL_free(this->hidden); |
273 this->hidden = NULL; | 277 this->hidden = NULL; |
274 SDL_OutOfMemory(); | 278 SDL_OutOfMemory(); |
275 return 0; | 279 return 0; |
276 } | 280 } |
277 SDL_MintAudio_audiobuf[1] = SDL_MintAudio_audiobuf[0] + this->spec.size; | 281 SDL_MintAudio_audiobuf[1] = SDL_MintAudio_audiobuf[0] + this->spec.size; |
278 SDL_MintAudio_numbuf = 0; | 282 SDL_MintAudio_numbuf = 0; |
279 SDL_memset(SDL_MintAudio_audiobuf[0],this->spec.silence,this->spec.size*2); | 283 SDL_memset(SDL_MintAudio_audiobuf[0], this->spec.silence, |
284 this->spec.size * 2); | |
280 SDL_MintAudio_audiosize = this->spec.size; | 285 SDL_MintAudio_audiosize = this->spec.size; |
281 SDL_MintAudio_mutex = 0; | 286 SDL_MintAudio_mutex = 0; |
282 | 287 |
283 DEBUG_PRINT((DEBUG_NAME "buffer 0 at 0x%08x\n", | 288 DEBUG_PRINT((DEBUG_NAME "buffer 0 at 0x%08x\n", |
284 SDL_MintAudio_audiobuf[0])); | 289 SDL_MintAudio_audiobuf[0])); |
288 SDL_MintAudio_CheckFpu(); | 293 SDL_MintAudio_CheckFpu(); |
289 | 294 |
290 /* Setup audio hardware */ | 295 /* Setup audio hardware */ |
291 MINTDMA8_InitAudio(this); | 296 MINTDMA8_InitAudio(this); |
292 | 297 |
293 return 1; /* good to go. */ | 298 return 1; /* good to go. */ |
294 } | 299 } |
295 | 300 |
296 static int | 301 static int |
297 MINTDMA8_Init(SDL_AudioDriverImpl *impl) | 302 MINTDMA8_Init(SDL_AudioDriverImpl * impl) |
298 { | 303 { |
299 /* Cookie _MCH present ? if not, assume ST machine */ | 304 /* Cookie _MCH present ? if not, assume ST machine */ |
300 if (Getcookie(C__MCH, &cookie_mch) == C_NOTFOUND) { | 305 if (Getcookie(C__MCH, &cookie_mch) == C_NOTFOUND) { |
301 cookie_mch = MCH_ST; | 306 cookie_mch = MCH_ST; |
302 } | 307 } |