ableton-js 2.5.4 → 2.6.0

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,15 @@ 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
+ #### [v2.6.0](https://github.com/leolabs/ableton.js/compare/v2.5.4...v2.6.0)
8
+
9
+ - :sparkles: Make IDs stable over the lifespan of Live [`0bfcf90`](https://github.com/leolabs/ableton.js/commit/0bfcf904b54d42377877a2e9fab0796986f6aa1a)
10
+ - :sparkles: Add create_track methods [`a7dd6bc`](https://github.com/leolabs/ableton.js/commit/a7dd6bc53e2f49fb133b2eea2a1fe6eb1ff0aac6)
11
+
7
12
  #### [v2.5.4](https://github.com/leolabs/ableton.js/compare/v2.5.3...v2.5.4)
8
13
 
14
+ > 19 October 2022
15
+
9
16
  - :sparkles: Restart the socket when a message can't be sent due to a socket error [`91294c3`](https://github.com/leolabs/ableton.js/commit/91294c3cf195afacd22cbf1863e244bc231c9a33)
10
17
  - :sparkles: Send the UUID back with the error if a requested namespace handler doesn't exist [`8a96a99`](https://github.com/leolabs/ableton.js/commit/8a96a996b8b65c8485d90ac98293ccd605497784)
11
18
  - :memo: Add an example for setting a value [`f334983`](https://github.com/leolabs/ableton.js/commit/f334983a8755eab8415383aae7aff1ecff6e23e2)
package/index.d.ts CHANGED
@@ -7,7 +7,7 @@ import { Midi } from "./ns/midi";
7
7
  interface Command {
8
8
  uuid: string;
9
9
  ns: string;
10
- nsid?: number;
10
+ nsid?: string;
11
11
  name: string;
12
12
  args?: {
13
13
  [k: string]: any;
@@ -61,11 +61,11 @@ export declare class Ableton extends EventEmitter implements ConnectionEventEmit
61
61
  * Sends a raw command to Ableton. Usually, you won't need this.
62
62
  * A good starting point in general is the `song` prop.
63
63
  */
64
- sendCommand(ns: string, nsid: number | undefined, name: string, args?: Record<string, any> | any[], timeout?: number): Promise<any>;
65
- getProp(ns: string, nsid: number | undefined, prop: string): Promise<any>;
66
- setProp(ns: string, nsid: number | undefined, prop: string, value: any): Promise<any>;
67
- addPropListener(ns: string, nsid: number | undefined, prop: string, listener: (data: any) => any): Promise<() => Promise<boolean | undefined>>;
68
- removePropListener(ns: string, nsid: number | undefined, prop: string, eventId: string, listener: (data: any) => any): Promise<boolean | undefined>;
64
+ sendCommand(ns: string, nsid: string | undefined, name: string, args?: Record<string, any> | any[], timeout?: number): Promise<any>;
65
+ getProp(ns: string, nsid: string | undefined, prop: string): Promise<any>;
66
+ setProp(ns: string, nsid: string | undefined, prop: string, value: any): Promise<any>;
67
+ addPropListener(ns: string, nsid: string | undefined, prop: string, listener: (data: any) => any): Promise<() => Promise<boolean | undefined>>;
68
+ removePropListener(ns: string, nsid: string | undefined, prop: string, eventId: string, listener: (data: any) => any): Promise<boolean | undefined>;
69
69
  /**
70
70
  * Removes all event listeners that were attached to properties.
71
71
  * This is useful for clearing all listeners when Live
@@ -4,7 +4,11 @@ class Interface(object):
4
4
 
5
5
  @staticmethod
6
6
  def save_obj(obj):
7
- obj_id = id(obj)
7
+ try:
8
+ obj_id = "live_" + str(obj._live_ptr)
9
+ except:
10
+ obj_id = "id_" + str(id(obj))
11
+
8
12
  Interface.obj_ids[obj_id] = obj
9
13
  return obj_id
10
14
 
@@ -10,4 +10,4 @@ class Internal(Interface):
10
10
  return self
11
11
 
12
12
  def get_version(self, ns):
13
- return "2.5.4"
13
+ return "2.6.0"
@@ -8,9 +8,19 @@ from .Track import Track
8
8
  class Song(Interface):
9
9
  def __init__(self, c_instance, socket):
10
10
  super(Song, self).__init__(c_instance, socket)
11
+ self.song = self.ableton.song()
11
12
 
12
13
  def get_ns(self, nsid):
13
- return self.ableton.song()
14
+ return self.song
15
+
16
+ def create_audio_track(self, ns, index):
17
+ return Track.serialize_track(ns.create_audio_track(index))
18
+
19
+ def create_midi_track(self, ns, index):
20
+ return Track.serialize_track(ns.create_midi_track(index))
21
+
22
+ def create_return_track(self, ns):
23
+ return Track.serialize_track(ns.create_return_track())
14
24
 
15
25
  def get_clip_trigger_quantization(self, ns):
16
26
  return str(ns.clip_trigger_quantization)
@@ -26,7 +26,6 @@ class Track(Interface):
26
26
  def get_clip_slots(self, ns):
27
27
  return list(map(ClipSlot.serialize_clip_slot, ns.clip_slots))
28
28
 
29
-
30
29
  def get_group_track(self, ns):
31
30
  return Track.serialize_track(ns.group_track)
32
31
 
package/ns/clip-slot.d.ts CHANGED
@@ -39,7 +39,7 @@ export interface ObservableProperties {
39
39
  playing_status: PlayingStatus;
40
40
  }
41
41
  export interface RawClipSlot {
42
- id: number;
42
+ id: string;
43
43
  color: number;
44
44
  has_clip: boolean;
45
45
  is_playing: boolean;
package/ns/clip.d.ts CHANGED
@@ -128,7 +128,7 @@ export interface ObservableProperties {
128
128
  warping: boolean;
129
129
  }
130
130
  export interface RawClip {
131
- id: number;
131
+ id: string;
132
132
  name: string;
133
133
  color: number;
134
134
  is_audio_clip: boolean;
package/ns/cue-point.d.ts CHANGED
@@ -13,7 +13,7 @@ export interface ObservableProperties {
13
13
  time: number;
14
14
  }
15
15
  export interface RawCuePoint {
16
- id: number;
16
+ id: string;
17
17
  name: string;
18
18
  time: number;
19
19
  }
@@ -25,7 +25,7 @@ export interface ObservableProperties {
25
25
  value: number;
26
26
  }
27
27
  export interface RawDeviceParameter {
28
- id: number;
28
+ id: string;
29
29
  name: string;
30
30
  value: number;
31
31
  is_quantized: boolean;
package/ns/device.d.ts CHANGED
@@ -24,7 +24,7 @@ export interface ObservableProperties {
24
24
  parameters: string;
25
25
  }
26
26
  export interface RawDevice {
27
- id: number;
27
+ id: string;
28
28
  name: string;
29
29
  type: DeviceType;
30
30
  class_name: string;
package/ns/index.d.ts CHANGED
@@ -2,8 +2,8 @@ import { Ableton } from "..";
2
2
  export declare class Namespace<GP, TP, SP, OP> {
3
3
  protected ableton: Ableton;
4
4
  protected ns: string;
5
- protected nsid?: number | undefined;
6
- constructor(ableton: Ableton, ns: string, nsid?: number | undefined);
5
+ protected nsid?: string | undefined;
6
+ constructor(ableton: Ableton, ns: string, nsid?: string | undefined);
7
7
  protected transformers: Partial<{
8
8
  [T in Extract<keyof GP, keyof TP>]: (val: GP[T]) => TP[T];
9
9
  }>;
package/ns/scene.d.ts CHANGED
@@ -29,7 +29,7 @@ export interface ObservableProperties {
29
29
  }
30
30
  export interface RawScene {
31
31
  color: number;
32
- id: number;
32
+ id: string;
33
33
  name: string;
34
34
  }
35
35
  export declare class Scene extends Namespace<GettableProperties, TransformedProperties, SettableProperties, ObservableProperties> {
package/ns/track.d.ts CHANGED
@@ -111,7 +111,7 @@ export interface ObservableProperties {
111
111
  solo: boolean;
112
112
  }
113
113
  export interface RawTrack {
114
- id: number;
114
+ id: string;
115
115
  name: string;
116
116
  color: number;
117
117
  is_foldable: boolean;
package/ns/track.js CHANGED
@@ -41,7 +41,7 @@ var Track = /** @class */ (function (_super) {
41
41
  Track.prototype.duplicateClipToArrangement = function (clipID, time) {
42
42
  return this.sendCommand("duplicate_clip_to_arrangement", {
43
43
  clip_id: clipID,
44
- time: time
44
+ time: time,
45
45
  });
46
46
  };
47
47
  return Track;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ableton-js",
3
- "version": "2.5.4",
3
+ "version": "2.6.0",
4
4
  "description": "Control Ableton Live from Node",
5
5
  "main": "index.js",
6
6
  "author": "Leo Bernard <admin@leolabs.org>",