comparison src/audio/mint/SDL_mintaudio_stfa.c @ 961:185acc07127a

Date: Fri, 29 Oct 2004 11:47:09 +0200 From: Patrice Mandin Subject: Reworked audio drivers for Atari platform These are reworked audio drivers for the Atari platform. Previous drivers were missing some features: - Test external clock plugged to DSP port on Atari Falcon 030. - Ability to select internal or external clock. So now, I generate a list of frequencies available, with the master clock and predivisor to use. One big caveat to this: I do not have an external clock, so I hope it works.
author Patrice Mandin <patmandin@gmail.com>
date Fri, 29 Oct 2004 09:56:53 +0000
parents b8d311d90021
children 176240cf4405
comparison
equal deleted inserted replaced
960:eec28a5278be 961:185acc07127a
51 51
52 #define MINT_AUDIO_DRIVER_NAME "mint_stfa" 52 #define MINT_AUDIO_DRIVER_NAME "mint_stfa"
53 53
54 /* Debug print info */ 54 /* Debug print info */
55 #define DEBUG_NAME "audio:stfa: " 55 #define DEBUG_NAME "audio:stfa: "
56 #if 0 56 #if 1
57 #define DEBUG_PRINT(what) \ 57 #define DEBUG_PRINT(what) \
58 { \ 58 { \
59 printf what; \ 59 printf what; \
60 } 60 }
61 #else 61 #else
209 DEBUG_PRINT(("big endian=%d, ", ((spec->format & 0x1000)!=0))); 209 DEBUG_PRINT(("big endian=%d, ", ((spec->format & 0x1000)!=0)));
210 DEBUG_PRINT(("channels=%d, ", spec->channels)); 210 DEBUG_PRINT(("channels=%d, ", spec->channels));
211 DEBUG_PRINT(("freq=%d\n", spec->freq)); 211 DEBUG_PRINT(("freq=%d\n", spec->freq));
212 212
213 /* Check formats available */ 213 /* Check formats available */
214 MINTAUDIO_nfreq=16; 214 MINTAUDIO_freqcount=0;
215 MINTAUDIO_sfreq=0; 215 for (i=0;i<16;i++) {
216 for (i=MINTAUDIO_sfreq;i<MINTAUDIO_nfreq;i++) { 216 SDL_MintAudio_AddFrequency(this, freqs[i], 0, i);
217 MINTAUDIO_hardfreq[i]=freqs[15-i]; 217 }
218 DEBUG_PRINT((DEBUG_NAME "calc:freq(%d)=%lu\n", i, MINTAUDIO_hardfreq[i])); 218
219 } 219 #if 1
220 220 for (i=0; i<MINTAUDIO_freqcount; i++) {
221 MINTAUDIO_numfreq=SDL_MintAudio_SearchFrequency(this, 0, spec->freq); 221 DEBUG_PRINT((DEBUG_NAME "freq %d: %lu Hz, clock %lu, prediv %d\n",
222 spec->freq=MINTAUDIO_hardfreq[MINTAUDIO_numfreq]; 222 i, MINTAUDIO_frequencies[i].frequency, MINTAUDIO_frequencies[i].masterclock,
223 MINTAUDIO_frequencies[i].predivisor
224 ));
225 }
226 #endif
227
228 MINTAUDIO_numfreq=SDL_MintAudio_SearchFrequency(this, spec->freq);
229 spec->freq=MINTAUDIO_frequencies[MINTAUDIO_numfreq].frequency;
223 230
224 DEBUG_PRINT((DEBUG_NAME "obtained: %d bits, ",spec->format & 0x00ff)); 231 DEBUG_PRINT((DEBUG_NAME "obtained: %d bits, ",spec->format & 0x00ff));
225 DEBUG_PRINT(("signed=%d, ", ((spec->format & 0x8000)!=0))); 232 DEBUG_PRINT(("signed=%d, ", ((spec->format & 0x8000)!=0)));
226 DEBUG_PRINT(("big endian=%d, ", ((spec->format & 0x1000)!=0))); 233 DEBUG_PRINT(("big endian=%d, ", ((spec->format & 0x1000)!=0)));
227 DEBUG_PRINT(("channels=%d, ", spec->channels)); 234 DEBUG_PRINT(("channels=%d, ", spec->channels));
241 248
242 /* Stop replay */ 249 /* Stop replay */
243 cookie_stfa->sound_enable=STFA_PLAY_DISABLE; 250 cookie_stfa->sound_enable=STFA_PLAY_DISABLE;
244 251
245 /* Select replay format */ 252 /* Select replay format */
246 cookie_stfa->sound_control = 15-MINTAUDIO_numfreq; 253 cookie_stfa->sound_control = MINTAUDIO_frequencies[MINTAUDIO_numfreq].predivisor;
247 if ((spec->format & 0xff)==8) { 254 if ((spec->format & 0xff)==8) {
248 cookie_stfa->sound_control |= STFA_FORMAT_8BIT; 255 cookie_stfa->sound_control |= STFA_FORMAT_8BIT;
249 } else { 256 } else {
250 cookie_stfa->sound_control |= STFA_FORMAT_16BIT; 257 cookie_stfa->sound_control |= STFA_FORMAT_16BIT;
251 } 258 }