[xiph-cvs] cvs commit: ao/src/plugins/alsa09 ao_alsa09.c
Warren Dukes
shank at xiph.org
Fri Apr 16 20:52:49 PDT 2004
shank 04/04/16 23:52:49
Modified: src/plugins/alsa09 ao_alsa09.c
Log:
ok, first, don't try to calculate period_size, just use a period of 50ms
(this is the default that xmms uses). Using this period size drasticly
reduces cpu usage (50%->6%) on my epia w/ via sound card.
Also, don't set any software settings, they aren't neccessary
(alsaplayer sets no sw params! and xmms only sets threshold, which
causes problems for dmix) So instead, lets use the default sw params,
as alsa-lib is prolly better at picking them than we are.
Revision Changes Path
1.21 +13 -14 ao/src/plugins/alsa09/ao_alsa09.c
Index: ao_alsa09.c
===================================================================
RCS file: /usr/local/cvsroot/ao/src/plugins/alsa09/ao_alsa09.c,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -r1.20 -r1.21
--- a/ao_alsa09.c 13 Oct 2003 02:12:32 -0000 1.20
+++ b/ao_alsa09.c 17 Apr 2004 03:52:48 -0000 1.21
@@ -42,13 +42,12 @@
/* default 500 millisecond buffer */
#define AO_ALSA_BUFFER_TIME 500000
-/* the period time is calculated if not given as an option
- * note, playback starts after four of these are in the buffer */
-#define AO_ALSA_PERIOD_TIME 0
+/* default 50 millisecond period size */
+#define AO_ALSA_PERIOD_TIME 50000
/* number of samples between interrupts
- * supplying a period_time to ao overrides the use of this */
-#define AO_ALSA_SAMPLE_XFER 256
+ * supplying a period_time to ao overrides the use of this
+#define AO_ALSA_SAMPLE_XFER 256*/
/* set mmap to default if enabled at compile time, otherwise, mmap isn't
the default */
@@ -275,9 +274,9 @@
/*internal->buffer_time = err;*/
/* calculate a period time of one half sample time */
- if ((internal->period_time == 0) && (rate > 0))
+ /*if ((internal->period_time == 0) && (rate > 0))
internal->period_time =
- 1000000 * AO_ALSA_SAMPLE_XFER / rate;
+ 1000000 * AO_ALSA_SAMPLE_XFER / rate;*/
/* set the time per hardware sample transfer */
internal->cmd = "snd_pcm_hw_params_set_period_time_near";
@@ -330,24 +329,24 @@
deadlock for dmix in a pol(). So here we just set it to 0,
I'm not sure why we need to set a threshold > 0 anyway, maybe
someone could enlighten me. - shank */
- internal->cmd = "snd_pcm_sw_params_set_start_threshold";
+ /*internal->cmd = "snd_pcm_sw_params_set_start_threshold";
err = snd_pcm_sw_params_set_start_threshold(internal->pcm_handle,
- params, /*internal->period_size << 2*/0);
+ params, 0);
if (err < 0)
- return err;
+ return err;*/
/* require a minimum of one full transfer in the buffer */
- internal->cmd = "snd_pcm_sw_params_set_avail_min";
+ /*internal->cmd = "snd_pcm_sw_params_set_avail_min";
err = snd_pcm_sw_params_set_avail_min(internal->pcm_handle, params,
internal->period_size);
if (err < 0)
- return err;
+ return err;*/
/* do not align transfers */
- internal->cmd = "snd_pcm_sw_params_set_xfer_align";
+ /*internal->cmd = "snd_pcm_sw_params_set_xfer_align";
err = snd_pcm_sw_params_set_xfer_align(internal->pcm_handle, params, 1);
if (err < 0)
- return err;
+ return err;*/
/* commit the params structure to ALSA */
internal->cmd = "snd_pcm_sw_params";
<p><p>--- >8 ----
List archives: http://www.xiph.org/archives/
Ogg project homepage: http://www.xiph.org/ogg/
To unsubscribe from this list, send a message to 'cvs-request at xiph.org'
containing only the word 'unsubscribe' in the body. No subject is needed.
Unsubscribe messages sent to the list will be ignored/filtered.
More information about the commits
mailing list