diff --git a/configure.in b/configure.in index ab8c427..dae325e 100644 --- a/configure.in +++ b/configure.in @@ -14,7 +14,7 @@ dnl changes are made dnl --- JACK_MAJOR_VERSION=0 JACK_MINOR_VERSION=74 -JACK_MICRO_VERSION=1 +JACK_MICRO_VERSION=2 dnl --- dnl HOWTO: updating the jack protocal version @@ -164,6 +164,16 @@ AC_ARG_ENABLE(capabilities, ] ) +with_oldtrans=yes +AC_ARG_ENABLE(oldtrans, + [ --disable-oldtrans remove old transport interfaces], + [ if test "x$enable_oldtrans" = "xno" ; then + with_oldtrans=no + fi ]) +if test "x$with_oldtrans" != "xno" ; then + AC_DEFINE(OLD_TRANSPORT,,[Include old transport interfaces]) +fi + STRIPPED_JACKD=false AC_ARG_ENABLE(stripped-jackd, [ --enable-stripped-jackd strip jack before computing its md5 sum ], diff --git a/jackd/Makefile.am b/jackd/Makefile.am index c13af77..ba00ff2 100644 --- a/jackd/Makefile.am +++ b/jackd/Makefile.am @@ -23,7 +23,7 @@ bin_PROGRAMS = jackd $(CAP_PROGS) AM_CFLAGS = $(JACK_CFLAGS) -DJACKD_LOCATION=\"$(bindir)/jackd\" -jackd_SOURCES = jackd.c engine.c +jackd_SOURCES = jackd.c engine.c transengine.c jackd_LDADD = ../libjack/libjack.la -lm -ldl -lrt -lpthread $(CAP_LIBS) noinst_HEADERS = jack_md5.h md5.h md5_loc.h diff --git a/jackd/engine.c b/jackd/engine.c index f489c92..bce9995 100644 --- a/jackd/engine.c +++ b/jackd/engine.c @@ -59,6 +59,8 @@ #include #endif +#include "transengine.h" + #define JACK_ERROR_WITH_SOCKETS 10000000 typedef struct { @@ -395,14 +397,6 @@ jack_set_buffer_size (jack_engine_t *engine, jack_nframes_t nframes) return 0; } -static int -jack_set_sample_rate (jack_engine_t *engine, jack_nframes_t nframes) -{ - engine->control->current_time.frame_rate = nframes; - engine->control->pending_time.frame_rate = nframes; - return 0; -} - static JSList * jack_process_internal(jack_engine_t *engine, JSList *node, jack_nframes_t nframes) { @@ -711,19 +705,6 @@ jack_remove_clients (jack_engine_t* engine) jack_engine_reset_rolling_usecs (engine); } -static void -jack_reset_transport (jack_engine_t *engine) -{ - engine->control->current_time.frame = 0; - engine->control->pending_time.frame = 0; - engine->control->current_time.transport_state = JackTransportStopped; - engine->control->pending_time.transport_state = JackTransportStopped; - engine->control->current_time.valid = - JackTransportState|JackTransportPosition; - engine->control->pending_time.valid = - JackTransportState|JackTransportPosition; -} - static void jack_engine_post_process (jack_engine_t *engine) { @@ -732,13 +713,7 @@ jack_engine_post_process (jack_engine_t *engine) JSList *node; int need_remove = FALSE; - /* maintain the current_time.usecs and frame_rate values, since clients - are not permitted to set these. - */ - - engine->control->pending_time.usecs = engine->control->current_time.usecs; - engine->control->pending_time.frame_rate = engine->control->current_time.frame_rate; - engine->control->current_time = engine->control->pending_time; + jack_transport_cycle_end (engine); /* find any clients that need removal due to timeouts, etc. */ @@ -1363,7 +1338,7 @@ jack_client_deactivate (jack_engine_t *engine, jack_client_id_t id) if (client == engine->timebase_client) { engine->timebase_client = 0; - jack_reset_transport (engine); + jack_transport_reset (engine); } for (portnode = client->ports; portnode; portnode = jack_slist_next (portnode)) { @@ -1828,9 +1803,8 @@ jack_engine_new (int realtime, int rtpriority, int verbose, int client_timeout) engine->control->cpu_load = 0; engine->control->buffer_size = 0; - engine->control->current_time.frame_rate = 0; - engine->control->pending_time.frame_rate = 0; - jack_reset_transport (engine); + jack_set_sample_rate (engine, 0); + jack_transport_reset (engine); engine->control->internal = 0; engine->control->has_capabilities = 0; @@ -2337,7 +2311,7 @@ jack_zombify_client (jack_engine_t *engine, jack_client_internal_t *client) if (client == engine->timebase_client) { engine->timebase_client = 0; - jack_reset_transport (engine); + jack_transport_reset (engine); } jack_client_disconnect (engine, client); diff --git a/jackd/transengine.c b/jackd/transengine.c new file mode 100644 index 0000000..a12c62a --- /dev/null +++ b/jackd/transengine.c @@ -0,0 +1,63 @@ +/* + JACK transport engine -- runs in the server process. + + Copyright (C) 2001-2003 Paul Davis + Copyright (C) 2003 Jack O'Quin + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as published by + the Free Software Foundation; either version 2.1 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ + +#include +#include +#include +#include "transengine.h" + +int +jack_set_sample_rate (jack_engine_t *engine, jack_nframes_t nframes) +{ + engine->control->current_time.frame_rate = nframes; + engine->control->pending_time.frame_rate = nframes; + return 0; +} + +void +jack_transport_cycle_end (jack_engine_t *engine) +{ + jack_control_t *ctl = engine->control; + + /* maintain the current_time.usecs and frame_rate values, + since clients are not permitted to set them. + */ + ctl->pending_time.usecs = ctl->current_time.usecs; + ctl->pending_time.frame_rate = ctl->current_time.frame_rate; + ctl->current_time = ctl->pending_time; +} + +void +jack_transport_reset (jack_engine_t *engine) +{ +#ifdef OLD_TRANSPORT + jack_control_t *ctl = engine->control; + + ctl->current_time.frame = 0; + ctl->pending_time.frame = 0; + ctl->current_time.transport_state = JackTransportStopped; + ctl->pending_time.transport_state = JackTransportStopped; + ctl->current_time.valid = + JackTransportState|JackTransportPosition; + ctl->pending_time.valid = + JackTransportState|JackTransportPosition; +#endif /* OLD_TRANSPORT */ +} diff --git a/jackd/transengine.h b/jackd/transengine.h new file mode 100644 index 0000000..a812913 --- /dev/null +++ b/jackd/transengine.h @@ -0,0 +1,24 @@ +/* + Internal interfaces to JACK transport engine. + + Copyright (C) 2003 Jack O'Quin + + 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 + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +int jack_set_sample_rate (jack_engine_t *engine, + jack_nframes_t nframes); +void jack_transport_cycle_end (jack_engine_t *engine); +void jack_transport_reset (jack_engine_t *engine); diff --git a/libjack/Makefile.am b/libjack/Makefile.am index 73b4ff1..6ff53c8 100644 --- a/libjack/Makefile.am +++ b/libjack/Makefile.am @@ -6,7 +6,8 @@ SOURCE_FILES = \ driver.c \ pool.c \ port.c \ - timestamps.c + timestamps.c \ + transclient.c lib_LTLIBRARIES = libjack.la diff --git a/libjack/client.c b/libjack/client.c index 703b5ad..535438a 100644 --- a/libjack/client.c +++ b/libjack/client.c @@ -1332,18 +1332,6 @@ jack_disconnect (jack_client_t *client, const char *source_port, const char *des return jack_client_deliver_request (client, &req); } -int -jack_engine_takeover_timebase (jack_client_t *client) - -{ - jack_request_t req; - - req.type = SetTimeBaseClient; - req.x.client_id = client->control->id; - - return jack_client_deliver_request (client, &req); -} - void jack_set_error_function (void (*func) (const char *)) { @@ -1567,23 +1555,6 @@ jack_frame_time (const jack_client_t *client) return current.frames + elapsed; } - -/* TRANSPORT CONTROL */ - -void -jack_get_transport_info (jack_client_t *client, - jack_transport_info_t *info) -{ - *info = client->engine->current_time; -} - -void -jack_set_transport_info (jack_client_t *client, - jack_transport_info_t *info) -{ - client->engine->pending_time = *info; -} - float jack_cpu_load (jack_client_t *client) { diff --git a/libjack/transclient.c b/libjack/transclient.c new file mode 100644 index 0000000..26fa4f8 --- /dev/null +++ b/libjack/transclient.c @@ -0,0 +1,57 @@ +/* + JACK transport client interface -- runs in the client process. + + Copyright (C) 2001-2003 Paul Davis + Copyright (C) 2003 Jack O'Quin + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as published by + the Free Software Foundation; either version 2.1 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ + +#include +#include +#include "local.h" + + +#ifdef OLD_TRANSPORT + +/* * * API functions for compatibility with old transport interface * * */ + +int +jack_engine_takeover_timebase (jack_client_t *client) + +{ + jack_request_t req; + + req.type = SetTimeBaseClient; + req.x.client_id = client->control->id; + + return jack_client_deliver_request (client, &req); +} + +void +jack_get_transport_info (jack_client_t *client, + jack_transport_info_t *info) +{ + *info = client->engine->current_time; +} + +void +jack_set_transport_info (jack_client_t *client, + jack_transport_info_t *info) +{ + client->engine->pending_time = *info; +} + +#endif /* OLD_TRANSPORT */