1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
|
abletonlink
===========
Lightweight Lua wrapper of the Ableton Link C API ([abl_link][abl_link]).
API
---
The module follows the C API very closely.
See the [`abl_link.h`][abl_link.h] for comments for the various methods.
The module table has three members:
- `abletonlink._VERSION`: a string like `"1.0.0"`
- `abletonlink.create(number bpm)`: creates an `abl_link` instance
- `abletonlink.create_session_state()`: creates an `abl_link_session_state` instance
`abl_link` instances have the following methods:
- `link:is_enabled() -> bool`
- `link:enable(bool?)` (defaults to true)
- `link:is_start_stop_sync_enabled() -> bool`
- `link:enable_start_stop_sync(bool?)` (defaults to true)
- `link:num_peers() -> int`
- `link:clock_micros() -> int`
- `link:capture_audio_session_state(session_state output)`
- `link:commit_audio_session_state(session_state input)`
- `link:capture_app_session_state(session_state output)`
- `link:commit_app_session_state(session_state input)`
- `link:destroy()`:
Destroys this instance.
Calling any other method on a destroyed instance causes an error.
This is automatically called in __gc.
- `link:pump_events()`:
If callbacks are installed, this needs to be called regularily to dispatch events.
It will return `true` if the internal event queue overran.
- `link:set_num_peers_callback(cb)`: cb is called with number of peers (int).
- `link:set_tempo_callback(cb)`: cb is called with new tempo (int).
- `link:set_start_stop_callback(cb)`: cb is called with playing state (bool).
`abl_link_session_state` instances have the following methods:
- `session_state:tempo() -> number`
- `session_state:set_tempo(number bpm, int at_time)`
- `session_state:beat_at_time(int time, number quantum) -> number`
- `session_state:phase_at_time(int time, number quantum) -> number`
- `session_state:time_at_beat(number beat, number quantum) -> int`
- `session_state:request_beat_at_time(number beat, int time, number quantum)`
- `session_state:force_beat_at_time(number beat, int time, number quantum)`
- `session_state:set_is_playing(bool, int at_time)`
- `session_state:is_playing() -> bool`
- `session_state:time_for_is_playing() -> int`
- `session_state:request_beat_at_start_playing_time(number beat, number quantum)`
- `session_state:set_is_playing_and_request_beat_at_time(bool, int time, number beat, number quantum)`
- `session_state:destroy()`:
Destroys this instance.
Calling any other method on a destroyed instance causes an error.
This is automatically called in __gc.
[abl_link]: https://github.com/Ableton/link/tree/master/extensions/abl_link
[abl_link.h]: https://github.com/Ableton/link/blob/master/extensions/abl_link/include/abl_link.h
|