From 2d866c11df9e3f450a8a0e4f96e6bdce49401196 Mon Sep 17 00:00:00 2001 From: Miguel Freitas Date: Fri, 12 Oct 2001 19:25:11 +0000 Subject: - fix for playing low quality sound (like 11127Hz,8bit,mono) - no use for getting latency from arts every time: it's constant as we don't change it during play and it would require a server restart if changed from kde control center. CVS patchset: 790 CVS date: 2001/10/12 19:25:11 --- src/audio_out/audio_arts_out.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/src/audio_out/audio_arts_out.c b/src/audio_out/audio_arts_out.c index d4d84ab9d..bcd9a4e21 100644 --- a/src/audio_out/audio_arts_out.c +++ b/src/audio_out/audio_arts_out.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: audio_arts_out.c,v 1.5 2001/09/14 20:44:01 jcdutton Exp $ + * $Id: audio_arts_out.c,v 1.6 2001/10/12 19:25:11 miguelfreitas Exp $ */ /* required for swab() */ @@ -118,6 +118,18 @@ static int ao_arts_open(ao_driver_t *this_gen, this->audio_stream=arts_play_stream(this->sample_rate, bits, this->num_channels, "xine"); this->latency = arts_stream_get (this->audio_stream, ARTS_P_TOTAL_LATENCY); + + /* try to keep latency low, if we don't do this we might end + with very high latencies for low quality sound and audio_out will + try to fill gaps every time...(values in ms) */ + if( this->latency > 800 ) + { + this->latency = 800 - arts_stream_get (this->audio_stream, ARTS_P_SERVER_LATENCY); + if( this->latency < 100 ) + this->latency = 100; + arts_stream_set( this->audio_stream, ARTS_P_BUFFER_TIME, this->latency ); + this->latency = arts_stream_get (this->audio_stream, ARTS_P_TOTAL_LATENCY); + } printf ("audio_arts_out : latency %d ms\n", this->latency); @@ -163,9 +175,7 @@ static int ao_arts_delay (ao_driver_t *this_gen) a very roughly aproximation. */ - return arts_stream_get (this->audio_stream, ARTS_P_TOTAL_LATENCY) * this->sample_rate / 1000; - -/* return this->latency * this->sample_rate / 1000; */ + return this->latency * this->sample_rate / 1000; } static void ao_arts_close(ao_driver_t *this_gen) -- cgit v1.2.3