aboutsummaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorHanspeter Portner <dev@open-music-kontrollers.ch>2015-07-15 18:23:59 +0200
committerHanspeter Portner <dev@open-music-kontrollers.ch>2015-07-15 18:23:59 +0200
commit94ea0cd009fe634a01a9de36f1b66098557db309 (patch)
tree6c06514857c62622ff9db0c286cc4aa91bd5317f /bin
parentcb7bde151b89fb5d10bde448ef489a5297e9359e (diff)
downloadsynthpod-94ea0cd009fe634a01a9de36f1b66098557db309.tar.xz
check for jack_get_cycle_times in cmake.
Diffstat (limited to 'bin')
-rw-r--r--bin/CMakeLists.txt6
-rw-r--r--bin/synthpod_jack.c14
2 files changed, 18 insertions, 2 deletions
diff --git a/bin/CMakeLists.txt b/bin/CMakeLists.txt
index 51256414..a797f7ce 100644
--- a/bin/CMakeLists.txt
+++ b/bin/CMakeLists.txt
@@ -37,6 +37,12 @@ if(BUILD_JACK)
if(${JACK_HAS_METADATA_API})
add_definitions("-DJACK_HAS_METADATA_API")
endif()
+
+ include(CheckLibraryExists)
+ CHECK_LIBRARY_EXISTS(jack jack_get_cycle_times "" JACK_HAS_CYCLE_TIMES)
+ if(${JACK_HAS_CYCLE_TIMES})
+ add_definitions("-DJACK_HAS_CYCLE_TIMES")
+ endif()
if(APPLE)
set(JACK_LIBS ${CORE_AUDIO} ${CORE_SERVICES} ${AUDIO_UNIT} "-ljack")
diff --git a/bin/synthpod_jack.c b/bin/synthpod_jack.c
index 80c8f3a1..8d5338b3 100644
--- a/bin/synthpod_jack.c
+++ b/bin/synthpod_jack.c
@@ -136,6 +136,7 @@ struct _prog_t {
double bpm;
} trans;
+#if defined(JACK_HAS_CYCLE_TIMES)
osc_schedule_t osc_sched;
struct timespec ntp;
struct {
@@ -145,6 +146,7 @@ struct _prog_t {
jack_time_t nxt_usecs;
float T;
} cycle;
+#endif
};
static const synthpod_nsm_driver_t nsm_driver; // forwared-declaration
@@ -505,7 +507,8 @@ _process(jack_nframes_t nsamples, void *data)
{
prog_t *handle = data;
sp_app_t *app = handle->app;
-
+
+#if defined(JACK_HAS_CYCLE_TIMES)
clock_gettime(CLOCK_REALTIME, &handle->ntp);
jack_nframes_t offset = jack_frames_since_cycle_start(handle->client);
@@ -515,6 +518,7 @@ _process(jack_nframes_t nsamples, void *data)
handle->cycle.ref_frames = handle->cycle.cur_frames + offset;
handle->ntp.tv_sec += JAN_1970; // convert NTP to OSC time
handle->cycle.T = (float)nsamples / (handle->cycle.nxt_usecs - handle->cycle.cur_usecs);
+#endif
// get transport position
jack_position_t pos;
@@ -1169,6 +1173,7 @@ static const synthpod_nsm_driver_t nsm_driver = {
#endif // BUILD_UI
};
+#if defined(JACK_HAS_CYCLE_TIMES)
// rt
static int64_t
_osc_schedule_osc2frames(osc_schedule_handle_t instance, uint64_t timestamp)
@@ -1176,7 +1181,7 @@ _osc_schedule_osc2frames(osc_schedule_handle_t instance, uint64_t timestamp)
prog_t *handle = instance;
if(timestamp == 1ULL)
- return handle->cycle.cur_frames; // inject at start of period
+ return 0; // inject at start of period
uint32_t time_sec = timestamp >> 32;
uint32_t time_frac = timestamp & 0xffffffff;
@@ -1223,6 +1228,7 @@ _osc_schedule_frames2osc(osc_schedule_handle_t instance, int64_t frames)
return timestamp;
}
+#endif // JACK_HAS_CYCLE_TIMES
#if defined(BUILD_UI)
EAPI_MAIN int
@@ -1289,10 +1295,14 @@ main(int argc, char **argv)
handle.app_driver.system_port_add = _system_port_add;
handle.app_driver.system_port_del = _system_port_del;
+#if defined(JACK_HAS_CYCLE_TIMES)
handle.osc_sched.osc2frames = _osc_schedule_osc2frames;
handle.osc_sched.frames2osc = _osc_schedule_frames2osc;
handle.osc_sched.handle = &handle;
handle.app_driver.osc_sched = &handle.osc_sched;
+#else
+ handle.app_driver.osc_sched = NULL;
+#endif
#if defined(BUILD_UI)
handle.ui_driver.map = map;