Skip to content

Commit

Permalink
Merge branch 'main' into password-helper
Browse files Browse the repository at this point in the history
  • Loading branch information
dndrks committed Jun 13, 2022
2 parents 651d7c0 + 83e73b5 commit 66fe798
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 30 deletions.
3 changes: 0 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
[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
Expand Down
42 changes: 20 additions & 22 deletions matron/src/clocks/clock_link.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#include <time.h>
#include <unistd.h>

#include <ableton_link.h>
#include <abl_link.h>

#include "clock.h"

Expand All @@ -28,61 +28,59 @@ static clock_reference_t clock_link_reference;
static void *clock_link_run(void *p) {
(void)p;

AbletonLink *link;
AbletonLinkClock *clock;
AbletonLinkSessionState *state;
abl_link link;
abl_link_session_state state;

link = ableton_link_new(120);
clock = ableton_link_clock(link);
link = abl_link_create(120);
state = abl_link_create_session_state();

while (true) {
if (pthread_mutex_trylock(&clock_link_shared_data.lock) == 0) {
state = ableton_link_capture_app_session_state(link);
abl_link_capture_app_session_state(link, 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);
uint64_t micros = abl_link_clock_micros(link);
double link_tempo = abl_link_tempo(state);
bool link_playing = abl_link_is_playing(state);


if (clock_link_shared_data.transport_start) {
ableton_link_session_state_set_is_playing(state, true, 0);
ableton_link_commit_app_session_state(link, state);
abl_link_set_is_playing(state, true, 0);
abl_link_commit_app_session_state(link, state);
clock_link_shared_data.transport_start = false;
}

if (clock_link_shared_data.transport_stop) {
ableton_link_session_state_set_is_playing(state, false, 0);
ableton_link_commit_app_session_state(link, state);
abl_link_set_is_playing(state, false, 0);
abl_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) {
ableton_link_session_state_request_beat_at_start_playing_time(state, 0, clock_link_shared_data.quantum);
abl_link_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);
ableton_link_commit_app_session_state(link, state);
abl_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 = ableton_link_session_state_beat_at_time(state, micros, clock_link_shared_data.quantum);
double link_beat = abl_link_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) {
ableton_link_session_state_set_tempo(state, clock_link_shared_data.requested_tempo, micros);
ableton_link_commit_app_session_state(link, state);
abl_link_set_tempo(state, clock_link_shared_data.requested_tempo, micros);
abl_link_commit_app_session_state(link, state);
clock_link_shared_data.requested_tempo = 0;
}

ableton_link_enable(link, clock_link_shared_data.enabled);
ableton_link_enable_start_stop_sync(link, clock_link_shared_data.start_stop_sync);
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_session_state_destroy(state);
pthread_mutex_unlock(&clock_link_shared_data.lock);
}

Expand Down
3 changes: 1 addition & 2 deletions matron/wscript
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,10 @@ def build(bld):

if bld.env.ENABLE_ABLETON_LINK:
matron_sources += ['src/clocks/clock_link.c']
matron_includes += ['../third-party/link-c']
matron_includes += ['../third-party/link/extensions/abl_link/include']
matron_libs += ['stdc++']
matron_use += ['LIBLINK_C']


matron_cflags=['-O3', '-Wall', '-std=c11']

if bld.env.NORNS_RELEASE:
Expand Down
2 changes: 1 addition & 1 deletion third-party/link
Submodule link updated 93 files
+119 −63 .appveyor.yml
+0 −167 .travis.yml
+1 −1 AbletonLinkConfig.cmake
+2 −0 CMakeLists.txt
+2 −2 README.md
+3 −1 TEST-PLAN.md
+4 −4 ci/check-formatting.py
+6 −0 ci/configure.py
+1 −1 cmake_include/CatchConfig.cmake
+4 −0 cmake_include/ConfigureCompileFlags.cmake
+6 −6 examples/CMakeLists.txt
+1 −1 examples/esp32/README.md
+3 −2 examples/esp32/main/main.cpp
+2 −1 examples/linkaudio/AudioEngine.cpp
+2 −2 examples/linkaudio/AudioPlatform_Asio.cpp
+2 −1 examples/linkaudio/AudioPlatform_CoreAudio.cpp
+2 −2 examples/linkaudio/AudioPlatform_Portaudio.cpp
+46 −45 examples/linkhut/main.cpp
+44 −0 extensions/abl_link/.clang-format
+19 −0 extensions/abl_link/CMakeLists.txt
+17 −0 extensions/abl_link/README.md
+19 −0 extensions/abl_link/abl_link.cmake
+269 −0 extensions/abl_link/examples/link_hut/main.c
+352 −0 extensions/abl_link/include/abl_link.h
+214 −0 extensions/abl_link/src/abl_link.cpp
+12 −4 include/CMakeLists.txt
+1 −2 include/ableton/Link.hpp
+11 −9 include/ableton/Link.ipp
+10 −7 include/ableton/discovery/NetworkByteStreamSerializable.hpp
+4 −2 include/ableton/discovery/Payload.hpp
+2 −2 include/ableton/discovery/PeerGateway.hpp
+13 −60 include/ableton/discovery/PeerGateways.hpp
+2 −2 include/ableton/discovery/Service.hpp
+2 −2 include/ableton/discovery/v1/Messages.hpp
+1 −1 include/ableton/link/Beats.hpp
+0 −95 include/ableton/link/CircularFifo.hpp
+94 −87 include/ableton/link/Controller.hpp
+2 −2 include/ableton/link/Gateway.hpp
+12 −8 include/ableton/link/HostTimeFilter.hpp
+0 −143 include/ableton/link/Kalman.hpp
+27 −30 include/ableton/link/LinearRegression.hpp
+28 −47 include/ableton/link/Measurement.hpp
+3 −2 include/ableton/link/MeasurementEndpointV4.hpp
+26 −55 include/ableton/link/MeasurementService.hpp
+17 −35 include/ableton/link/Median.hpp
+2 −2 include/ableton/link/NodeId.hpp
+2 −1 include/ableton/link/NodeState.hpp
+4 −2 include/ableton/link/PeerState.hpp
+45 −74 include/ableton/link/Peers.hpp
+2 −13 include/ableton/link/PingResponder.hpp
+34 −0 include/ableton/link/SessionState.hpp
+4 −7 include/ableton/link/Sessions.hpp
+2 −2 include/ableton/link/StartStopState.hpp
+2 −1 include/ableton/link/Timeline.hpp
+121 −0 include/ableton/link/TripleBuffer.hpp
+2 −2 include/ableton/link/v1/Messages.hpp
+24 −4 include/ableton/platforms/Config.hpp
+2 −0 include/ableton/platforms/asio/AsioWrapper.hpp
+33 −29 include/ableton/platforms/asio/Context.hpp
+3 −7 include/ableton/platforms/asio/LockFreeCallbackDispatcher.hpp
+48 −0 include/ableton/platforms/darwin/ThreadFactory.hpp
+34 −14 include/ableton/platforms/esp32/Context.hpp
+1 −1 include/ableton/platforms/esp32/LockFreeCallbackDispatcher.hpp
+3 −2 include/ableton/platforms/esp32/ScanIpIfAddrs.hpp
+4 −0 include/ableton/platforms/linux/Clock.hpp
+45 −0 include/ableton/platforms/linux/ThreadFactory.hpp
+2 −1 include/ableton/platforms/stl/Random.hpp
+52 −0 include/ableton/platforms/windows/ThreadFactory.hpp
+2 −2 include/ableton/platforms/windows/Windows.hpp
+2 −0 include/ableton/test/CatchWrapper.hpp
+0 −5 include/ableton/test/serial_io/Context.hpp
+4 −3 src/CMakeLists.txt
+35 −30 src/ableton/discovery/tst_InterfaceScanner.cpp
+154 −150 src/ableton/discovery/tst_Payload.cpp
+49 −66 src/ableton/discovery/tst_PeerGateway.cpp
+43 −54 src/ableton/discovery/tst_PeerGateways.cpp
+119 −140 src/ableton/discovery/tst_UdpMessenger.cpp
+56 −53 src/ableton/link/tst_Beats.cpp
+0 −83 src/ableton/link/tst_CircularFifo.cpp
+117 −116 src/ableton/link/tst_ClientSessionTimelines.cpp
+139 −139 src/ableton/link/tst_Controller.cpp
+27 −26 src/ableton/link/tst_HostTimeFilter.cpp
+59 −35 src/ableton/link/tst_LinearRegression.cpp
+51 −54 src/ableton/link/tst_Measurement.cpp
+66 −0 src/ableton/link/tst_Median.cpp
+87 −104 src/ableton/link/tst_Peers.cpp
+141 −138 src/ableton/link/tst_Phase.cpp
+47 −54 src/ableton/link/tst_PingResponder.cpp
+1 −1 src/ableton/link/tst_StartStopState.cpp
+44 −72 src/ableton/link/tst_Tempo.cpp
+20 −16 src/ableton/link/tst_Timeline.cpp
+165 −0 src/ableton/link/tst_TripleBuffer.cpp
+15,327 −8,974 third_party/catch/catch.hpp
1 change: 0 additions & 1 deletion third-party/link-c
Submodule link-c deleted from cfab77
3 changes: 2 additions & 1 deletion third-party/wscript
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@ top = '..'
def build_link(bld):
bld.stlib(features='c cxx cxxstlib',
source=[
'link-c/ableton_link.cpp',
'link/extensions/abl_link/src/abl_link.cpp',
],
target='link-c',
includes=[
'link/extensions/abl_link/include',
'link/include',
'link/modules/asio-standalone/asio/include',
],
Expand Down

0 comments on commit 66fe798

Please sign in to comment.