From 2c3fb7590529195cffdee01417f050697e7f834b Mon Sep 17 00:00:00 2001 From: rncbc Date: Sun, 30 Oct 2005 11:01:31 +0000 Subject: [PATCH] * drivers/alsa/usx2y.c: avoid crackles when playback ports are disconnected; other changes cleanup unneeded things a bit. Signed-off-by: Karsten Wiese Signed-off-by: Rui Nuno Capela * Makefile.am: added intsimd.h to noinst_HEADERS, as to let `make dist` work again. Signed-off-by: Rui Nuno Capela * jack.spec.in: omitted enable-capabilities, stripped-binaries and preemption-check from default. Signed-off-by: Rui Nuno Capela * configure.ac: removed (deprecated) -fmove-all-movables from ix86 optimization flags as for gcc 4 compliance. Bumped to version 0.100.7. Signed-off-by: Rui Nuno Capela git-svn-id: svn+ssh://jackaudio.org/trunk/jack@926 0c269be4-1314-0410-8aa9-9f06e86f4224 --- configure.ac | 6 +- drivers/alsa/usx2y.c | 188 ++++++++++++++++--------------------------- jack.spec.in | 45 ++++++----- jack/Makefile.am | 1 + 4 files changed, 100 insertions(+), 140 deletions(-) diff --git a/configure.ac b/configure.ac index 7ca6d4e..52d401c 100644 --- a/configure.ac +++ b/configure.ac @@ -15,7 +15,7 @@ dnl changes are made dnl --- JACK_MAJOR_VERSION=0 JACK_MINOR_VERSION=100 -JACK_MICRO_VERSION=6 +JACK_MICRO_VERSION=7 dnl --- dnl HOWTO: updating the jack protocol version @@ -254,7 +254,7 @@ if test "x$enable_mmx" = xyes; then fi AC_DEFINE(x86, 1, "Nope it's intel") - COMMON_X86_OPT_FLAGS="-DREENTRANT -O3 -fomit-frame-pointer -ffast-math -funroll-loops -fmove-all-movables" + COMMON_X86_OPT_FLAGS="-DREENTRANT -O3 -fomit-frame-pointer -ffast-math -funroll-loops" if test "$target_cpu" = "i586"; then JACK_OPT_CFLAGS="-march=i586 " @@ -267,7 +267,7 @@ if test "x$enable_mmx" = xyes; then JACK_OPT_CFLAGS="$COMMON_X86_OPT_FLAGS $JACK_OPT_CFLAGS $MMX_FLAGS $SSE_FLAGS" elif test "$target_cpu" = "x86_64"; then - JACK_OPT_CFLAGS="-DREENTRANT -O3 -march=k8 -fomit-frame-pointer -ffast-math -funroll-loops -fmove-all-movables" + JACK_OPT_CFLAGS="-DREENTRANT -O3 -march=k8 -fomit-frame-pointer -ffast-math -funroll-loops" fi AC_ARG_ENABLE(dynsimd, diff --git a/drivers/alsa/usx2y.c b/drivers/alsa/usx2y.c index ef9c4f5..c6e3e7a 100644 --- a/drivers/alsa/usx2y.c +++ b/drivers/alsa/usx2y.c @@ -1,6 +1,6 @@ /* Copyright (C) 2001 Paul Davis - Copyright (C) 2004 Karsten Wiese, Rui Nuno Capela + Copyright (C) 2005 Karsten Wiese, Rui Nuno Capela This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -465,9 +465,9 @@ usx2y_driver_null_cycle (alsa_driver_t* driver, jack_nframes_t nframes) static int usx2y_driver_read (alsa_driver_t *driver, jack_nframes_t nframes) { - snd_pcm_sframes_t contiguous; + snd_pcm_uframes_t contiguous; snd_pcm_sframes_t nread; - snd_pcm_sframes_t offset; + snd_pcm_uframes_t offset; jack_default_audio_sample_t* buf[4]; channel_t chn; JSList *node; @@ -480,61 +480,55 @@ usx2y_driver_read (alsa_driver_t *driver, jack_nframes_t nframes) } nread = 0; - contiguous = 0; - while (nframes) { + if (snd_pcm_mmap_begin (driver->capture_handle, + &driver->capture_areas, + &offset, &nframes_) < 0) { + jack_error ("ALSA/USX2Y: %s: mmap areas info error", + driver->alsa_name_capture); + return -1; + } - contiguous = (nframes > driver->frames_per_cycle) ? - driver->frames_per_cycle : nframes; + for (chn = 0, node = driver->capture_ports; + node; node = jack_slist_next (node), chn++) { + port = (jack_port_t *) node->data; + if (!jack_port_connected (port)) { + continue; + } + buf[chn] = jack_port_get_buffer (port, nframes_); + } + + while (nframes) { - if (snd_pcm_mmap_begin ( - driver->capture_handle, &driver->capture_areas, - (snd_pcm_uframes_t *) &offset, - (snd_pcm_uframes_t *) &nframes_) < 0) { - jack_error ("ALSA/USX2Y: %s: mmap areas info error", - driver->alsa_name_capture); + contiguous = nframes; + if (usx2y_driver_get_channel_addresses_capture ( + driver, &contiguous) < 0) { return -1; } - for (chn = 0, node = driver->capture_ports; - node && chn < 4; - node = jack_slist_next (node), chn++) { + node; node = jack_slist_next (node), chn++) { port = (jack_port_t *) node->data; if (!jack_port_connected (port)) { + /* no-copy optimization */ continue; } - buf[chn] = jack_port_get_buffer (port, nframes_); - } - - while (nframes) { - contiguous = nframes; - if (usx2y_driver_get_channel_addresses_capture ( - driver, &contiguous) < 0) { - return -1; - } - for (chn = 0, node = driver->capture_ports; - node && chn < 4; - node = jack_slist_next (node), chn++) { - port = (jack_port_t *) node->data; - if (!jack_port_connected (port)) { - /* no-copy optimization */ - continue; - } - alsa_driver_read_from_channel (driver, chn, - buf[chn] + nread, contiguous); - } - nread += contiguous; - nframes -= contiguous; - } - - if ((err = snd_pcm_mmap_commit (driver->capture_handle, - offset, nframes_)) < 0) { - jack_error ("ALSA/USX2Y: could not complete read of %" - PRIu32 " frames: error = %d", nframes_, err); - return -1; + alsa_driver_read_from_channel (driver, chn, + buf[chn] + nread, + contiguous); +/* sample_move_dS_s24(buf[chn] + nread, */ +/* driver->capture_addr[chn], */ +/* contiguous, */ +/* driver->capture_interleave_skip); */ } + nread += contiguous; + nframes -= contiguous; + } -// nframes -= contiguous; + if ((err = snd_pcm_mmap_commit (driver->capture_handle, + offset, nframes_)) < 0) { + jack_error ("ALSA/USX2Y: could not complete read of %" + PRIu32 " frames: error = %d", nframes_, err); + return -1; } return 0; @@ -547,11 +541,10 @@ usx2y_driver_write (alsa_driver_t* driver, jack_nframes_t nframes) JSList *node; jack_default_audio_sample_t* buf[2]; snd_pcm_sframes_t nwritten; - snd_pcm_sframes_t contiguous; - snd_pcm_sframes_t offset; + snd_pcm_uframes_t contiguous; + snd_pcm_uframes_t offset; jack_port_t *port; int err; - int dbg_loops = 1; snd_pcm_uframes_t nframes_ = nframes; driver->process_count++; @@ -561,7 +554,6 @@ usx2y_driver_write (alsa_driver_t* driver, jack_nframes_t nframes) } nwritten = 0; - contiguous = 0; /* check current input monitor request status */ @@ -583,83 +575,45 @@ usx2y_driver_write (alsa_driver_t* driver, jack_nframes_t nframes) } } - while (nframes) { + if (snd_pcm_mmap_begin(driver->playback_handle, + &driver->playback_areas, + &offset, &nframes_) < 0) { + jack_error ("ALSA/USX2Y: %s: mmap areas info error", + driver->alsa_name_capture); + return -1; + } - if (--dbg_loops) - return dbg_loops; + for (chn = 0, node = driver->playback_ports; + node; node = jack_slist_next (node), chn++) { + port = (jack_port_t *) node->data; + buf[chn] = jack_port_get_buffer (port, nframes_); + } - contiguous = (nframes > driver->frames_per_cycle) ? - driver->frames_per_cycle : nframes; + while (nframes) { - if (snd_pcm_mmap_begin( - driver->playback_handle, &driver->playback_areas, - &offset, &nframes_) < 0) { - jack_error ("ALSA/USX2Y: %s: mmap areas info error", - driver->alsa_name_capture); + contiguous = nframes; + if (usx2y_driver_get_channel_addresses_playback ( + driver, &contiguous) < 0) { return -1; } - for (chn = 0, node = driver->playback_ports; - node && chn < 2; - node = jack_slist_next (node), chn++) { + node; node = jack_slist_next (node), chn++) { port = (jack_port_t *) node->data; - if (!jack_port_connected (port)) { - continue; - } - buf[chn] = jack_port_get_buffer (port, nframes_); + alsa_driver_write_to_channel (driver, chn, + buf[chn] + nwritten, + contiguous); } - - while (nframes) { - contiguous = nframes; - if (usx2y_driver_get_channel_addresses_playback ( - driver, &contiguous) < 0) { - return -1; - } - for (chn = 0, node = driver->playback_ports; - node && chn < 2; - node = jack_slist_next (node), chn++) { - port = (jack_port_t *) node->data; - if (!jack_port_connected (port)) { - continue; - } - alsa_driver_write_to_channel (driver, chn, - buf[chn] + nwritten, - contiguous); - } - nwritten += contiguous; - if (driver->channels_not_done) { - alsa_driver_silence_untouched_channels (driver, - contiguous); - } - nframes -= contiguous; - } - - if ((err = snd_pcm_mmap_commit (driver->playback_handle, - offset, nframes_)) < 0) { - jack_error ("ALSA/USX2Y: could not complete playback of %" - PRIu32 " frames: error = %d", nframes_, err); - if (err != EPIPE && err != ESTRPIPE) - return -1; - } -// nframes -= contiguous; + nwritten += contiguous; + nframes -= contiguous; } -/* { */ -/* usx2y_t *h = (usx2y_t *) driver->hw->private; */ -/* unsigned *pu = (unsigned *)h->hwdep_pcm_shm->playback; */ -/* int i = sizeof(h->hwdep_pcm_shm->playback) / sizeof(*pu); */ - -/* while (i) { */ -/* if (*(pu)) { */ -/* jack_error("%p;error %u(=0x%X)@%p", */ -/* h->hwdep_pcm_shm->playback, */ -/* *pu, *pu, pu); */ -/* return -1; */ -/* } */ -/* --i; */ -/* ++pu; */ -/* } */ -/* } */ + if ((err = snd_pcm_mmap_commit (driver->playback_handle, + offset, nframes_)) < 0) { + jack_error ("ALSA/USX2Y: could not complete playback of %" + PRIu32 " frames: error = %d", nframes_, err); + if (err != EPIPE && err != ESTRPIPE) + return -1; + } return 0; } diff --git a/jack.spec.in b/jack.spec.in index 17c787f..8fd4c2f 100644 --- a/jack.spec.in +++ b/jack.spec.in @@ -1,8 +1,10 @@ # $Id$ # set to 0 to build rpms without capabilities support -%define enable_capabilities 1 -# set to 1 to enable alternate jack temporary directory -# mounted as tmpfs +%define enable_capabilities 0 +# strip binaries +%define strip_jackd 0 +# set to 1 to enable alternate jack temporary +# directory mounted as tmpfs %define enable_tmpdir 1 %if %{enable_tmpdir} %define jack_tmpdir /var/lib/jack/tmp @@ -11,21 +13,19 @@ %define port_audio 0 # use oss %define oss 1 -# strip binaries -%define strip_jackd 1 -# use premmption check -%define preemption_check 1 +# use preemption check +%define preemption_check 0 Summary: the Jack Audio Connection Kit Name: @PACKAGE@ Version: @VERSION@ -Release: 1 +Release: 2 License: GPL Group: System Environment/Daemons Source0: %{name}-%{version}.tar.gz URL: http://jackit.sourceforge.net -BuildRoot: %{_tmppath}/%{name}-%{version}-root-%(id -u -n) +BuildRoot: %{_tmppath}/%{name}-%{version}-root-%(id -u -n) BuildRequires: automake >= 1.6 libsndfile-devel >= 1.0.0 @@ -66,25 +66,26 @@ Small example clients that use the Jack Audio Connection Kit. %setup -q %build -%configure --enable-optimize \ -%if %{enable_tmpdir} - --with-default-tmpdir=%{jack_tmpdir} \ -%endif +%configure \ %if %{enable_capabilities} - --enable-capabilities \ + --enable-capabilities \ +%if %{strip_jackd} + --enable-stripped-jackd \ %endif -%if %{preemption_check} - --enable-preemption-check \ +%endif +%if %{enable_tmpdir} + --with-default-tmpdir=%{jack_tmpdir} \ %endif %if ! %{port_audio} - --disable-portaudio \ + --disable-portaudio \ %endif %if ! %{oss} - --disable-oss \ + --disable-oss \ %endif -%if %{strip_jackd} - --enable-stripped-jackd +%if %{preemption_check} + --enable-preemption-check \ %endif + --enable-optimize make @@ -241,6 +242,10 @@ fi %changelog +* Thu Oct 30 2005 Rui Nuno Capela - 0.100.7-2 +- omitted enable-capabilities, stripped-binaries and preemption + check from default. + * Thu Jan 3 2005 Rui Nuno Capela - 0.99.44-1 - add jack/statistics.h to devel package diff --git a/jack/Makefile.am b/jack/Makefile.am index 48d9cd9..82f3960 100644 --- a/jack/Makefile.am +++ b/jack/Makefile.am @@ -21,6 +21,7 @@ noinst_HEADERS = \ engine.h \ hardware.h \ internal.h \ + intsimd.h \ jslist.h \ memops.h \ messagebuffer.h \