diff --git a/corelib/JacksRbClient.h b/corelib/JacksRbClient.h index 9e31df0..b4cfdb5 100644 --- a/corelib/JacksRbClient.h +++ b/corelib/JacksRbClient.h @@ -24,6 +24,7 @@ extern "C" { #include "config.h" #include "JacksEvent.h" +#include "JacksRbPort.h" #include #include #include @@ -61,6 +62,8 @@ extern char *JacksRbClient_get_name(T); extern jack_nframes_t JacksRbClient_get_rb_size(T); +extern JacksRbPort JacksRbClient_registerPort(T, char *, unsigned long); + #undef T #endif diff --git a/corelib/JacksRbPort.c b/corelib/JacksRbPort.c index eae4cbb..e66e769 100644 --- a/corelib/JacksRbPort.c +++ b/corelib/JacksRbPort.c @@ -17,14 +17,15 @@ */ #include "config.h" -#include "JacksRbPort.h" #include "JacksRbClient.h" +#include "JacksRbPort.h" #include #include #include #include #include #include +#include #include #include #include @@ -34,7 +35,9 @@ #define T JacksRbPort struct T { - int lat_cb_fd[2]; + int playback_lat_cb_fd[2]; + int capture_lat_cb_fd[2]; + bool lat_cb_is_init; jack_nframes_t rb_size; jack_port_t *jport; JacksRbClient jackclient; @@ -47,7 +50,10 @@ struct T { const size_t jacks_sample_size = sizeof(jack_default_audio_sample_t); // contructor/wrapper for existing ports the user looks up -T JacksRbPort_new(jack_port_t *jport, JacksRbClient jackclient, jack_nframes_t rb_size) { +//T JacksRbPort_new(jack_port_t *jport, JacksRbClient jackclient, jack_nframes_t rb_size) { +T JacksRbPort_new(jack_port_t *jport, void * jackclientp, jack_nframes_t rb_size) { + + JacksRbClient jackclient = (JacksRbClient) jackclientp; T _this_ = malloc(sizeof *_this_); if (_this_ == NULL) { @@ -55,10 +61,13 @@ T JacksRbPort_new(jack_port_t *jport, JacksRbClient jackclient, jack_nframes_t r return NULL; } + _this_->lat_cb_is_init = false; _this_->rb_size = rb_size; _this_->jport = jport; - _this_->lat_cb_fd[0] = 0; - _this_->lat_cb_fd[1] = 0; + _this_->capture_lat_cb_fd[0] = 0; + _this_->capture_lat_cb_fd[1] = 0; + _this_->playback_lat_cb_fd[0] = 0; + _this_->playback_lat_cb_fd[1] = 0; _this_->jackclient = jackclient; _this_->framebuf = malloc(rb_size); @@ -69,9 +78,10 @@ T JacksRbPort_new(jack_port_t *jport, JacksRbClient jackclient, jack_nframes_t r // contstructor for ports the user creates T JacksRbPort_new_port(const char *name, unsigned long options, - JacksRbClient jackclient, + void * jackclientp, jack_nframes_t rb_size) { + JacksRbClient jackclient = (JacksRbClient) jackclientp; //todo: midi option jack_port_t *jport = jack_port_register(JacksRbClient_get_client(jackclient), name, JACK_DEFAULT_AUDIO_TYPE, options, 0); @@ -86,49 +96,88 @@ void JacksRbPort_free(T *_this_p_) { free(_this_); } -static void JacksRbPort_latency_listener_fd(jack_latency_callback_mode_t mode, void *arg) { +static void latency_listener_fd(jack_latency_callback_mode_t mode, void *arg) { T _this_ = (T) arg; - write(_this_->lat_cb_fd[0], "b", 1); + if (mode == JackCaptureLatency) { + if (_this_->capture_lat_cb_fd[0] != 0) { + int rc = write(_this_->capture_lat_cb_fd[0], "b", 1); + } + } else if (mode == JackPlaybackLatency) { + if (_this_->playback_lat_cb_fd[0] != 0) { + int rc = write(_this_->playback_lat_cb_fd[0], "b", 1); + } + } else { + fprintf (stderr, "ERROR! unknown latency mode\n"); + } } -static void JacksRbPort_latency_listener(jack_latency_callback_mode_t mode, void *arg) { + +static void latency_listener(jack_latency_callback_mode_t mode, void *arg) { T _this_ = (T) arg; raise(SIGUSR2); } -void JacksRbPort_wakeup_fd(T _this_) { - JacksRbPort_latency_listener_fd(0, _this_); +void JacksRbPort_wakeup_latency_callbacks(T _this_) { + latency_listener_fd(JackPlaybackLatency, _this_); + latency_listener_fd(JackCaptureLatency, _this_); +} +void JacksRbPort_wakeup_sig_latency_cb(T _this_) { + latency_listener(0, _this_); } -void JacksRbPort_wakeup(T _this_) { - JacksRbPort_latency_listener(0, _this_); + +//register latency callback +static int register_lat_cb(T _this_) { + int rc = jack_set_latency_callback( + JacksRbClient_get_client(_this_->jackclient), + latency_listener_fd, + _this_); + if (rc != 0) { + fprintf (stderr, "set latency fd callback failed\n"); + } else { + _this_->lat_cb_is_init = true; + fprintf (stderr, "fd latency callback is set\n"); + } + return rc; } -int JacksRbPort_init_latency_listener_fd(T _this_) { +int JacksRbPort_init_capture_latency_listener(T _this_) { - //fail if fd already set - if (_this_->lat_cb_fd[0] != 0) { - fprintf (stderr, "latency callback allready registered\n"); - return -1; + if (_this_->capture_lat_cb_fd[1] != 0) { + fprintf (stderr, "capture latency fd already init\n"); + return _this_->capture_lat_cb_fd[1]; } - int rc = socketpair(AF_UNIX, SOCK_STREAM, 0, _this_->lat_cb_fd); + int rc = socketpair(AF_UNIX, SOCK_STREAM, 0, _this_->capture_lat_cb_fd); if (rc != 0) { fprintf (stderr, "init unix domain socket pair failed\n"); return -1; } - //register latency callback - rc = jack_set_latency_callback( - JacksRbClient_get_client(_this_->jackclient), - JacksRbPort_latency_listener_fd, - _this_); - if (rc != 0) { + if (!_this_->lat_cb_is_init && register_lat_cb(_this_) != 0) { fprintf (stderr, "set latency fd callback failed\n"); return -1; } + return _this_->capture_lat_cb_fd[1]; +} + +int JacksRbPort_init_playback_latency_listener(T _this_) { + + if (_this_->playback_lat_cb_fd[1] != 0) { + fprintf (stderr, "playback latency fd already init\n"); + return _this_->playback_lat_cb_fd[1]; + } - fprintf (stderr, "fd latency callback is set\n"); - return _this_->lat_cb_fd[1]; + int rc = socketpair(AF_UNIX, SOCK_STREAM, 0, _this_->playback_lat_cb_fd); + if (rc != 0) { + fprintf (stderr, "init unix domain socket pair failed\n"); + return -1; + } + + if (!_this_->lat_cb_is_init && register_lat_cb(_this_) != 0) { + fprintf (stderr, "set latency fd callback failed\n"); + return -1; + } + return _this_->playback_lat_cb_fd[1]; } int JacksRbPort_init_latency_listener(T _this_) { @@ -136,7 +185,7 @@ int JacksRbPort_init_latency_listener(T _this_) { //register latency callback int rc = jack_set_latency_callback( JacksRbClient_get_client(_this_->jackclient), - JacksRbPort_latency_listener, + latency_listener, _this_); if (rc != 0) { fprintf (stderr, "set latency callback failed\n"); diff --git a/corelib/JacksRbPort.h b/corelib/JacksRbPort.h index 828b3cd..b0562df 100644 --- a/corelib/JacksRbPort.h +++ b/corelib/JacksRbPort.h @@ -24,17 +24,18 @@ extern "C" { #define _JS_RB_PORT_H_ #include "config.h" -#include "JacksRbClient.h" +//#include "JacksRbClient.h" #include #include #define T JacksRbPort typedef struct T *T; -extern T JacksRbPort_new(jack_port_t *, JacksRbClient, jack_nframes_t); +//extern T JacksRbPort_new(jack_port_t *, JacksRbClient, jack_nframes_t); +extern T JacksRbPort_new(jack_port_t *, void *, jack_nframes_t); -extern T JacksRbPort_new_port(const char *, - unsigned long, JacksRbClient, jack_nframes_t); +//extern T JacksRbPort_new_port(const char *, unsigned long, JacksRbClient, jack_nframes_t); +extern T JacksRbPort_new_port(const char *, unsigned long, void *, jack_nframes_t); extern void JacksRbPort_free(T *); @@ -42,15 +43,16 @@ extern int JacksRbPort_connect(T, T); extern int JacksRbPort_write_to_ringbuffer(T, jack_nframes_t); -extern sample_t* JacksRbPort_read_from_ringbuffer(T, int*); +extern jack_default_audio_sample_t* JacksRbPort_read_from_ringbuffer(T, int*); extern void* JacksRbPort_get_port(T); extern int JacksRbPort_init_latency_listener(T); -extern int JacksRbPort_init_latency_listener_fd(T); +extern int JacksRbPort_init_capture_latency_listener(T); +extern int JacksRbPort_init_playback_latency_listener(T); -extern void JacksRbPort_wakeup(T); //ejs test -extern void JacksRbPort_wakeup_fd(T); //ejs test +extern void JacksRbPort_wakeup_sig_latency_cb(T); //ejs test +extern void JacksRbPort_wakeup_latency_callbacks(T); //ejs test #undef T #endif diff --git a/modules/Jacks.i b/modules/Jacks.i index 57dee12..4ec38bf 100644 --- a/modules/Jacks.i +++ b/modules/Jacks.i @@ -144,6 +144,7 @@ typedef struct { int rc = JacksRbPort_connect($self->impl, _that_->impl); if (rc) throw_exception("can not connect ports"); + return rc; } JsLatencyRange *getLatencyRange(enum JackLatencyCallbackMode mode) { @@ -166,17 +167,23 @@ typedef struct { jack_port_set_latency_range((jack_port_t *) JacksRbPort_get_port($self->impl), mode, &range); } - void wakeupFd() { - JacksRbPort_wakeup_fd($self->impl); + void wakeupLatencyCallbacks() { + JacksRbPort_wakeup_latency_callbacks($self->impl); + } + void wakeupSigLatencyCallback() { + JacksRbPort_wakeup_sig_latency_cb($self->impl); } - void wakeup() { - JacksRbPort_wakeup($self->impl); + int initCaptureLatencyListener() { + + int fd = JacksRbPort_init_capture_latency_listener($self->impl); + if (fd < 0) throw_exception("can not init capture latency callback"); + return fd; } - int initLatencyListenerFd() { + int initPlaybackLatencyListener() { - int fd = JacksRbPort_init_latency_listener_fd($self->impl); - if (fd < 0) throw_exception("can not init fd latency callback"); - return fd; //note, I doubt this will work... just stubbing it out for now. + int fd = JacksRbPort_init_playback_latency_listener($self->impl); + if (fd < 0) throw_exception("can not init playback latency callback"); + return fd; } int initLatencyListener() { diff --git a/modules/lua/Jacks_lua_wrap.c b/modules/lua/Jacks_lua_wrap.c index ef82da0..af67801 100644 --- a/modules/lua/Jacks_lua_wrap.c +++ b/modules/lua/Jacks_lua_wrap.c @@ -1615,6 +1615,7 @@ SWIGINTERN int JsPort_connect(JsPort *self,JsPort *_that_){ int rc = JacksRbPort_connect(self->impl, _that_->impl); if (rc) throw_exception("can not connect ports"); + return rc; } SWIGINTERN JsLatencyRange *JsPort_getLatencyRange(JsPort *self,enum JackLatencyCallbackMode mode){ @@ -1636,17 +1637,23 @@ SWIGINTERN void JsPort_setLatencyRange(JsPort *self,enum JackLatencyCallbackMode jack_port_set_latency_range((jack_port_t *) JacksRbPort_get_port(self->impl), mode, &range); } -SWIGINTERN void JsPort_wakeupFd(JsPort *self){ - JacksRbPort_wakeup_fd(self->impl); +SWIGINTERN void JsPort_wakeupLatencyCallbacks(JsPort *self){ + JacksRbPort_wakeup_latency_callbacks(self->impl); + } +SWIGINTERN void JsPort_wakeupSigLatencyCallback(JsPort *self){ + JacksRbPort_wakeup_sig_latency_cb(self->impl); } -SWIGINTERN void JsPort_wakeup(JsPort *self){ - JacksRbPort_wakeup(self->impl); +SWIGINTERN int JsPort_initCaptureLatencyListener(JsPort *self){ + + int fd = JacksRbPort_init_capture_latency_listener(self->impl); + if (fd < 0) throw_exception("can not init capture latency callback"); + return fd; } -SWIGINTERN int JsPort_initLatencyListenerFd(JsPort *self){ +SWIGINTERN int JsPort_initPlaybackLatencyListener(JsPort *self){ - int fd = JacksRbPort_init_latency_listener_fd(self->impl); - if (fd < 0) throw_exception("can not init fd latency callback"); - return fd; //note, I doubt this will work... just stubbing it out for now. + int fd = JacksRbPort_init_playback_latency_listener(self->impl); + if (fd < 0) throw_exception("can not init playback latency callback"); + return fd; } SWIGINTERN int JsPort_initLatencyListener(JsPort *self){ @@ -2451,21 +2458,21 @@ static int _wrap_JsPort_setLatencyRange(lua_State* L) { } -static int _wrap_JsPort_wakeupFd(lua_State* L) { +static int _wrap_JsPort_wakeupLatencyCallbacks(lua_State* L) { int SWIG_arg = 0; JsPort *arg1 = (JsPort *) 0 ; - SWIG_check_num_args("JsPort::wakeupFd",1,1) - if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("JsPort::wakeupFd",1,"JsPort *"); + SWIG_check_num_args("JsPort::wakeupLatencyCallbacks",1,1) + if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("JsPort::wakeupLatencyCallbacks",1,"JsPort *"); if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_JsPort,0))){ - SWIG_fail_ptr("JsPort_wakeupFd",1,SWIGTYPE_p_JsPort); + SWIG_fail_ptr("JsPort_wakeupLatencyCallbacks",1,SWIGTYPE_p_JsPort); } { char *err; clear_exception(); - JsPort_wakeupFd(arg1); + JsPort_wakeupLatencyCallbacks(arg1); if ((err = check_exception())) { luaL_error(L, err); return -1; @@ -2486,21 +2493,21 @@ static int _wrap_JsPort_wakeupFd(lua_State* L) { } -static int _wrap_JsPort_wakeup(lua_State* L) { +static int _wrap_JsPort_wakeupSigLatencyCallback(lua_State* L) { int SWIG_arg = 0; JsPort *arg1 = (JsPort *) 0 ; - SWIG_check_num_args("JsPort::wakeup",1,1) - if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("JsPort::wakeup",1,"JsPort *"); + SWIG_check_num_args("JsPort::wakeupSigLatencyCallback",1,1) + if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("JsPort::wakeupSigLatencyCallback",1,"JsPort *"); if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_JsPort,0))){ - SWIG_fail_ptr("JsPort_wakeup",1,SWIGTYPE_p_JsPort); + SWIG_fail_ptr("JsPort_wakeupSigLatencyCallback",1,SWIGTYPE_p_JsPort); } { char *err; clear_exception(); - JsPort_wakeup(arg1); + JsPort_wakeupSigLatencyCallback(arg1); if ((err = check_exception())) { luaL_error(L, err); return -1; @@ -2521,22 +2528,58 @@ static int _wrap_JsPort_wakeup(lua_State* L) { } -static int _wrap_JsPort_initLatencyListenerFd(lua_State* L) { +static int _wrap_JsPort_initCaptureLatencyListener(lua_State* L) { + int SWIG_arg = 0; + JsPort *arg1 = (JsPort *) 0 ; + int result; + + SWIG_check_num_args("JsPort::initCaptureLatencyListener",1,1) + if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("JsPort::initCaptureLatencyListener",1,"JsPort *"); + + if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_JsPort,0))){ + SWIG_fail_ptr("JsPort_initCaptureLatencyListener",1,SWIGTYPE_p_JsPort); + } + + { + char *err; + clear_exception(); + result = (int)JsPort_initCaptureLatencyListener(arg1); + if ((err = check_exception())) { + luaL_error(L, err); + return -1; + + + + + } + } + lua_pushnumber(L, (lua_Number) result); SWIG_arg++; + return SWIG_arg; + + if(0) SWIG_fail; + +fail: + lua_error(L); + return SWIG_arg; +} + + +static int _wrap_JsPort_initPlaybackLatencyListener(lua_State* L) { int SWIG_arg = 0; JsPort *arg1 = (JsPort *) 0 ; int result; - SWIG_check_num_args("JsPort::initLatencyListenerFd",1,1) - if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("JsPort::initLatencyListenerFd",1,"JsPort *"); + SWIG_check_num_args("JsPort::initPlaybackLatencyListener",1,1) + if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("JsPort::initPlaybackLatencyListener",1,"JsPort *"); if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_JsPort,0))){ - SWIG_fail_ptr("JsPort_initLatencyListenerFd",1,SWIGTYPE_p_JsPort); + SWIG_fail_ptr("JsPort_initPlaybackLatencyListener",1,SWIGTYPE_p_JsPort); } { char *err; clear_exception(); - result = (int)JsPort_initLatencyListenerFd(arg1); + result = (int)JsPort_initPlaybackLatencyListener(arg1); if ((err = check_exception())) { luaL_error(L, err); return -1; @@ -2632,9 +2675,10 @@ static swig_lua_method swig_JsPort_methods[] = { {"connect", _wrap_JsPort_connect}, {"getLatencyRange", _wrap_JsPort_getLatencyRange}, {"setLatencyRange", _wrap_JsPort_setLatencyRange}, - {"wakeupFd", _wrap_JsPort_wakeupFd}, - {"wakeup", _wrap_JsPort_wakeup}, - {"initLatencyListenerFd", _wrap_JsPort_initLatencyListenerFd}, + {"wakeupLatencyCallbacks", _wrap_JsPort_wakeupLatencyCallbacks}, + {"wakeupSigLatencyCallback", _wrap_JsPort_wakeupSigLatencyCallback}, + {"initCaptureLatencyListener", _wrap_JsPort_initCaptureLatencyListener}, + {"initPlaybackLatencyListener", _wrap_JsPort_initPlaybackLatencyListener}, {"initLatencyListener", _wrap_JsPort_initLatencyListener}, {0,0} }; diff --git a/modules/perl/Jacks_perl5_wrap.c b/modules/perl/Jacks_perl5_wrap.c index 532e350..2a0552d 100644 --- a/modules/perl/Jacks_perl5_wrap.c +++ b/modules/perl/Jacks_perl5_wrap.c @@ -2009,6 +2009,7 @@ SWIGINTERN int JsPort_connect(JsPort *self,JsPort *_that_){ int rc = JacksRbPort_connect(self->impl, _that_->impl); if (rc) throw_exception("can not connect ports"); + return rc; } SWIGINTERN JsLatencyRange *JsPort_getLatencyRange(JsPort *self,enum JackLatencyCallbackMode mode){ @@ -2030,17 +2031,23 @@ SWIGINTERN void JsPort_setLatencyRange(JsPort *self,enum JackLatencyCallbackMode jack_port_set_latency_range((jack_port_t *) JacksRbPort_get_port(self->impl), mode, &range); } -SWIGINTERN void JsPort_wakeupFd(JsPort *self){ - JacksRbPort_wakeup_fd(self->impl); +SWIGINTERN void JsPort_wakeupLatencyCallbacks(JsPort *self){ + JacksRbPort_wakeup_latency_callbacks(self->impl); + } +SWIGINTERN void JsPort_wakeupSigLatencyCallback(JsPort *self){ + JacksRbPort_wakeup_sig_latency_cb(self->impl); } -SWIGINTERN void JsPort_wakeup(JsPort *self){ - JacksRbPort_wakeup(self->impl); +SWIGINTERN int JsPort_initCaptureLatencyListener(JsPort *self){ + + int fd = JacksRbPort_init_capture_latency_listener(self->impl); + if (fd < 0) throw_exception("can not init capture latency callback"); + return fd; } -SWIGINTERN int JsPort_initLatencyListenerFd(JsPort *self){ +SWIGINTERN int JsPort_initPlaybackLatencyListener(JsPort *self){ - int fd = JacksRbPort_init_latency_listener_fd(self->impl); - if (fd < 0) throw_exception("can not init fd latency callback"); - return fd; //note, I doubt this will work... just stubbing it out for now. + int fd = JacksRbPort_init_playback_latency_listener(self->impl); + if (fd < 0) throw_exception("can not init playback latency callback"); + return fd; } SWIGINTERN int JsPort_initLatencyListener(JsPort *self){ @@ -3311,7 +3318,7 @@ XS(_wrap_JsPort_setLatencyRange) { } -XS(_wrap_JsPort_wakeupFd) { +XS(_wrap_JsPort_wakeupLatencyCallbacks) { { JsPort *arg1 = (JsPort *) 0 ; void *argp1 = 0 ; @@ -3320,17 +3327,17 @@ XS(_wrap_JsPort_wakeupFd) { dXSARGS; if ((items < 1) || (items > 1)) { - SWIG_croak("Usage: JsPort_wakeupFd(self);"); + SWIG_croak("Usage: JsPort_wakeupLatencyCallbacks(self);"); } res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_JsPort, 0 | 0 ); if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "JsPort_wakeupFd" "', argument " "1"" of type '" "JsPort *""'"); + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "JsPort_wakeupLatencyCallbacks" "', argument " "1"" of type '" "JsPort *""'"); } arg1 = (JsPort *)(argp1); { char *err; clear_exception(); - JsPort_wakeupFd(arg1); + JsPort_wakeupLatencyCallbacks(arg1); if ((err = check_exception())) { croak(CROAK, err); return; @@ -3360,7 +3367,7 @@ XS(_wrap_JsPort_wakeupFd) { } -XS(_wrap_JsPort_wakeup) { +XS(_wrap_JsPort_wakeupSigLatencyCallback) { { JsPort *arg1 = (JsPort *) 0 ; void *argp1 = 0 ; @@ -3369,17 +3376,17 @@ XS(_wrap_JsPort_wakeup) { dXSARGS; if ((items < 1) || (items > 1)) { - SWIG_croak("Usage: JsPort_wakeup(self);"); + SWIG_croak("Usage: JsPort_wakeupSigLatencyCallback(self);"); } res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_JsPort, 0 | 0 ); if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "JsPort_wakeup" "', argument " "1"" of type '" "JsPort *""'"); + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "JsPort_wakeupSigLatencyCallback" "', argument " "1"" of type '" "JsPort *""'"); } arg1 = (JsPort *)(argp1); { char *err; clear_exception(); - JsPort_wakeup(arg1); + JsPort_wakeupSigLatencyCallback(arg1); if ((err = check_exception())) { croak(CROAK, err); return; @@ -3409,7 +3416,57 @@ XS(_wrap_JsPort_wakeup) { } -XS(_wrap_JsPort_initLatencyListenerFd) { +XS(_wrap_JsPort_initCaptureLatencyListener) { + { + JsPort *arg1 = (JsPort *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + int argvi = 0; + int result; + dXSARGS; + + if ((items < 1) || (items > 1)) { + SWIG_croak("Usage: JsPort_initCaptureLatencyListener(self);"); + } + res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_JsPort, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "JsPort_initCaptureLatencyListener" "', argument " "1"" of type '" "JsPort *""'"); + } + arg1 = (JsPort *)(argp1); + { + char *err; + clear_exception(); + result = (int)JsPort_initCaptureLatencyListener(arg1); + if ((err = check_exception())) { + croak(CROAK, err); + return; + + + + + + + + + + + + + + + } + } + ST(argvi) = SWIG_From_int SWIG_PERL_CALL_ARGS_1((int)(result)); argvi++ ; + + XSRETURN(argvi); + fail: + + SWIG_croak_null(); + } +} + + +XS(_wrap_JsPort_initPlaybackLatencyListener) { { JsPort *arg1 = (JsPort *) 0 ; void *argp1 = 0 ; @@ -3419,17 +3476,17 @@ XS(_wrap_JsPort_initLatencyListenerFd) { dXSARGS; if ((items < 1) || (items > 1)) { - SWIG_croak("Usage: JsPort_initLatencyListenerFd(self);"); + SWIG_croak("Usage: JsPort_initPlaybackLatencyListener(self);"); } res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_JsPort, 0 | 0 ); if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "JsPort_initLatencyListenerFd" "', argument " "1"" of type '" "JsPort *""'"); + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "JsPort_initPlaybackLatencyListener" "', argument " "1"" of type '" "JsPort *""'"); } arg1 = (JsPort *)(argp1); { char *err; clear_exception(); - result = (int)JsPort_initLatencyListenerFd(arg1); + result = (int)JsPort_initPlaybackLatencyListener(arg1); if ((err = check_exception())) { croak(CROAK, err); return; @@ -5091,9 +5148,10 @@ static swig_command_info swig_commands[] = { {"jacksc::JsPort_connect", _wrap_JsPort_connect}, {"jacksc::JsPort_getLatencyRange", _wrap_JsPort_getLatencyRange}, {"jacksc::JsPort_setLatencyRange", _wrap_JsPort_setLatencyRange}, -{"jacksc::JsPort_wakeupFd", _wrap_JsPort_wakeupFd}, -{"jacksc::JsPort_wakeup", _wrap_JsPort_wakeup}, -{"jacksc::JsPort_initLatencyListenerFd", _wrap_JsPort_initLatencyListenerFd}, +{"jacksc::JsPort_wakeupLatencyCallbacks", _wrap_JsPort_wakeupLatencyCallbacks}, +{"jacksc::JsPort_wakeupSigLatencyCallback", _wrap_JsPort_wakeupSigLatencyCallback}, +{"jacksc::JsPort_initCaptureLatencyListener", _wrap_JsPort_initCaptureLatencyListener}, +{"jacksc::JsPort_initPlaybackLatencyListener", _wrap_JsPort_initPlaybackLatencyListener}, {"jacksc::JsPort_initLatencyListener", _wrap_JsPort_initLatencyListener}, {"jacksc::new_JsPort", _wrap_new_JsPort}, {"jacksc::delete_JsEvent", _wrap_delete_JsEvent}, diff --git a/modules/perl/example-clients/latency_callback.pl b/modules/perl/example-clients/latency_callback.pl index 3c158f8..abf2ac7 100755 --- a/modules/perl/example-clients/latency_callback.pl +++ b/modules/perl/example-clients/latency_callback.pl @@ -35,7 +35,7 @@ $status_ready->send; }); -$pport->wakeup(); +$pport->wakeupSigLatencyCallback(); $status_ready->recv; print("done. status: $status\n"); diff --git a/modules/perl/example-clients/latency_callback_fd.pl b/modules/perl/example-clients/latency_callback_fd.pl index 748ab6f..ac3e633 100755 --- a/modules/perl/example-clients/latency_callback_fd.pl +++ b/modules/perl/example-clients/latency_callback_fd.pl @@ -26,7 +26,7 @@ my $cmax = $clatency->max(); print("cport latency [ $cmin $cmax ]\n"); -my $pfd = $pport->initLatencyListenerFd(); +my $pfd = $pport->initPlaybackLatencyListener(); my $status = "none"; my $status_ready = AnyEvent->condvar; @@ -43,7 +43,7 @@ $status_ready->send; }); -$pport->wakeupFd(); +$pport->wakeupLatencyCallbacks(); $status_ready->recv; print("done. status1: $status\n"); diff --git a/modules/perl/jacks.pm b/modules/perl/jacks.pm index 8ffced4..04b7033 100644 --- a/modules/perl/jacks.pm +++ b/modules/perl/jacks.pm @@ -192,9 +192,10 @@ sub DESTROY { *connect = *jacksc::JsPort_connect; *getLatencyRange = *jacksc::JsPort_getLatencyRange; *setLatencyRange = *jacksc::JsPort_setLatencyRange; -*wakeupFd = *jacksc::JsPort_wakeupFd; -*wakeup = *jacksc::JsPort_wakeup; -*initLatencyListenerFd = *jacksc::JsPort_initLatencyListenerFd; +*wakeupLatencyCallbacks = *jacksc::JsPort_wakeupLatencyCallbacks; +*wakeupSigLatencyCallback = *jacksc::JsPort_wakeupSigLatencyCallback; +*initCaptureLatencyListener = *jacksc::JsPort_initCaptureLatencyListener; +*initPlaybackLatencyListener = *jacksc::JsPort_initPlaybackLatencyListener; *initLatencyListener = *jacksc::JsPort_initLatencyListener; sub new { my $pkg = shift; diff --git a/modules/python2/Jacks_python_wrap.c b/modules/python2/Jacks_python_wrap.c index a4a1440..cad8955 100644 --- a/modules/python2/Jacks_python_wrap.c +++ b/modules/python2/Jacks_python_wrap.c @@ -3464,6 +3464,7 @@ SWIGINTERN int JsPort_connect(JsPort *self,JsPort *_that_){ int rc = JacksRbPort_connect(self->impl, _that_->impl); if (rc) throw_exception("can not connect ports"); + return rc; } SWIGINTERN JsLatencyRange *JsPort_getLatencyRange(JsPort *self,enum JackLatencyCallbackMode mode){ @@ -3485,17 +3486,23 @@ SWIGINTERN void JsPort_setLatencyRange(JsPort *self,enum JackLatencyCallbackMode jack_port_set_latency_range((jack_port_t *) JacksRbPort_get_port(self->impl), mode, &range); } -SWIGINTERN void JsPort_wakeupFd(JsPort *self){ - JacksRbPort_wakeup_fd(self->impl); +SWIGINTERN void JsPort_wakeupLatencyCallbacks(JsPort *self){ + JacksRbPort_wakeup_latency_callbacks(self->impl); + } +SWIGINTERN void JsPort_wakeupSigLatencyCallback(JsPort *self){ + JacksRbPort_wakeup_sig_latency_cb(self->impl); } -SWIGINTERN void JsPort_wakeup(JsPort *self){ - JacksRbPort_wakeup(self->impl); +SWIGINTERN int JsPort_initCaptureLatencyListener(JsPort *self){ + + int fd = JacksRbPort_init_capture_latency_listener(self->impl); + if (fd < 0) throw_exception("can not init capture latency callback"); + return fd; } -SWIGINTERN int JsPort_initLatencyListenerFd(JsPort *self){ +SWIGINTERN int JsPort_initPlaybackLatencyListener(JsPort *self){ - int fd = JacksRbPort_init_latency_listener_fd(self->impl); - if (fd < 0) throw_exception("can not init fd latency callback"); - return fd; //note, I doubt this will work... just stubbing it out for now. + int fd = JacksRbPort_init_playback_latency_listener(self->impl); + if (fd < 0) throw_exception("can not init playback latency callback"); + return fd; } SWIGINTERN int JsPort_initLatencyListener(JsPort *self){ @@ -4572,23 +4579,23 @@ SWIGINTERN PyObject *_wrap_JsPort_setLatencyRange(PyObject *SWIGUNUSEDPARM(self) } -SWIGINTERN PyObject *_wrap_JsPort_wakeupFd(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { +SWIGINTERN PyObject *_wrap_JsPort_wakeupLatencyCallbacks(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; JsPort *arg1 = (JsPort *) 0 ; void *argp1 = 0 ; int res1 = 0 ; PyObject * obj0 = 0 ; - if (!PyArg_ParseTuple(args,(char *)"O:JsPort_wakeupFd",&obj0)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"O:JsPort_wakeupLatencyCallbacks",&obj0)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_JsPort, 0 | 0 ); if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "JsPort_wakeupFd" "', argument " "1"" of type '" "JsPort *""'"); + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "JsPort_wakeupLatencyCallbacks" "', argument " "1"" of type '" "JsPort *""'"); } arg1 = (JsPort *)(argp1); { char *err; clear_exception(); - JsPort_wakeupFd(arg1); + JsPort_wakeupLatencyCallbacks(arg1); if ((err = check_exception())) { PyErr_SetString(PyExc_RuntimeError, err); return NULL; @@ -4612,23 +4619,23 @@ SWIGINTERN PyObject *_wrap_JsPort_wakeupFd(PyObject *SWIGUNUSEDPARM(self), PyObj } -SWIGINTERN PyObject *_wrap_JsPort_wakeup(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { +SWIGINTERN PyObject *_wrap_JsPort_wakeupSigLatencyCallback(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; JsPort *arg1 = (JsPort *) 0 ; void *argp1 = 0 ; int res1 = 0 ; PyObject * obj0 = 0 ; - if (!PyArg_ParseTuple(args,(char *)"O:JsPort_wakeup",&obj0)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"O:JsPort_wakeupSigLatencyCallback",&obj0)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_JsPort, 0 | 0 ); if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "JsPort_wakeup" "', argument " "1"" of type '" "JsPort *""'"); + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "JsPort_wakeupSigLatencyCallback" "', argument " "1"" of type '" "JsPort *""'"); } arg1 = (JsPort *)(argp1); { char *err; clear_exception(); - JsPort_wakeup(arg1); + JsPort_wakeupSigLatencyCallback(arg1); if ((err = check_exception())) { PyErr_SetString(PyExc_RuntimeError, err); return NULL; @@ -4652,7 +4659,48 @@ SWIGINTERN PyObject *_wrap_JsPort_wakeup(PyObject *SWIGUNUSEDPARM(self), PyObjec } -SWIGINTERN PyObject *_wrap_JsPort_initLatencyListenerFd(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { +SWIGINTERN PyObject *_wrap_JsPort_initCaptureLatencyListener(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + JsPort *arg1 = (JsPort *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + int result; + + if (!PyArg_ParseTuple(args,(char *)"O:JsPort_initCaptureLatencyListener",&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_JsPort, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "JsPort_initCaptureLatencyListener" "', argument " "1"" of type '" "JsPort *""'"); + } + arg1 = (JsPort *)(argp1); + { + char *err; + clear_exception(); + result = (int)JsPort_initCaptureLatencyListener(arg1); + if ((err = check_exception())) { + PyErr_SetString(PyExc_RuntimeError, err); + return NULL; + + + + + + + + + + + + } + } + resultobj = SWIG_From_int((int)(result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_JsPort_initPlaybackLatencyListener(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; JsPort *arg1 = (JsPort *) 0 ; void *argp1 = 0 ; @@ -4660,16 +4708,16 @@ SWIGINTERN PyObject *_wrap_JsPort_initLatencyListenerFd(PyObject *SWIGUNUSEDPARM PyObject * obj0 = 0 ; int result; - if (!PyArg_ParseTuple(args,(char *)"O:JsPort_initLatencyListenerFd",&obj0)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"O:JsPort_initPlaybackLatencyListener",&obj0)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_JsPort, 0 | 0 ); if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "JsPort_initLatencyListenerFd" "', argument " "1"" of type '" "JsPort *""'"); + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "JsPort_initPlaybackLatencyListener" "', argument " "1"" of type '" "JsPort *""'"); } arg1 = (JsPort *)(argp1); { char *err; clear_exception(); - result = (int)JsPort_initLatencyListenerFd(arg1); + result = (int)JsPort_initPlaybackLatencyListener(arg1); if ((err = check_exception())) { PyErr_SetString(PyExc_RuntimeError, err); return NULL; @@ -6026,9 +6074,10 @@ static PyMethodDef SwigMethods[] = { { (char *)"JsPort_connect", _wrap_JsPort_connect, METH_VARARGS, NULL}, { (char *)"JsPort_getLatencyRange", _wrap_JsPort_getLatencyRange, METH_VARARGS, NULL}, { (char *)"JsPort_setLatencyRange", _wrap_JsPort_setLatencyRange, METH_VARARGS, NULL}, - { (char *)"JsPort_wakeupFd", _wrap_JsPort_wakeupFd, METH_VARARGS, NULL}, - { (char *)"JsPort_wakeup", _wrap_JsPort_wakeup, METH_VARARGS, NULL}, - { (char *)"JsPort_initLatencyListenerFd", _wrap_JsPort_initLatencyListenerFd, METH_VARARGS, NULL}, + { (char *)"JsPort_wakeupLatencyCallbacks", _wrap_JsPort_wakeupLatencyCallbacks, METH_VARARGS, NULL}, + { (char *)"JsPort_wakeupSigLatencyCallback", _wrap_JsPort_wakeupSigLatencyCallback, METH_VARARGS, NULL}, + { (char *)"JsPort_initCaptureLatencyListener", _wrap_JsPort_initCaptureLatencyListener, METH_VARARGS, NULL}, + { (char *)"JsPort_initPlaybackLatencyListener", _wrap_JsPort_initPlaybackLatencyListener, METH_VARARGS, NULL}, { (char *)"JsPort_initLatencyListener", _wrap_JsPort_initLatencyListener, METH_VARARGS, NULL}, { (char *)"new_JsPort", _wrap_new_JsPort, METH_VARARGS, NULL}, { (char *)"JsPort_swigregister", JsPort_swigregister, METH_VARARGS, NULL}, diff --git a/modules/python2/jacks.py b/modules/python2/jacks.py index 9d34774..5f48354 100644 --- a/modules/python2/jacks.py +++ b/modules/python2/jacks.py @@ -161,9 +161,10 @@ def name(self): return _jacks.JsPort_name(self) def connect(self, *args): return _jacks.JsPort_connect(self, *args) def getLatencyRange(self, *args): return _jacks.JsPort_getLatencyRange(self, *args) def setLatencyRange(self, *args): return _jacks.JsPort_setLatencyRange(self, *args) - def wakeupFd(self): return _jacks.JsPort_wakeupFd(self) - def wakeup(self): return _jacks.JsPort_wakeup(self) - def initLatencyListenerFd(self): return _jacks.JsPort_initLatencyListenerFd(self) + def wakeupLatencyCallbacks(self): return _jacks.JsPort_wakeupLatencyCallbacks(self) + def wakeupSigLatencyCallback(self): return _jacks.JsPort_wakeupSigLatencyCallback(self) + def initCaptureLatencyListener(self): return _jacks.JsPort_initCaptureLatencyListener(self) + def initPlaybackLatencyListener(self): return _jacks.JsPort_initPlaybackLatencyListener(self) def initLatencyListener(self): return _jacks.JsPort_initLatencyListener(self) def __init__(self): this = _jacks.new_JsPort() diff --git a/modules/python3/Jacks_python3_wrap.c b/modules/python3/Jacks_python3_wrap.c index a4a1440..cad8955 100644 --- a/modules/python3/Jacks_python3_wrap.c +++ b/modules/python3/Jacks_python3_wrap.c @@ -3464,6 +3464,7 @@ SWIGINTERN int JsPort_connect(JsPort *self,JsPort *_that_){ int rc = JacksRbPort_connect(self->impl, _that_->impl); if (rc) throw_exception("can not connect ports"); + return rc; } SWIGINTERN JsLatencyRange *JsPort_getLatencyRange(JsPort *self,enum JackLatencyCallbackMode mode){ @@ -3485,17 +3486,23 @@ SWIGINTERN void JsPort_setLatencyRange(JsPort *self,enum JackLatencyCallbackMode jack_port_set_latency_range((jack_port_t *) JacksRbPort_get_port(self->impl), mode, &range); } -SWIGINTERN void JsPort_wakeupFd(JsPort *self){ - JacksRbPort_wakeup_fd(self->impl); +SWIGINTERN void JsPort_wakeupLatencyCallbacks(JsPort *self){ + JacksRbPort_wakeup_latency_callbacks(self->impl); + } +SWIGINTERN void JsPort_wakeupSigLatencyCallback(JsPort *self){ + JacksRbPort_wakeup_sig_latency_cb(self->impl); } -SWIGINTERN void JsPort_wakeup(JsPort *self){ - JacksRbPort_wakeup(self->impl); +SWIGINTERN int JsPort_initCaptureLatencyListener(JsPort *self){ + + int fd = JacksRbPort_init_capture_latency_listener(self->impl); + if (fd < 0) throw_exception("can not init capture latency callback"); + return fd; } -SWIGINTERN int JsPort_initLatencyListenerFd(JsPort *self){ +SWIGINTERN int JsPort_initPlaybackLatencyListener(JsPort *self){ - int fd = JacksRbPort_init_latency_listener_fd(self->impl); - if (fd < 0) throw_exception("can not init fd latency callback"); - return fd; //note, I doubt this will work... just stubbing it out for now. + int fd = JacksRbPort_init_playback_latency_listener(self->impl); + if (fd < 0) throw_exception("can not init playback latency callback"); + return fd; } SWIGINTERN int JsPort_initLatencyListener(JsPort *self){ @@ -4572,23 +4579,23 @@ SWIGINTERN PyObject *_wrap_JsPort_setLatencyRange(PyObject *SWIGUNUSEDPARM(self) } -SWIGINTERN PyObject *_wrap_JsPort_wakeupFd(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { +SWIGINTERN PyObject *_wrap_JsPort_wakeupLatencyCallbacks(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; JsPort *arg1 = (JsPort *) 0 ; void *argp1 = 0 ; int res1 = 0 ; PyObject * obj0 = 0 ; - if (!PyArg_ParseTuple(args,(char *)"O:JsPort_wakeupFd",&obj0)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"O:JsPort_wakeupLatencyCallbacks",&obj0)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_JsPort, 0 | 0 ); if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "JsPort_wakeupFd" "', argument " "1"" of type '" "JsPort *""'"); + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "JsPort_wakeupLatencyCallbacks" "', argument " "1"" of type '" "JsPort *""'"); } arg1 = (JsPort *)(argp1); { char *err; clear_exception(); - JsPort_wakeupFd(arg1); + JsPort_wakeupLatencyCallbacks(arg1); if ((err = check_exception())) { PyErr_SetString(PyExc_RuntimeError, err); return NULL; @@ -4612,23 +4619,23 @@ SWIGINTERN PyObject *_wrap_JsPort_wakeupFd(PyObject *SWIGUNUSEDPARM(self), PyObj } -SWIGINTERN PyObject *_wrap_JsPort_wakeup(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { +SWIGINTERN PyObject *_wrap_JsPort_wakeupSigLatencyCallback(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; JsPort *arg1 = (JsPort *) 0 ; void *argp1 = 0 ; int res1 = 0 ; PyObject * obj0 = 0 ; - if (!PyArg_ParseTuple(args,(char *)"O:JsPort_wakeup",&obj0)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"O:JsPort_wakeupSigLatencyCallback",&obj0)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_JsPort, 0 | 0 ); if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "JsPort_wakeup" "', argument " "1"" of type '" "JsPort *""'"); + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "JsPort_wakeupSigLatencyCallback" "', argument " "1"" of type '" "JsPort *""'"); } arg1 = (JsPort *)(argp1); { char *err; clear_exception(); - JsPort_wakeup(arg1); + JsPort_wakeupSigLatencyCallback(arg1); if ((err = check_exception())) { PyErr_SetString(PyExc_RuntimeError, err); return NULL; @@ -4652,7 +4659,48 @@ SWIGINTERN PyObject *_wrap_JsPort_wakeup(PyObject *SWIGUNUSEDPARM(self), PyObjec } -SWIGINTERN PyObject *_wrap_JsPort_initLatencyListenerFd(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { +SWIGINTERN PyObject *_wrap_JsPort_initCaptureLatencyListener(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + JsPort *arg1 = (JsPort *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + int result; + + if (!PyArg_ParseTuple(args,(char *)"O:JsPort_initCaptureLatencyListener",&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_JsPort, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "JsPort_initCaptureLatencyListener" "', argument " "1"" of type '" "JsPort *""'"); + } + arg1 = (JsPort *)(argp1); + { + char *err; + clear_exception(); + result = (int)JsPort_initCaptureLatencyListener(arg1); + if ((err = check_exception())) { + PyErr_SetString(PyExc_RuntimeError, err); + return NULL; + + + + + + + + + + + + } + } + resultobj = SWIG_From_int((int)(result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_JsPort_initPlaybackLatencyListener(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; JsPort *arg1 = (JsPort *) 0 ; void *argp1 = 0 ; @@ -4660,16 +4708,16 @@ SWIGINTERN PyObject *_wrap_JsPort_initLatencyListenerFd(PyObject *SWIGUNUSEDPARM PyObject * obj0 = 0 ; int result; - if (!PyArg_ParseTuple(args,(char *)"O:JsPort_initLatencyListenerFd",&obj0)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"O:JsPort_initPlaybackLatencyListener",&obj0)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_JsPort, 0 | 0 ); if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "JsPort_initLatencyListenerFd" "', argument " "1"" of type '" "JsPort *""'"); + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "JsPort_initPlaybackLatencyListener" "', argument " "1"" of type '" "JsPort *""'"); } arg1 = (JsPort *)(argp1); { char *err; clear_exception(); - result = (int)JsPort_initLatencyListenerFd(arg1); + result = (int)JsPort_initPlaybackLatencyListener(arg1); if ((err = check_exception())) { PyErr_SetString(PyExc_RuntimeError, err); return NULL; @@ -6026,9 +6074,10 @@ static PyMethodDef SwigMethods[] = { { (char *)"JsPort_connect", _wrap_JsPort_connect, METH_VARARGS, NULL}, { (char *)"JsPort_getLatencyRange", _wrap_JsPort_getLatencyRange, METH_VARARGS, NULL}, { (char *)"JsPort_setLatencyRange", _wrap_JsPort_setLatencyRange, METH_VARARGS, NULL}, - { (char *)"JsPort_wakeupFd", _wrap_JsPort_wakeupFd, METH_VARARGS, NULL}, - { (char *)"JsPort_wakeup", _wrap_JsPort_wakeup, METH_VARARGS, NULL}, - { (char *)"JsPort_initLatencyListenerFd", _wrap_JsPort_initLatencyListenerFd, METH_VARARGS, NULL}, + { (char *)"JsPort_wakeupLatencyCallbacks", _wrap_JsPort_wakeupLatencyCallbacks, METH_VARARGS, NULL}, + { (char *)"JsPort_wakeupSigLatencyCallback", _wrap_JsPort_wakeupSigLatencyCallback, METH_VARARGS, NULL}, + { (char *)"JsPort_initCaptureLatencyListener", _wrap_JsPort_initCaptureLatencyListener, METH_VARARGS, NULL}, + { (char *)"JsPort_initPlaybackLatencyListener", _wrap_JsPort_initPlaybackLatencyListener, METH_VARARGS, NULL}, { (char *)"JsPort_initLatencyListener", _wrap_JsPort_initLatencyListener, METH_VARARGS, NULL}, { (char *)"new_JsPort", _wrap_new_JsPort, METH_VARARGS, NULL}, { (char *)"JsPort_swigregister", JsPort_swigregister, METH_VARARGS, NULL}, diff --git a/modules/python3/jacks.py b/modules/python3/jacks.py index 9d34774..5f48354 100644 --- a/modules/python3/jacks.py +++ b/modules/python3/jacks.py @@ -161,9 +161,10 @@ def name(self): return _jacks.JsPort_name(self) def connect(self, *args): return _jacks.JsPort_connect(self, *args) def getLatencyRange(self, *args): return _jacks.JsPort_getLatencyRange(self, *args) def setLatencyRange(self, *args): return _jacks.JsPort_setLatencyRange(self, *args) - def wakeupFd(self): return _jacks.JsPort_wakeupFd(self) - def wakeup(self): return _jacks.JsPort_wakeup(self) - def initLatencyListenerFd(self): return _jacks.JsPort_initLatencyListenerFd(self) + def wakeupLatencyCallbacks(self): return _jacks.JsPort_wakeupLatencyCallbacks(self) + def wakeupSigLatencyCallback(self): return _jacks.JsPort_wakeupSigLatencyCallback(self) + def initCaptureLatencyListener(self): return _jacks.JsPort_initCaptureLatencyListener(self) + def initPlaybackLatencyListener(self): return _jacks.JsPort_initPlaybackLatencyListener(self) def initLatencyListener(self): return _jacks.JsPort_initLatencyListener(self) def __init__(self): this = _jacks.new_JsPort() diff --git a/modules/ruby/Jacks_ruby_wrap.c b/modules/ruby/Jacks_ruby_wrap.c index d680bcc..dc9cb8d 100644 --- a/modules/ruby/Jacks_ruby_wrap.c +++ b/modules/ruby/Jacks_ruby_wrap.c @@ -2206,6 +2206,7 @@ SWIGINTERN int JsPort_connect(JsPort *self,JsPort *_that_){ int rc = JacksRbPort_connect(self->impl, _that_->impl); if (rc) throw_exception("can not connect ports"); + return rc; } SWIGINTERN JsLatencyRange *JsPort_getLatencyRange(JsPort *self,enum JackLatencyCallbackMode mode){ @@ -2227,17 +2228,23 @@ SWIGINTERN void JsPort_setLatencyRange(JsPort *self,enum JackLatencyCallbackMode jack_port_set_latency_range((jack_port_t *) JacksRbPort_get_port(self->impl), mode, &range); } -SWIGINTERN void JsPort_wakeupFd(JsPort *self){ - JacksRbPort_wakeup_fd(self->impl); +SWIGINTERN void JsPort_wakeupLatencyCallbacks(JsPort *self){ + JacksRbPort_wakeup_latency_callbacks(self->impl); + } +SWIGINTERN void JsPort_wakeupSigLatencyCallback(JsPort *self){ + JacksRbPort_wakeup_sig_latency_cb(self->impl); } -SWIGINTERN void JsPort_wakeup(JsPort *self){ - JacksRbPort_wakeup(self->impl); +SWIGINTERN int JsPort_initCaptureLatencyListener(JsPort *self){ + + int fd = JacksRbPort_init_capture_latency_listener(self->impl); + if (fd < 0) throw_exception("can not init capture latency callback"); + return fd; } -SWIGINTERN int JsPort_initLatencyListenerFd(JsPort *self){ +SWIGINTERN int JsPort_initPlaybackLatencyListener(JsPort *self){ - int fd = JacksRbPort_init_latency_listener_fd(self->impl); - if (fd < 0) throw_exception("can not init fd latency callback"); - return fd; //note, I doubt this will work... just stubbing it out for now. + int fd = JacksRbPort_init_playback_latency_listener(self->impl); + if (fd < 0) throw_exception("can not init playback latency callback"); + return fd; } SWIGINTERN int JsPort_initLatencyListener(JsPort *self){ @@ -3184,7 +3191,7 @@ _wrap_JsPort_setLatencyRange(int argc, VALUE *argv, VALUE self) { SWIGINTERN VALUE -_wrap_JsPort_wakeupFd(int argc, VALUE *argv, VALUE self) { +_wrap_JsPort_wakeupLatencyCallbacks(int argc, VALUE *argv, VALUE self) { JsPort *arg1 = (JsPort *) 0 ; void *argp1 = 0 ; int res1 = 0 ; @@ -3194,13 +3201,13 @@ _wrap_JsPort_wakeupFd(int argc, VALUE *argv, VALUE self) { } res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_JsPort, 0 | 0 ); if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "JsPort *","wakeupFd", 1, self )); + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "JsPort *","wakeupLatencyCallbacks", 1, self )); } arg1 = (JsPort *)(argp1); { char *err; clear_exception(); - JsPort_wakeupFd(arg1); + JsPort_wakeupLatencyCallbacks(arg1); if ((err = check_exception())) { void *runerror = rb_define_class("JacksRuntimeError", rb_eStandardError); rb_raise(runerror, err); @@ -3221,7 +3228,7 @@ _wrap_JsPort_wakeupFd(int argc, VALUE *argv, VALUE self) { SWIGINTERN VALUE -_wrap_JsPort_wakeup(int argc, VALUE *argv, VALUE self) { +_wrap_JsPort_wakeupSigLatencyCallback(int argc, VALUE *argv, VALUE self) { JsPort *arg1 = (JsPort *) 0 ; void *argp1 = 0 ; int res1 = 0 ; @@ -3231,13 +3238,13 @@ _wrap_JsPort_wakeup(int argc, VALUE *argv, VALUE self) { } res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_JsPort, 0 | 0 ); if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "JsPort *","wakeup", 1, self )); + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "JsPort *","wakeupSigLatencyCallback", 1, self )); } arg1 = (JsPort *)(argp1); { char *err; clear_exception(); - JsPort_wakeup(arg1); + JsPort_wakeupSigLatencyCallback(arg1); if ((err = check_exception())) { void *runerror = rb_define_class("JacksRuntimeError", rb_eStandardError); rb_raise(runerror, err); @@ -3258,7 +3265,47 @@ _wrap_JsPort_wakeup(int argc, VALUE *argv, VALUE self) { SWIGINTERN VALUE -_wrap_JsPort_initLatencyListenerFd(int argc, VALUE *argv, VALUE self) { +_wrap_JsPort_initCaptureLatencyListener(int argc, VALUE *argv, VALUE self) { + JsPort *arg1 = (JsPort *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + int result; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_JsPort, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "JsPort *","initCaptureLatencyListener", 1, self )); + } + arg1 = (JsPort *)(argp1); + { + char *err; + clear_exception(); + result = (int)JsPort_initCaptureLatencyListener(arg1); + if ((err = check_exception())) { + void *runerror = rb_define_class("JacksRuntimeError", rb_eStandardError); + rb_raise(runerror, err); + return; + + + + + + + + } + } + vresult = SWIG_From_int((int)(result)); + return vresult; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_JsPort_initPlaybackLatencyListener(int argc, VALUE *argv, VALUE self) { JsPort *arg1 = (JsPort *) 0 ; void *argp1 = 0 ; int res1 = 0 ; @@ -3270,13 +3317,13 @@ _wrap_JsPort_initLatencyListenerFd(int argc, VALUE *argv, VALUE self) { } res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_JsPort, 0 | 0 ); if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "JsPort *","initLatencyListenerFd", 1, self )); + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "JsPort *","initPlaybackLatencyListener", 1, self )); } arg1 = (JsPort *)(argp1); { char *err; clear_exception(); - result = (int)JsPort_initLatencyListenerFd(arg1); + result = (int)JsPort_initPlaybackLatencyListener(arg1); if ((err = check_exception())) { void *runerror = rb_define_class("JacksRuntimeError", rb_eStandardError); rb_raise(runerror, err); @@ -4918,9 +4965,10 @@ SWIGEXPORT void Init_jacks(void) { rb_define_method(SwigClassJsPort.klass, "connect", _wrap_JsPort_connect, -1); rb_define_method(SwigClassJsPort.klass, "getLatencyRange", _wrap_JsPort_getLatencyRange, -1); rb_define_method(SwigClassJsPort.klass, "setLatencyRange", _wrap_JsPort_setLatencyRange, -1); - rb_define_method(SwigClassJsPort.klass, "wakeupFd", _wrap_JsPort_wakeupFd, -1); - rb_define_method(SwigClassJsPort.klass, "wakeup", _wrap_JsPort_wakeup, -1); - rb_define_method(SwigClassJsPort.klass, "initLatencyListenerFd", _wrap_JsPort_initLatencyListenerFd, -1); + rb_define_method(SwigClassJsPort.klass, "wakeupLatencyCallbacks", _wrap_JsPort_wakeupLatencyCallbacks, -1); + rb_define_method(SwigClassJsPort.klass, "wakeupSigLatencyCallback", _wrap_JsPort_wakeupSigLatencyCallback, -1); + rb_define_method(SwigClassJsPort.klass, "initCaptureLatencyListener", _wrap_JsPort_initCaptureLatencyListener, -1); + rb_define_method(SwigClassJsPort.klass, "initPlaybackLatencyListener", _wrap_JsPort_initPlaybackLatencyListener, -1); rb_define_method(SwigClassJsPort.klass, "initLatencyListener", _wrap_JsPort_initLatencyListener, -1); SwigClassJsPort.mark = 0; SwigClassJsPort.destroy = (void (*)(void *)) free_JsPort;