ableton-js 3.3.3 → 3.3.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +8 -0
- package/midi-script/AbletonJS.py +7 -4
- package/midi-script/Midi.py +2 -2
- package/midi-script/Socket.py +1 -1
- package/midi-script/Song.py +6 -8
- package/midi-script/TrackView.py +24 -0
- package/midi-script/version.py +1 -1
- package/ns/song.d.ts +1 -7
- package/ns/song.js +4 -10
- package/ns/track-view.d.ts +30 -0
- package/ns/track-view.js +29 -0
- package/ns/track.d.ts +2 -0
- package/ns/track.js +3 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -4,8 +4,16 @@ All notable changes to this project will be documented in this file. Dates are d
|
|
|
4
4
|
|
|
5
5
|
Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
|
6
6
|
|
|
7
|
+
#### [v3.3.4](https://github.com/leolabs/ableton.js/compare/v3.3.3...v3.3.4)
|
|
8
|
+
|
|
9
|
+
- :sparkles: Add support for the Track View class [`3ff5980`](https://github.com/leolabs/ableton.js/commit/3ff5980e5e5f407bc6b767a5329b54774ca10534)
|
|
10
|
+
- :sparkles: Add a `safeStopPlaying` function that only stops playback when Live is currently playing to prevent accidental jumps to the beginning of the timeline [`a7b84e2`](https://github.com/leolabs/ableton.js/commit/a7b84e2146a69ab00cc75f83a4eedd5d91495eda)
|
|
11
|
+
- :art: Fix formatting [`f06d3d0`](https://github.com/leolabs/ableton.js/commit/f06d3d0cde4632612b1db8ea04e85f1276eb8bb6)
|
|
12
|
+
|
|
7
13
|
#### [v3.3.3](https://github.com/leolabs/ableton.js/compare/v3.3.2...v3.3.3)
|
|
8
14
|
|
|
15
|
+
> 10 September 2023
|
|
16
|
+
|
|
9
17
|
- :mute: Fix every message being logged twice [`3a2571f`](https://github.com/leolabs/ableton.js/commit/3a2571f0a4ad61fdf751a0dfbb5da00b6def8508)
|
|
10
18
|
- :wastebasket: Deprecate `removeNotes` and add `removeNotesExtended` as a replacement [`ac02271`](https://github.com/leolabs/ableton.js/commit/ac022718f0b16317d8fdf70ff1c8d77eaaa0f384)
|
|
11
19
|
- :bug: Address a hang in newer versions of Live when the UDP port is already being used [`5caeaeb`](https://github.com/leolabs/ableton.js/commit/5caeaebc172fc819693c988643071c565e4dbcd3)
|
package/midi-script/AbletonJS.py
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
from __future__ import absolute_import
|
|
2
2
|
import time
|
|
3
3
|
|
|
4
|
+
|
|
4
5
|
from .version import version
|
|
5
6
|
from .Config import DEBUG, FAST_POLLING
|
|
6
7
|
from .Logging import logger
|
|
@@ -18,6 +19,7 @@ from .Scene import Scene
|
|
|
18
19
|
from .Song import Song
|
|
19
20
|
from .SongView import SongView
|
|
20
21
|
from .Track import Track
|
|
22
|
+
from .TrackView import TrackView
|
|
21
23
|
from .Internal import Internal
|
|
22
24
|
from .ClipSlot import ClipSlot
|
|
23
25
|
from .Clip import Clip
|
|
@@ -52,6 +54,7 @@ class AbletonJS(ControlSurface):
|
|
|
52
54
|
"song": Song(c_instance, self.socket),
|
|
53
55
|
"song-view": SongView(c_instance, self.socket),
|
|
54
56
|
"track": Track(c_instance, self.socket),
|
|
57
|
+
"track-view": TrackView(c_instance, self.socket),
|
|
55
58
|
"clip_slot": ClipSlot(c_instance, self.socket),
|
|
56
59
|
"clip": Clip(c_instance, self.socket),
|
|
57
60
|
}
|
|
@@ -69,8 +72,8 @@ class AbletonJS(ControlSurface):
|
|
|
69
72
|
tick_time = time.time() * 1000
|
|
70
73
|
|
|
71
74
|
if tick_time - self._last_tick > 200:
|
|
72
|
-
logger.
|
|
73
|
-
|
|
75
|
+
logger.warning("UDP tick is lagging, delta: " +
|
|
76
|
+
str(round(tick_time - self._last_tick)) + "ms")
|
|
74
77
|
|
|
75
78
|
self._last_tick = tick_time
|
|
76
79
|
self.socket.process()
|
|
@@ -78,8 +81,8 @@ class AbletonJS(ControlSurface):
|
|
|
78
81
|
process_time = time.time() * 1000
|
|
79
82
|
|
|
80
83
|
if process_time - tick_time > 100:
|
|
81
|
-
logger.
|
|
82
|
-
|
|
84
|
+
logger.warning("UDP processing is taking long, delta: " +
|
|
85
|
+
str(round(tick_time - process_time)) + "ms")
|
|
83
86
|
|
|
84
87
|
self.schedule_message(1, self.tick)
|
|
85
88
|
|
package/midi-script/Midi.py
CHANGED
|
@@ -40,10 +40,10 @@ class Midi(Interface):
|
|
|
40
40
|
raise Exception("Listener " + str(prop) + " does not exist.")
|
|
41
41
|
|
|
42
42
|
if self.event_id is not None:
|
|
43
|
-
logger.
|
|
43
|
+
logger.warning("MIDI listener already exists")
|
|
44
44
|
return self.event_id
|
|
45
45
|
|
|
46
|
-
logger.info("Attaching
|
|
46
|
+
logger.info("Attaching MIDI listener")
|
|
47
47
|
|
|
48
48
|
self.tracked_midi.clear()
|
|
49
49
|
self.tracked_midi.update(self.outputs)
|
package/midi-script/Socket.py
CHANGED
|
@@ -46,7 +46,7 @@ class Socket(object):
|
|
|
46
46
|
logger.error(msg)
|
|
47
47
|
|
|
48
48
|
def set_client_port(self, port):
|
|
49
|
-
logger.info("Setting client port: "
|
|
49
|
+
logger.info("Setting client port: " + str(port))
|
|
50
50
|
self.show_message("Client connected on port " + str(port))
|
|
51
51
|
self._client_addr = ("127.0.0.1", int(port))
|
|
52
52
|
|
package/midi-script/Song.py
CHANGED
|
@@ -4,17 +4,12 @@ from .CuePoint import CuePoint
|
|
|
4
4
|
from .Device import Device
|
|
5
5
|
from .Scene import Scene
|
|
6
6
|
from .Track import Track
|
|
7
|
-
import Live
|
|
8
7
|
|
|
9
|
-
INSERT_MODES = {'default':Live.Track.DeviceInsertMode.default,
|
|
10
|
-
'left':Live.Track.DeviceInsertMode.selected_left,
|
|
11
|
-
'right':Live.Track.DeviceInsertMode.selected_right}
|
|
12
8
|
|
|
13
9
|
class Song(Interface):
|
|
14
10
|
def __init__(self, c_instance, socket):
|
|
15
11
|
super(Song, self).__init__(c_instance, socket)
|
|
16
12
|
self.song = self.ableton.song()
|
|
17
|
-
self._insert_mode = INSERT_MODES['default']
|
|
18
13
|
|
|
19
14
|
def get_ns(self, nsid):
|
|
20
15
|
return self.song
|
|
@@ -66,6 +61,9 @@ class Song(Interface):
|
|
|
66
61
|
def set_appointed_device(self, ns, device_id):
|
|
67
62
|
ns.appointed_device = Interface.get_obj(device_id)
|
|
68
63
|
|
|
69
|
-
def
|
|
70
|
-
self.
|
|
71
|
-
|
|
64
|
+
def safe_stop_playing(self, ns):
|
|
65
|
+
if self.song.is_playing:
|
|
66
|
+
self.song.stop_playing()
|
|
67
|
+
return True
|
|
68
|
+
|
|
69
|
+
return False
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
from __future__ import absolute_import
|
|
2
|
+
from .Interface import Interface
|
|
3
|
+
from .Device import Device
|
|
4
|
+
|
|
5
|
+
import Live
|
|
6
|
+
|
|
7
|
+
INSERT_MODES = {'default': Live.Track.DeviceInsertMode.default,
|
|
8
|
+
'left': Live.Track.DeviceInsertMode.selected_left,
|
|
9
|
+
'right': Live.Track.DeviceInsertMode.selected_right}
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
class TrackView(Interface):
|
|
13
|
+
def __init__(self, c_instance, socket):
|
|
14
|
+
super(TrackView, self).__init__(c_instance, socket)
|
|
15
|
+
|
|
16
|
+
def get_ns(self, nsid):
|
|
17
|
+
return Interface.obj_ids[nsid].view
|
|
18
|
+
|
|
19
|
+
def get_selected_device(self, ns):
|
|
20
|
+
return Device.serialize_device(ns.selected_device)
|
|
21
|
+
|
|
22
|
+
def set_device_insert_mode(self, ns, name):
|
|
23
|
+
mode = INSERT_MODES.get(str(name), INSERT_MODES['default'])
|
|
24
|
+
ns.device_insert_mode = mode
|
package/midi-script/version.py
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
version = "3.3.
|
|
1
|
+
version = "3.3.4"
|
package/ns/song.d.ts
CHANGED
|
@@ -61,11 +61,6 @@ export interface TransformedProperties {
|
|
|
61
61
|
visible_tracks: Track[];
|
|
62
62
|
scenes: Scene[];
|
|
63
63
|
}
|
|
64
|
-
export declare enum DeviceInsertMode {
|
|
65
|
-
default = "default",
|
|
66
|
-
left = "left",
|
|
67
|
-
right = "right"
|
|
68
|
-
}
|
|
69
64
|
export interface SettableProperties {
|
|
70
65
|
appointed_device: string;
|
|
71
66
|
arrangement_overdub: boolean;
|
|
@@ -76,7 +71,6 @@ export interface SettableProperties {
|
|
|
76
71
|
exclusive_arm: number;
|
|
77
72
|
exclusive_solo: number;
|
|
78
73
|
groove_amount: number;
|
|
79
|
-
insert_mode: DeviceInsertMode;
|
|
80
74
|
is_counting_in: boolean;
|
|
81
75
|
is_playing: boolean;
|
|
82
76
|
last_event_time: number;
|
|
@@ -217,7 +211,7 @@ export declare class Song extends Namespace<GettableProperties, TransformedPrope
|
|
|
217
211
|
startPlaying(): Promise<any>;
|
|
218
212
|
stopAllClips(): Promise<any>;
|
|
219
213
|
stopPlaying(): Promise<any>;
|
|
214
|
+
safeStopPlaying(): Promise<any>;
|
|
220
215
|
tapTempo(): Promise<any>;
|
|
221
216
|
undo(): Promise<any>;
|
|
222
|
-
set_insert_mode(args: DeviceInsertMode): Promise<any>;
|
|
223
217
|
}
|
package/ns/song.js
CHANGED
|
@@ -1,17 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Song = exports.RecordingQuantization = exports.Quantization = exports.TimeFormat =
|
|
3
|
+
exports.Song = exports.RecordingQuantization = exports.Quantization = exports.TimeFormat = void 0;
|
|
4
4
|
const _1 = require(".");
|
|
5
5
|
const track_1 = require("./track");
|
|
6
6
|
const cue_point_1 = require("./cue-point");
|
|
7
7
|
const song_view_1 = require("./song-view");
|
|
8
8
|
const scene_1 = require("./scene");
|
|
9
|
-
var DeviceInsertMode;
|
|
10
|
-
(function (DeviceInsertMode) {
|
|
11
|
-
DeviceInsertMode["default"] = "default";
|
|
12
|
-
DeviceInsertMode["left"] = "left";
|
|
13
|
-
DeviceInsertMode["right"] = "right";
|
|
14
|
-
})(DeviceInsertMode || (exports.DeviceInsertMode = DeviceInsertMode = {}));
|
|
15
9
|
var TimeFormat;
|
|
16
10
|
(function (TimeFormat) {
|
|
17
11
|
TimeFormat[TimeFormat["MsTime"] = 0] = "MsTime";
|
|
@@ -149,14 +143,14 @@ class Song extends _1.Namespace {
|
|
|
149
143
|
async stopPlaying() {
|
|
150
144
|
return this.sendCommand("stop_playing");
|
|
151
145
|
}
|
|
146
|
+
async safeStopPlaying() {
|
|
147
|
+
return this.sendCommand("safe_stop_playing");
|
|
148
|
+
}
|
|
152
149
|
async tapTempo() {
|
|
153
150
|
return this.sendCommand("tap_tempo");
|
|
154
151
|
}
|
|
155
152
|
async undo() {
|
|
156
153
|
return this.sendCommand("undo");
|
|
157
154
|
}
|
|
158
|
-
async set_insert_mode(args) {
|
|
159
|
-
return this.sendCommand("set_insert_mode", { args });
|
|
160
|
-
}
|
|
161
155
|
}
|
|
162
156
|
exports.Song = Song;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { Ableton } from "..";
|
|
2
|
+
import { Namespace } from ".";
|
|
3
|
+
import { Device, RawDevice } from "./device";
|
|
4
|
+
export declare enum DeviceInsertMode {
|
|
5
|
+
Default = "default",
|
|
6
|
+
Left = "left",
|
|
7
|
+
Right = "right"
|
|
8
|
+
}
|
|
9
|
+
export interface GettableProperties {
|
|
10
|
+
is_collapsed: boolean;
|
|
11
|
+
selected_device: RawDevice;
|
|
12
|
+
}
|
|
13
|
+
export interface TransformedProperties {
|
|
14
|
+
selected_device: Device;
|
|
15
|
+
}
|
|
16
|
+
export interface SettableProperties {
|
|
17
|
+
device_insert_mode: DeviceInsertMode;
|
|
18
|
+
is_collapsed: boolean;
|
|
19
|
+
}
|
|
20
|
+
export interface ObservableProperties {
|
|
21
|
+
is_collapsed: boolean;
|
|
22
|
+
selected_device: RawDevice;
|
|
23
|
+
}
|
|
24
|
+
export declare class TrackView extends Namespace<GettableProperties, TransformedProperties, SettableProperties, ObservableProperties> {
|
|
25
|
+
constructor(ableton: Ableton, nsid: string);
|
|
26
|
+
/**
|
|
27
|
+
* Selects the track's instrument if it has one.
|
|
28
|
+
*/
|
|
29
|
+
selectInstrument(): Promise<any>;
|
|
30
|
+
}
|
package/ns/track-view.js
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TrackView = exports.DeviceInsertMode = void 0;
|
|
4
|
+
const _1 = require(".");
|
|
5
|
+
const device_1 = require("./device");
|
|
6
|
+
var DeviceInsertMode;
|
|
7
|
+
(function (DeviceInsertMode) {
|
|
8
|
+
DeviceInsertMode["Default"] = "default";
|
|
9
|
+
DeviceInsertMode["Left"] = "left";
|
|
10
|
+
DeviceInsertMode["Right"] = "right";
|
|
11
|
+
})(DeviceInsertMode || (exports.DeviceInsertMode = DeviceInsertMode = {}));
|
|
12
|
+
class TrackView extends _1.Namespace {
|
|
13
|
+
constructor(ableton, nsid) {
|
|
14
|
+
super(ableton, "track-view", nsid);
|
|
15
|
+
this.transformers = {
|
|
16
|
+
selected_device: (device) => new device_1.Device(ableton, device),
|
|
17
|
+
};
|
|
18
|
+
this.cachedProps = {
|
|
19
|
+
selected_device: true,
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Selects the track's instrument if it has one.
|
|
24
|
+
*/
|
|
25
|
+
async selectInstrument() {
|
|
26
|
+
return this.sendCommand("select_instrument");
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
exports.TrackView = TrackView;
|
package/ns/track.d.ts
CHANGED
|
@@ -5,6 +5,7 @@ import { ClipSlot, RawClipSlot } from "./clip-slot";
|
|
|
5
5
|
import { MixerDevice, RawMixerDevice } from "./mixer-device";
|
|
6
6
|
import { Clip, RawClip } from "./clip";
|
|
7
7
|
import { Color } from "../util/color";
|
|
8
|
+
import { TrackView } from "./track-view";
|
|
8
9
|
export declare enum RoutingLayout {
|
|
9
10
|
Mono = 1,
|
|
10
11
|
Stereo = 2
|
|
@@ -149,6 +150,7 @@ export interface RawTrack {
|
|
|
149
150
|
}
|
|
150
151
|
export declare class Track extends Namespace<GettableProperties, TransformedProperties, SettableProperties, ObservableProperties> {
|
|
151
152
|
raw: RawTrack;
|
|
153
|
+
view: TrackView;
|
|
152
154
|
constructor(ableton: Ableton, raw: RawTrack);
|
|
153
155
|
/**
|
|
154
156
|
* Duplicates the given clip into the arrangement of this track at the provided destination time and returns it.
|
package/ns/track.js
CHANGED
|
@@ -7,6 +7,7 @@ const clip_slot_1 = require("./clip-slot");
|
|
|
7
7
|
const mixer_device_1 = require("./mixer-device");
|
|
8
8
|
const clip_1 = require("./clip");
|
|
9
9
|
const color_1 = require("../util/color");
|
|
10
|
+
const track_view_1 = require("./track-view");
|
|
10
11
|
var RoutingLayout;
|
|
11
12
|
(function (RoutingLayout) {
|
|
12
13
|
RoutingLayout[RoutingLayout["Mono"] = 1] = "Mono";
|
|
@@ -25,9 +26,11 @@ var RoutingCategory;
|
|
|
25
26
|
})(RoutingCategory || (exports.RoutingCategory = RoutingCategory = {}));
|
|
26
27
|
class Track extends _1.Namespace {
|
|
27
28
|
raw;
|
|
29
|
+
view;
|
|
28
30
|
constructor(ableton, raw) {
|
|
29
31
|
super(ableton, "track", raw.id);
|
|
30
32
|
this.raw = raw;
|
|
33
|
+
this.view = new track_view_1.TrackView(this.ableton, raw.id);
|
|
31
34
|
this.transformers = {
|
|
32
35
|
arrangement_clips: (clips) => clips.map((clip) => new clip_1.Clip(ableton, clip)),
|
|
33
36
|
color: (c) => new color_1.Color(c),
|