changeset 7714:6973a985ac2a

- ao_data.bps not set, confuses the A-V sync computation when the audio filters are in use. - computation in get_delay() was returning bogus values
author jkeil
date Fri, 11 Oct 2002 21:22:55 +0000
parents 32878695ca8b
children 9774d0733dfa
files libao2/ao_sun.c
diffstat 1 files changed, 16 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/libao2/ao_sun.c	Fri Oct 11 14:48:07 2002 +0000
+++ b/libao2/ao_sun.c	Fri Oct 11 21:22:55 2002 +0000
@@ -463,6 +463,20 @@
 	enable_sample_timing = realtime_samplecounter_available(audio_dev);
     }
 
+#define	AF_FILTER_TEST 0
+#if	AF_FILTER_TEST
+    /* test code to force use of the audio filter modules */
+    {
+	char *s;
+	if (s = getenv("AF_RATE"))
+	    rate = atoi(s);
+	if (s = getenv("AF_CHANNELS"))
+	    channels = atoi(s);
+	if (s = getenv("AF_BITS"))
+	    format = atoi(s) == 16 ? AFMT_S16_NE : AFMT_U8;
+    }
+#endif
+
 //    printf("ao2: %d Hz  %d chans  %s [0x%X]\n",
 //	   rate,channels,audio_out_format_name(format),format);
 
@@ -548,7 +562,7 @@
     }
 
     bytes_per_sample = channels * info.play.precision / 8;
-    byte_per_sec = bytes_per_sample * rate;
+    ao_data.bps = byte_per_sec = bytes_per_sample * rate;
     ao_data.outburst = byte_per_sec > 100000 ? 16384 : 8192;
 
 #ifdef	__not_used__
@@ -746,7 +760,7 @@
     return (float) info.play.seek/ (float)byte_per_sec ;
 #else
     if (info.play.samples && enable_sample_timing == RTSC_ENABLED)
-	return (float)(queued_samples - info.play.samples) / (float)byte_per_sec;
+	return (float)(queued_samples - info.play.samples) / (float)ao_data.samplerate;
     else
 	return (float)((queued_bursts - info.play.eof) * ao_data.outburst) / (float)byte_per_sec;
 #endif