ableton-js 3.3.5 → 3.4.1

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 CHANGED
@@ -4,8 +4,23 @@ 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.4.1](https://github.com/leolabs/ableton.js/compare/v3.4.0...v3.4.1)
8
+
9
+ - :sparkles: Add a `safeStartPlaying` method that only calls `start_playing` when Live is currently stopped [`46e1354`](https://github.com/leolabs/ableton.js/commit/46e13549f0c33ef6d82d20c42df30fb8c539af32)
10
+ - :bug: Fix master track erroring because it doesn't have solo/mute properties [`3b58e72`](https://github.com/leolabs/ableton.js/commit/3b58e7205a5e547b7e0f2e0784eb9be71548ce1c)
11
+ - :mute: Don't log results of getting track view properties [`3b4a5bd`](https://github.com/leolabs/ableton.js/commit/3b4a5bd07c3be7b7ec9f2cc21574b72d1fb375b4)
12
+
13
+ #### [v3.4.0](https://github.com/leolabs/ableton.js/compare/v3.3.5...v3.4.0)
14
+
15
+ > 11 November 2023
16
+
17
+ - :bug: Fix setting quantizations not working correctly [`cd7a6e5`](https://github.com/leolabs/ableton.js/commit/cd7a6e52e65ad8dea9082b8b24afed952f6b33ad)
18
+ - :sparkles: Return mute and solo properties for each track [`5585533`](https://github.com/leolabs/ableton.js/commit/558553386dc7a0927541c2b246cc27fd86677641)
19
+
7
20
  #### [v3.3.5](https://github.com/leolabs/ableton.js/compare/v3.3.4...v3.3.5)
8
21
 
22
+ > 6 November 2023
23
+
9
24
  - :sparkles: Properly create and return scenes and tracks [`dc550f1`](https://github.com/leolabs/ableton.js/commit/dc550f15a79360caf3b247f5373a1d255b2b3476)
10
25
  - :bug: Fix `createScene` not working when no index is provided [`e6bf99b`](https://github.com/leolabs/ableton.js/commit/e6bf99b7bcbcc053a2cddd12b5a77d91f36b0430)
11
26
 
@@ -5,6 +5,37 @@ from .Device import Device
5
5
  from .Scene import Scene
6
6
  from .Track import Track
7
7
 
8
+ import Live
9
+
10
+ PLAY_QUANTIZATIONS = {
11
+ 'q_8_bars': Live.Song.Quantization.q_8_bars,
12
+ 'q_4_bars': Live.Song.Quantization.q_4_bars,
13
+ 'q_2_bars': Live.Song.Quantization.q_2_bars,
14
+ 'q_bar': Live.Song.Quantization.q_bar,
15
+ 'q_half': Live.Song.Quantization.q_half,
16
+ 'q_half_triplet': Live.Song.Quantization.q_half_triplet,
17
+ 'q_quarter': Live.Song.Quantization.q_quarter,
18
+ 'q_quarter_triplet': Live.Song.Quantization.q_quarter_triplet,
19
+ 'q_eight': Live.Song.Quantization.q_eight,
20
+ 'q_eight_triplet': Live.Song.Quantization.q_eight_triplet,
21
+ 'q_sixtenth': Live.Song.Quantization.q_sixtenth,
22
+ 'q_sixtenth_triplet': Live.Song.Quantization.q_sixtenth_triplet,
23
+ 'q_thirtytwoth': Live.Song.Quantization.q_thirtytwoth,
24
+ 'q_no_q': Live.Song.Quantization.q_no_q
25
+ }
26
+
27
+ REC_QUANTIZATIONS = {
28
+ 'rec_q_eight': Live.Song.RecordingQuantization.rec_q_eight,
29
+ 'rec_q_eight_eight_triplet': Live.Song.RecordingQuantization.rec_q_eight_eight_triplet,
30
+ 'rec_q_eight_triplet': Live.Song.RecordingQuantization.rec_q_eight_triplet,
31
+ 'rec_q_no_q': Live.Song.RecordingQuantization.rec_q_no_q,
32
+ 'rec_q_quarter': Live.Song.RecordingQuantization.rec_q_quarter,
33
+ 'rec_q_sixtenth': Live.Song.RecordingQuantization.rec_q_sixtenth,
34
+ 'rec_q_sixtenth_sixtenth_triplet': Live.Song.RecordingQuantization.rec_q_sixtenth_sixtenth_triplet,
35
+ 'rec_q_sixtenth_triplet': Live.Song.RecordingQuantization.rec_q_sixtenth_triplet,
36
+ 'rec_q_thirtysecond': Live.Song.RecordingQuantization.rec_q_thirtysecond,
37
+ }
38
+
8
39
 
9
40
  class Song(Interface):
10
41
  def __init__(self, c_instance, socket):
@@ -64,6 +95,21 @@ class Song(Interface):
64
95
  def set_appointed_device(self, ns, device_id):
65
96
  ns.appointed_device = Interface.get_obj(device_id)
66
97
 
98
+ def set_clip_trigger_quantization(self, ns, name):
99
+ quantization = PLAY_QUANTIZATIONS.get(str(name), PLAY_QUANTIZATIONS['q_bar'])
100
+ ns.clip_trigger_quantization = quantization
101
+
102
+ def set_midi_recording_quantization(self, ns, name):
103
+ quantization = REC_QUANTIZATIONS.get(str(name), REC_QUANTIZATIONS['rec_q_no_q'])
104
+ ns.midi_recording_quantization = quantization
105
+
106
+ def safe_start_playing(self, ns):
107
+ if not self.song.is_playing:
108
+ self.song.start_playing()
109
+ return True
110
+
111
+ return False
112
+
67
113
  def safe_stop_playing(self, ns):
68
114
  if self.song.is_playing:
69
115
  self.song.stop_playing()
@@ -14,9 +14,25 @@ class Track(Interface):
14
14
  return None
15
15
 
16
16
  track_id = Interface.save_obj(track)
17
+
18
+ solo = False
19
+ mute = False
20
+
21
+ try:
22
+ solo = track.solo
23
+ except:
24
+ pass
25
+
26
+ try:
27
+ mute = track.mute
28
+ except:
29
+ pass
30
+
17
31
  return {
18
32
  "id": track_id,
19
33
  "name": track.name,
34
+ "solo": solo,
35
+ "mute": mute,
20
36
  "color": track.color,
21
37
  "color_index": track.color_index,
22
38
  "is_foldable": track.is_foldable,
@@ -1 +1 @@
1
- version = "3.3.5"
1
+ version = "3.4.1"
package/ns/song.d.ts CHANGED
@@ -156,20 +156,20 @@ export declare enum TimeFormat {
156
156
  Smpte30Drop = 5
157
157
  }
158
158
  export declare enum Quantization {
159
- q_2_bars = "q_2_bars",
160
- q_4_bars = "q_4_bars",
161
159
  q_8_bars = "q_8_bars",
160
+ q_4_bars = "q_4_bars",
161
+ q_2_bars = "q_2_bars",
162
162
  q_bar = "q_bar",
163
- q_eight = "q_eight",
164
- q_eight_triplet = "q_eight_triplet",
165
163
  q_half = "q_half",
166
164
  q_half_triplet = "q_half_triplet",
167
- q_no_q = "q_no_q",
168
165
  q_quarter = "q_quarter",
169
166
  q_quarter_triplet = "q_quarter_triplet",
167
+ q_eight = "q_eight",
168
+ q_eight_triplet = "q_eight_triplet",
170
169
  q_sixtenth = "q_sixtenth",
171
170
  q_sixtenth_triplet = "q_sixtenth_triplet",
172
- q_thirtytwoth = "q_thirtytwoth"
171
+ q_thirtytwoth = "q_thirtytwoth",
172
+ q_no_q = "q_no_q"
173
173
  }
174
174
  export declare enum RecordingQuantization {
175
175
  rec_q_eight = "rec_q_eight",
@@ -211,7 +211,22 @@ export declare class Song extends Namespace<GettableProperties, TransformedPrope
211
211
  startPlaying(): Promise<any>;
212
212
  stopAllClips(): Promise<any>;
213
213
  stopPlaying(): Promise<any>;
214
- safeStopPlaying(): Promise<any>;
214
+ /**
215
+ * Only starts playing when Live is currently not playing
216
+ * to prevent Live from jumping back to the start when it's
217
+ * already playing.
218
+ *
219
+ * @returns a boolean indicating whether the command was executed
220
+ */
221
+ safeStartPlaying(): Promise<boolean>;
222
+ /**
223
+ * Only stops playback when Live is currently playing to prevent
224
+ * Live jumping back to the beginning of the arrangement when it's
225
+ * already stopped.
226
+ *
227
+ * @returns a boolean indicating whether the command was executed
228
+ */
229
+ safeStopPlaying(): Promise<boolean>;
215
230
  tapTempo(): Promise<any>;
216
231
  undo(): Promise<any>;
217
232
  }
package/ns/song.js CHANGED
@@ -17,20 +17,20 @@ var TimeFormat;
17
17
  })(TimeFormat || (exports.TimeFormat = TimeFormat = {}));
18
18
  var Quantization;
19
19
  (function (Quantization) {
20
- Quantization["q_2_bars"] = "q_2_bars";
21
- Quantization["q_4_bars"] = "q_4_bars";
22
20
  Quantization["q_8_bars"] = "q_8_bars";
21
+ Quantization["q_4_bars"] = "q_4_bars";
22
+ Quantization["q_2_bars"] = "q_2_bars";
23
23
  Quantization["q_bar"] = "q_bar";
24
- Quantization["q_eight"] = "q_eight";
25
- Quantization["q_eight_triplet"] = "q_eight_triplet";
26
24
  Quantization["q_half"] = "q_half";
27
25
  Quantization["q_half_triplet"] = "q_half_triplet";
28
- Quantization["q_no_q"] = "q_no_q";
29
26
  Quantization["q_quarter"] = "q_quarter";
30
27
  Quantization["q_quarter_triplet"] = "q_quarter_triplet";
28
+ Quantization["q_eight"] = "q_eight";
29
+ Quantization["q_eight_triplet"] = "q_eight_triplet";
31
30
  Quantization["q_sixtenth"] = "q_sixtenth";
32
31
  Quantization["q_sixtenth_triplet"] = "q_sixtenth_triplet";
33
32
  Quantization["q_thirtytwoth"] = "q_thirtytwoth";
33
+ Quantization["q_no_q"] = "q_no_q";
34
34
  })(Quantization || (exports.Quantization = Quantization = {}));
35
35
  var RecordingQuantization;
36
36
  (function (RecordingQuantization) {
@@ -147,6 +147,23 @@ class Song extends _1.Namespace {
147
147
  async stopPlaying() {
148
148
  return this.sendCommand("stop_playing");
149
149
  }
150
+ /**
151
+ * Only starts playing when Live is currently not playing
152
+ * to prevent Live from jumping back to the start when it's
153
+ * already playing.
154
+ *
155
+ * @returns a boolean indicating whether the command was executed
156
+ */
157
+ async safeStartPlaying() {
158
+ return this.sendCommand("safe_start_playing");
159
+ }
160
+ /**
161
+ * Only stops playback when Live is currently playing to prevent
162
+ * Live jumping back to the beginning of the arrangement when it's
163
+ * already stopped.
164
+ *
165
+ * @returns a boolean indicating whether the command was executed
166
+ */
150
167
  async safeStopPlaying() {
151
168
  return this.sendCommand("safe_stop_playing");
152
169
  }
package/ns/track.d.ts CHANGED
@@ -147,6 +147,8 @@ export interface RawTrack {
147
147
  color_index: number;
148
148
  is_foldable: boolean;
149
149
  is_grouped: boolean;
150
+ mute: boolean;
151
+ solo: boolean;
150
152
  }
151
153
  export declare class Track extends Namespace<GettableProperties, TransformedProperties, SettableProperties, ObservableProperties> {
152
154
  raw: RawTrack;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ableton-js",
3
- "version": "3.3.5",
3
+ "version": "3.4.1",
4
4
  "description": "Control Ableton Live from Node",
5
5
  "main": "index.js",
6
6
  "author": "Leo Bernard <admin@leolabs.org>",