From af186bbbeb88bb99f628e226823771e3fda36a9d Mon Sep 17 00:00:00 2001 From: pbd Date: Sat, 5 Apr 2003 16:34:26 +0000 Subject: [PATCH] new driver design, part II git-svn-id: svn+ssh://jackaudio.org/trunk/jack@367 0c269be4-1314-0410-8aa9-9f06e86f4224 --- jack/driver.h | 21 +++++++++++++++++++++ jackd/engine.c | 6 +++--- 2 files changed, 24 insertions(+), 3 deletions(-) diff --git a/jack/driver.h b/jack/driver.h index 6ed9da8..338bb84 100644 --- a/jack/driver.h +++ b/jack/driver.h @@ -65,6 +65,7 @@ typedef jack_nframes_t (*JackDriverWaitFunction)(struct _jack_driver *, int fd, 3) engine starts driver 4) while (1) { engine->wait (); + engine->audio_cycle (); } 5) engine stops driver 6) engine detaches from driver @@ -135,10 +136,30 @@ typedef jack_nframes_t (*JackDriverWaitFunction)(struct _jack_driver *, int fd, JackDriverWaitFunction wait; +/* the JACK engine will call this to ask the driver to move + data from its inputs to its output port buffers. it should + return 0 to indicate successful completion, negative otherwise. + + this function will always be called after the wait function (above). +*/ + JackDriverReadFunction read; +/* the JACK engine will call this to ask the driver to move + data from its input port buffers to its outputs. it should + return 0 to indicate successful completion, negative otherwise. + + this function will always be called after the read function (above). +*/ JackDriverWriteFunction write; +/* the JACK engine will call this after the wait function (above) has + been called, but for some reason the engine is unable to execute + a full "cycle". the driver should do whatever is necessary to + keep itself running correctly, but cannot reference ports + or other JACK data structures in any way. +*/ + JackDriverNullCycleFunction null_cycle; /* the engine will call this when it plans to stop calling the `wait' diff --git a/jackd/engine.c b/jackd/engine.c index 0dd3822..6d4b701 100644 --- a/jackd/engine.c +++ b/jackd/engine.c @@ -2069,7 +2069,7 @@ jack_engine_wait (jack_engine_t *engine, jack_nframes_t* nframes) } static int -jack_audio_cycle (jack_engine_t *engine, jack_nframes_t nframes) +jack_run_cycle (jack_engine_t *engine, jack_nframes_t nframes) { int ret; jack_driver_t* driver = engine->driver; @@ -2137,8 +2137,8 @@ jack_main_thread (void *arg) } else if (wait_status == 0) { - if (jack_audio_cycle (engine, nframes)) { - jack_error ("audio cycle failure, exiting"); + if (jack_run_cycle (engine, nframes)) { + jack_error ("cycle execution failure, exiting"); break; }