diff 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
line wrap: on
line diff
--- a/src/audio/mint/SDL_mintaudio_stfa.c	Sat Oct 09 22:11:45 2004 +0000
+++ b/src/audio/mint/SDL_mintaudio_stfa.c	Fri Oct 29 09:56:53 2004 +0000
@@ -53,7 +53,7 @@
 
 /* Debug print info */
 #define DEBUG_NAME "audio:stfa: "
-#if 0
+#if 1
 #define DEBUG_PRINT(what) \
 	{ \
 		printf what; \
@@ -211,15 +211,22 @@
 	DEBUG_PRINT(("freq=%d\n", spec->freq));
 
 	/* Check formats available */
-	MINTAUDIO_nfreq=16;
-	MINTAUDIO_sfreq=0;
-	for (i=MINTAUDIO_sfreq;i<MINTAUDIO_nfreq;i++) {
-		MINTAUDIO_hardfreq[i]=freqs[15-i];
-		DEBUG_PRINT((DEBUG_NAME "calc:freq(%d)=%lu\n", i, MINTAUDIO_hardfreq[i]));
+	MINTAUDIO_freqcount=0;
+	for (i=0;i<16;i++) {
+		SDL_MintAudio_AddFrequency(this, freqs[i], 0, i);
 	}
 
-	MINTAUDIO_numfreq=SDL_MintAudio_SearchFrequency(this, 0, spec->freq);
-	spec->freq=MINTAUDIO_hardfreq[MINTAUDIO_numfreq];
+#if 1
+	for (i=0; i<MINTAUDIO_freqcount; i++) {
+		DEBUG_PRINT((DEBUG_NAME "freq %d: %lu Hz, clock %lu, prediv %d\n",
+			i, MINTAUDIO_frequencies[i].frequency, MINTAUDIO_frequencies[i].masterclock,
+			MINTAUDIO_frequencies[i].predivisor
+		));
+	}
+#endif
+
+	MINTAUDIO_numfreq=SDL_MintAudio_SearchFrequency(this, spec->freq);
+	spec->freq=MINTAUDIO_frequencies[MINTAUDIO_numfreq].frequency;
 
 	DEBUG_PRINT((DEBUG_NAME "obtained: %d bits, ",spec->format & 0x00ff));
 	DEBUG_PRINT(("signed=%d, ", ((spec->format & 0x8000)!=0)));
@@ -243,7 +250,7 @@
 	cookie_stfa->sound_enable=STFA_PLAY_DISABLE;
 
 	/* Select replay format */
-	cookie_stfa->sound_control = 15-MINTAUDIO_numfreq;
+	cookie_stfa->sound_control = MINTAUDIO_frequencies[MINTAUDIO_numfreq].predivisor;
 	if ((spec->format & 0xff)==8) {
 		cookie_stfa->sound_control |= STFA_FORMAT_8BIT;
 	} else {