From b797f04ccac2f95bbee8db9498c866ba09fa6d55 Mon Sep 17 00:00:00 2001 From: dan derks Date: Mon, 13 Jun 2022 16:25:26 -0400 Subject: [PATCH] Revert "Merge branch 'main' into password-helper" This reverts commit 66fe7983aad172134a1409259d612a6f35976bb2, reversing changes made to 651d7c08ce8fe96f1a300c9756318a1004ceab15. --- .gitmodules | 3 +++ matron/src/clocks/clock_link.c | 42 ++++++++++++++++++---------------- matron/wscript | 3 ++- third-party/link | 2 +- third-party/link-c | 1 + third-party/wscript | 3 +-- 6 files changed, 30 insertions(+), 24 deletions(-) create mode 160000 third-party/link-c diff --git a/.gitmodules b/.gitmodules index 2c6a2452e..2192f8449 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,6 @@ +[submodule "third-party/link-c"] + path = third-party/link-c + url = https://github.com/artfwo/link-c.git [submodule "third-party/link"] path = third-party/link url = https://github.com/Ableton/link.git diff --git a/matron/src/clocks/clock_link.c b/matron/src/clocks/clock_link.c index e9ba389a0..0350d4378 100644 --- a/matron/src/clocks/clock_link.c +++ b/matron/src/clocks/clock_link.c @@ -6,7 +6,7 @@ #include #include -#include +#include #include "clock.h" @@ -28,59 +28,61 @@ static clock_reference_t clock_link_reference; static void *clock_link_run(void *p) { (void)p; - abl_link link; - abl_link_session_state state; + AbletonLink *link; + AbletonLinkClock *clock; + AbletonLinkSessionState *state; - link = abl_link_create(120); - state = abl_link_create_session_state(); + link = ableton_link_new(120); + clock = ableton_link_clock(link); while (true) { if (pthread_mutex_trylock(&clock_link_shared_data.lock) == 0) { - abl_link_capture_app_session_state(link, state); + state = ableton_link_capture_app_session_state(link); - uint64_t micros = abl_link_clock_micros(link); - double link_tempo = abl_link_tempo(state); - bool link_playing = abl_link_is_playing(state); + uint64_t micros = ableton_link_clock_micros(clock); + double link_tempo = ableton_link_session_state_tempo(state); + bool link_playing = ableton_link_session_state_is_playing(state); if (clock_link_shared_data.transport_start) { - abl_link_set_is_playing(state, true, 0); - abl_link_commit_app_session_state(link, state); + ableton_link_session_state_set_is_playing(state, true, 0); + ableton_link_commit_app_session_state(link, state); clock_link_shared_data.transport_start = false; } if (clock_link_shared_data.transport_stop) { - abl_link_set_is_playing(state, false, 0); - abl_link_commit_app_session_state(link, state); + ableton_link_session_state_set_is_playing(state, false, 0); + ableton_link_commit_app_session_state(link, state); clock_link_shared_data.transport_stop = false; } if (clock_link_shared_data.start_stop_sync) { if (!clock_link_shared_data.playing && link_playing) { - abl_link_request_beat_at_start_playing_time(state, 0, clock_link_shared_data.quantum); + ableton_link_session_state_request_beat_at_start_playing_time(state, 0, clock_link_shared_data.quantum); clock_link_shared_data.playing = true; // this will also reschedule pending sync events to beat 0 clock_start_from_source(CLOCK_SOURCE_LINK); - abl_link_commit_app_session_state(link, state); + ableton_link_commit_app_session_state(link, state); } else if (clock_link_shared_data.playing && !link_playing) { clock_link_shared_data.playing = false; clock_stop_from_source(CLOCK_SOURCE_LINK); } } - double link_beat = abl_link_beat_at_time(state, micros, clock_link_shared_data.quantum); + double link_beat = ableton_link_session_state_beat_at_time(state, micros, clock_link_shared_data.quantum); clock_update_source_reference(&clock_link_reference, link_beat, 60.0f / link_tempo); if (clock_link_shared_data.requested_tempo > 0) { - abl_link_set_tempo(state, clock_link_shared_data.requested_tempo, micros); - abl_link_commit_app_session_state(link, state); + ableton_link_session_state_set_tempo(state, clock_link_shared_data.requested_tempo, micros); + ableton_link_commit_app_session_state(link, state); clock_link_shared_data.requested_tempo = 0; } - abl_link_enable(link, clock_link_shared_data.enabled); - abl_link_enable_start_stop_sync(link, clock_link_shared_data.start_stop_sync); + ableton_link_enable(link, clock_link_shared_data.enabled); + ableton_link_enable_start_stop_sync(link, clock_link_shared_data.start_stop_sync); + ableton_link_session_state_destroy(state); pthread_mutex_unlock(&clock_link_shared_data.lock); } diff --git a/matron/wscript b/matron/wscript index b98e9fca8..301d179d6 100644 --- a/matron/wscript +++ b/matron/wscript @@ -77,10 +77,11 @@ def build(bld): if bld.env.ENABLE_ABLETON_LINK: matron_sources += ['src/clocks/clock_link.c'] - matron_includes += ['../third-party/link/extensions/abl_link/include'] + matron_includes += ['../third-party/link-c'] matron_libs += ['stdc++'] matron_use += ['LIBLINK_C'] + matron_cflags=['-O3', '-Wall', '-std=c11'] if bld.env.NORNS_RELEASE: diff --git a/third-party/link b/third-party/link index adbbb5298..05ef5646c 160000 --- a/third-party/link +++ b/third-party/link @@ -1 +1 @@ -Subproject commit adbbb529831c22edecba20e983343b3b23a73f60 +Subproject commit 05ef5646c3533cd2cff321f3bac8540264812052 diff --git a/third-party/link-c b/third-party/link-c new file mode 160000 index 000000000..cfab77396 --- /dev/null +++ b/third-party/link-c @@ -0,0 +1 @@ +Subproject commit cfab77396ea02884aa0b78493eaeae39fa6e361a diff --git a/third-party/wscript b/third-party/wscript index 668bb9da5..cd6418eae 100644 --- a/third-party/wscript +++ b/third-party/wscript @@ -3,11 +3,10 @@ top = '..' def build_link(bld): bld.stlib(features='c cxx cxxstlib', source=[ - 'link/extensions/abl_link/src/abl_link.cpp', + 'link-c/ableton_link.cpp', ], target='link-c', includes=[ - 'link/extensions/abl_link/include', 'link/include', 'link/modules/asio-standalone/asio/include', ],