ableton-js 3.1.9 → 3.2.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 +8 -0
- package/README.md +2 -5
- package/index.d.ts +36 -4
- package/index.js +316 -528
- package/midi-script/version.py +1 -1
- package/ns/application-view.d.ts +3 -3
- package/ns/application-view.js +30 -116
- package/ns/application-view.spec.js +7 -57
- package/ns/application.js +10 -68
- package/ns/application.spec.js +7 -57
- package/ns/clip-slot.js +26 -43
- package/ns/clip.js +68 -132
- package/ns/cue-point.js +10 -67
- package/ns/device-parameter.js +9 -26
- package/ns/device.js +12 -29
- package/ns/index.d.ts +2 -2
- package/ns/index.js +47 -98
- package/ns/internal.js +11 -73
- package/ns/midi.js +18 -36
- package/ns/mixer-device.js +20 -37
- package/ns/mixer-device.spec.js +9 -64
- package/ns/scene.js +14 -73
- package/ns/song-view.js +21 -79
- package/ns/song-view.spec.js +7 -57
- package/ns/song.js +105 -271
- package/ns/song.spec.js +25 -112
- package/ns/track.js +23 -44
- package/package.json +5 -5
- package/util/cache.d.ts +3 -3
- package/util/cache.js +1 -3
- package/util/color.js +21 -33
- package/util/note.d.ts +1 -1
- package/util/note.js +4 -4
- package/util/package-version.js +5 -5
- package/util/package-version.spec.js +6 -6
- package/util/tests.js +12 -62
package/midi-script/version.py
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
version = "3.
|
|
1
|
+
version = "3.2.0"
|
package/ns/application-view.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Ableton } from "..";
|
|
2
2
|
import { Namespace } from ".";
|
|
3
|
-
export
|
|
4
|
-
export
|
|
5
|
-
export
|
|
3
|
+
export type DocumentView = "Session" | "Arranger";
|
|
4
|
+
export type DetailView = "Detail" | "Detail/Clip" | "Detail/DeviceChain";
|
|
5
|
+
export type View = "Browser" | DocumentView | DetailView;
|
|
6
6
|
export declare enum NavDirection {
|
|
7
7
|
Up = 0,
|
|
8
8
|
Down = 1,
|
package/ns/application-view.js
CHANGED
|
@@ -1,127 +1,41 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __extends = (this && this.__extends) || (function () {
|
|
3
|
-
var extendStatics = function (d, b) {
|
|
4
|
-
extendStatics = Object.setPrototypeOf ||
|
|
5
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
-
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
-
return extendStatics(d, b);
|
|
8
|
-
};
|
|
9
|
-
return function (d, b) {
|
|
10
|
-
if (typeof b !== "function" && b !== null)
|
|
11
|
-
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
12
|
-
extendStatics(d, b);
|
|
13
|
-
function __() { this.constructor = d; }
|
|
14
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
|
-
};
|
|
16
|
-
})();
|
|
17
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
18
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
19
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
20
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
21
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
22
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
23
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
24
|
-
});
|
|
25
|
-
};
|
|
26
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
27
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
28
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
29
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
30
|
-
function step(op) {
|
|
31
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
32
|
-
while (_) try {
|
|
33
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
34
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
35
|
-
switch (op[0]) {
|
|
36
|
-
case 0: case 1: t = op; break;
|
|
37
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
38
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
39
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
40
|
-
default:
|
|
41
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
42
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
43
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
44
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
45
|
-
if (t[2]) _.ops.pop();
|
|
46
|
-
_.trys.pop(); continue;
|
|
47
|
-
}
|
|
48
|
-
op = body.call(thisArg, _);
|
|
49
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
50
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
51
|
-
}
|
|
52
|
-
};
|
|
53
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
54
3
|
exports.ApplicationView = exports.NavDirection = void 0;
|
|
55
|
-
|
|
4
|
+
const _1 = require(".");
|
|
56
5
|
var NavDirection;
|
|
57
6
|
(function (NavDirection) {
|
|
58
7
|
NavDirection[NavDirection["Up"] = 0] = "Up";
|
|
59
8
|
NavDirection[NavDirection["Down"] = 1] = "Down";
|
|
60
9
|
NavDirection[NavDirection["Left"] = 2] = "Left";
|
|
61
10
|
NavDirection[NavDirection["Right"] = 3] = "Right";
|
|
62
|
-
})(NavDirection
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
11
|
+
})(NavDirection || (exports.NavDirection = NavDirection = {}));
|
|
12
|
+
class ApplicationView extends _1.Namespace {
|
|
13
|
+
constructor(ableton) {
|
|
14
|
+
super(ableton, "application-view");
|
|
15
|
+
}
|
|
16
|
+
async availableMainViews() {
|
|
17
|
+
return this.sendCachedCommand("available_main_views");
|
|
18
|
+
}
|
|
19
|
+
async focusView(view) {
|
|
20
|
+
return this.sendCommand("focus_view", [view]);
|
|
21
|
+
}
|
|
22
|
+
async hideView(view) {
|
|
23
|
+
return this.sendCommand("hide_view", [view]);
|
|
24
|
+
}
|
|
25
|
+
async isViewVisible(view, mainWindowOnly = true) {
|
|
26
|
+
return this.sendCommand("is_view_visible", [view, mainWindowOnly]);
|
|
27
|
+
}
|
|
28
|
+
async scrollView(view, direction) {
|
|
29
|
+
return this.sendCommand("scroll_view", [direction, view, true]);
|
|
30
|
+
}
|
|
31
|
+
async showView(view) {
|
|
32
|
+
return this.sendCommand("show_view", [view]);
|
|
33
|
+
}
|
|
34
|
+
async toggleBrowse() {
|
|
35
|
+
return this.sendCommand("toggle_browse");
|
|
36
|
+
}
|
|
37
|
+
async zoomView(view, direction) {
|
|
38
|
+
return this.sendCommand("zoom_view", [direction, view, true]);
|
|
67
39
|
}
|
|
68
|
-
|
|
69
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
70
|
-
return __generator(this, function (_a) {
|
|
71
|
-
return [2 /*return*/, this.sendCachedCommand("available_main_views")];
|
|
72
|
-
});
|
|
73
|
-
});
|
|
74
|
-
};
|
|
75
|
-
ApplicationView.prototype.focusView = function (view) {
|
|
76
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
77
|
-
return __generator(this, function (_a) {
|
|
78
|
-
return [2 /*return*/, this.sendCommand("focus_view", [view])];
|
|
79
|
-
});
|
|
80
|
-
});
|
|
81
|
-
};
|
|
82
|
-
ApplicationView.prototype.hideView = function (view) {
|
|
83
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
84
|
-
return __generator(this, function (_a) {
|
|
85
|
-
return [2 /*return*/, this.sendCommand("hide_view", [view])];
|
|
86
|
-
});
|
|
87
|
-
});
|
|
88
|
-
};
|
|
89
|
-
ApplicationView.prototype.isViewVisible = function (view, mainWindowOnly) {
|
|
90
|
-
if (mainWindowOnly === void 0) { mainWindowOnly = true; }
|
|
91
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
92
|
-
return __generator(this, function (_a) {
|
|
93
|
-
return [2 /*return*/, this.sendCommand("is_view_visible", [view, mainWindowOnly])];
|
|
94
|
-
});
|
|
95
|
-
});
|
|
96
|
-
};
|
|
97
|
-
ApplicationView.prototype.scrollView = function (view, direction) {
|
|
98
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
99
|
-
return __generator(this, function (_a) {
|
|
100
|
-
return [2 /*return*/, this.sendCommand("scroll_view", [direction, view, true])];
|
|
101
|
-
});
|
|
102
|
-
});
|
|
103
|
-
};
|
|
104
|
-
ApplicationView.prototype.showView = function (view) {
|
|
105
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
106
|
-
return __generator(this, function (_a) {
|
|
107
|
-
return [2 /*return*/, this.sendCommand("show_view", [view])];
|
|
108
|
-
});
|
|
109
|
-
});
|
|
110
|
-
};
|
|
111
|
-
ApplicationView.prototype.toggleBrowse = function () {
|
|
112
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
113
|
-
return __generator(this, function (_a) {
|
|
114
|
-
return [2 /*return*/, this.sendCommand("toggle_browse")];
|
|
115
|
-
});
|
|
116
|
-
});
|
|
117
|
-
};
|
|
118
|
-
ApplicationView.prototype.zoomView = function (view, direction) {
|
|
119
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
120
|
-
return __generator(this, function (_a) {
|
|
121
|
-
return [2 /*return*/, this.sendCommand("zoom_view", [direction, view, true])];
|
|
122
|
-
});
|
|
123
|
-
});
|
|
124
|
-
};
|
|
125
|
-
return ApplicationView;
|
|
126
|
-
}(_1.Namespace));
|
|
40
|
+
}
|
|
127
41
|
exports.ApplicationView = ApplicationView;
|
|
@@ -1,65 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
-
function step(op) {
|
|
16
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
-
while (_) try {
|
|
18
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
-
switch (op[0]) {
|
|
21
|
-
case 0: case 1: t = op; break;
|
|
22
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
-
default:
|
|
26
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
-
if (t[2]) _.ops.pop();
|
|
31
|
-
_.trys.pop(); continue;
|
|
32
|
-
}
|
|
33
|
-
op = body.call(thisArg, _);
|
|
34
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
-
}
|
|
37
|
-
};
|
|
38
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
-
|
|
3
|
+
const tests_1 = require("../util/tests");
|
|
40
4
|
require("jest-extended");
|
|
41
|
-
|
|
5
|
+
const gettableProps = [
|
|
42
6
|
"browse_mode",
|
|
43
7
|
"focused_document_view",
|
|
44
8
|
];
|
|
45
|
-
describe("Application",
|
|
46
|
-
it("should be able to read all properties without erroring",
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
case 0: return [4 /*yield*/, tests_1.withAbleton(function (ab) { return __awaiter(void 0, void 0, void 0, function () {
|
|
50
|
-
return __generator(this, function (_a) {
|
|
51
|
-
switch (_a.label) {
|
|
52
|
-
case 0: return [4 /*yield*/, Promise.all(gettableProps.map(function (p) { return ab.application.view.get(p); }))];
|
|
53
|
-
case 1:
|
|
54
|
-
_a.sent();
|
|
55
|
-
return [2 /*return*/];
|
|
56
|
-
}
|
|
57
|
-
});
|
|
58
|
-
}); })];
|
|
59
|
-
case 1:
|
|
60
|
-
_a.sent();
|
|
61
|
-
return [2 /*return*/];
|
|
62
|
-
}
|
|
9
|
+
describe("Application", () => {
|
|
10
|
+
it("should be able to read all properties without erroring", async () => {
|
|
11
|
+
await (0, tests_1.withAbleton)(async (ab) => {
|
|
12
|
+
await Promise.all(gettableProps.map((p) => ab.application.view.get(p)));
|
|
63
13
|
});
|
|
64
|
-
});
|
|
14
|
+
});
|
|
65
15
|
});
|
package/ns/application.js
CHANGED
|
@@ -1,73 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __extends = (this && this.__extends) || (function () {
|
|
3
|
-
var extendStatics = function (d, b) {
|
|
4
|
-
extendStatics = Object.setPrototypeOf ||
|
|
5
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
-
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
-
return extendStatics(d, b);
|
|
8
|
-
};
|
|
9
|
-
return function (d, b) {
|
|
10
|
-
if (typeof b !== "function" && b !== null)
|
|
11
|
-
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
12
|
-
extendStatics(d, b);
|
|
13
|
-
function __() { this.constructor = d; }
|
|
14
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
|
-
};
|
|
16
|
-
})();
|
|
17
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
18
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
19
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
20
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
21
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
22
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
23
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
24
|
-
});
|
|
25
|
-
};
|
|
26
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
27
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
28
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
29
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
30
|
-
function step(op) {
|
|
31
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
32
|
-
while (_) try {
|
|
33
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
34
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
35
|
-
switch (op[0]) {
|
|
36
|
-
case 0: case 1: t = op; break;
|
|
37
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
38
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
39
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
40
|
-
default:
|
|
41
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
42
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
43
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
44
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
45
|
-
if (t[2]) _.ops.pop();
|
|
46
|
-
_.trys.pop(); continue;
|
|
47
|
-
}
|
|
48
|
-
op = body.call(thisArg, _);
|
|
49
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
50
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
51
|
-
}
|
|
52
|
-
};
|
|
53
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
54
3
|
exports.Application = void 0;
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
4
|
+
const _1 = require(".");
|
|
5
|
+
const application_view_1 = require("./application-view");
|
|
6
|
+
class Application extends _1.Namespace {
|
|
7
|
+
constructor(ableton) {
|
|
8
|
+
super(ableton, "application");
|
|
9
|
+
}
|
|
10
|
+
view = new application_view_1.ApplicationView(this.ableton);
|
|
11
|
+
async pressCurrentDialogButton(index) {
|
|
12
|
+
return this.sendCommand("press_current_dialog_button", [index]);
|
|
63
13
|
}
|
|
64
|
-
|
|
65
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
66
|
-
return __generator(this, function (_a) {
|
|
67
|
-
return [2 /*return*/, this.sendCommand("press_current_dialog_button", [index])];
|
|
68
|
-
});
|
|
69
|
-
});
|
|
70
|
-
};
|
|
71
|
-
return Application;
|
|
72
|
-
}(_1.Namespace));
|
|
14
|
+
}
|
|
73
15
|
exports.Application = Application;
|
package/ns/application.spec.js
CHANGED
|
@@ -1,44 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
-
function step(op) {
|
|
16
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
-
while (_) try {
|
|
18
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
-
switch (op[0]) {
|
|
21
|
-
case 0: case 1: t = op; break;
|
|
22
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
-
default:
|
|
26
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
-
if (t[2]) _.ops.pop();
|
|
31
|
-
_.trys.pop(); continue;
|
|
32
|
-
}
|
|
33
|
-
op = body.call(thisArg, _);
|
|
34
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
-
}
|
|
37
|
-
};
|
|
38
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
-
|
|
3
|
+
const tests_1 = require("../util/tests");
|
|
40
4
|
require("jest-extended");
|
|
41
|
-
|
|
5
|
+
const gettableProps = [
|
|
42
6
|
"major_version",
|
|
43
7
|
"minor_version",
|
|
44
8
|
"bugfix_version",
|
|
@@ -47,24 +11,10 @@ var gettableProps = [
|
|
|
47
11
|
"current_dialog_message",
|
|
48
12
|
"current_dialog_button_count",
|
|
49
13
|
];
|
|
50
|
-
describe("Application",
|
|
51
|
-
it("should be able to read all properties without erroring",
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
case 0: return [4 /*yield*/, tests_1.withAbleton(function (ab) { return __awaiter(void 0, void 0, void 0, function () {
|
|
55
|
-
return __generator(this, function (_a) {
|
|
56
|
-
switch (_a.label) {
|
|
57
|
-
case 0: return [4 /*yield*/, Promise.all(gettableProps.map(function (p) { return ab.application.get(p); }))];
|
|
58
|
-
case 1:
|
|
59
|
-
_a.sent();
|
|
60
|
-
return [2 /*return*/];
|
|
61
|
-
}
|
|
62
|
-
});
|
|
63
|
-
}); })];
|
|
64
|
-
case 1:
|
|
65
|
-
_a.sent();
|
|
66
|
-
return [2 /*return*/];
|
|
67
|
-
}
|
|
14
|
+
describe("Application", () => {
|
|
15
|
+
it("should be able to read all properties without erroring", async () => {
|
|
16
|
+
await (0, tests_1.withAbleton)(async (ab) => {
|
|
17
|
+
await Promise.all(gettableProps.map((p) => ab.application.get(p)));
|
|
68
18
|
});
|
|
69
|
-
});
|
|
19
|
+
});
|
|
70
20
|
});
|
package/ns/clip-slot.js
CHANGED
|
@@ -1,85 +1,68 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __extends = (this && this.__extends) || (function () {
|
|
3
|
-
var extendStatics = function (d, b) {
|
|
4
|
-
extendStatics = Object.setPrototypeOf ||
|
|
5
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
-
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
-
return extendStatics(d, b);
|
|
8
|
-
};
|
|
9
|
-
return function (d, b) {
|
|
10
|
-
if (typeof b !== "function" && b !== null)
|
|
11
|
-
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
12
|
-
extendStatics(d, b);
|
|
13
|
-
function __() { this.constructor = d; }
|
|
14
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
|
-
};
|
|
16
|
-
})();
|
|
17
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
3
|
exports.ClipSlot = exports.PlayingStatus = void 0;
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
4
|
+
const _1 = require(".");
|
|
5
|
+
const color_1 = require("../util/color");
|
|
6
|
+
const clip_1 = require("./clip");
|
|
22
7
|
var PlayingStatus;
|
|
23
8
|
(function (PlayingStatus) {
|
|
24
9
|
PlayingStatus["Stopped"] = "stopped";
|
|
25
10
|
PlayingStatus["Playing"] = "playing";
|
|
26
11
|
PlayingStatus["Recording"] = "recording";
|
|
27
|
-
})(PlayingStatus
|
|
12
|
+
})(PlayingStatus || (exports.PlayingStatus = PlayingStatus = {}));
|
|
28
13
|
/**
|
|
29
14
|
* This class represents an entry in Live's Session view matrix.
|
|
30
15
|
*/
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
clip:
|
|
38
|
-
color:
|
|
16
|
+
class ClipSlot extends _1.Namespace {
|
|
17
|
+
raw;
|
|
18
|
+
constructor(ableton, raw) {
|
|
19
|
+
super(ableton, "clip_slot", raw.id);
|
|
20
|
+
this.raw = raw;
|
|
21
|
+
this.transformers = {
|
|
22
|
+
clip: (c) => (c ? new clip_1.Clip(ableton, c) : null),
|
|
23
|
+
color: (c) => new color_1.Color(c),
|
|
39
24
|
};
|
|
40
|
-
|
|
25
|
+
this.cachedProps = {
|
|
41
26
|
clip: true,
|
|
42
27
|
};
|
|
43
|
-
return _this;
|
|
44
28
|
}
|
|
45
29
|
/**
|
|
46
30
|
* Creates an empty clip with the given length in the slot.
|
|
47
31
|
* Throws an error when called on non-empty slots or slots in non-MIDI tracks.
|
|
48
32
|
*/
|
|
49
|
-
|
|
33
|
+
createClip(length) {
|
|
50
34
|
return this.sendCommand("create_clip", [length]);
|
|
51
|
-
}
|
|
35
|
+
}
|
|
52
36
|
/**
|
|
53
37
|
* Removes the clip contained in the slot.
|
|
54
38
|
* Raises an exception if the slot was empty.
|
|
55
39
|
*/
|
|
56
|
-
|
|
40
|
+
deleteClip() {
|
|
57
41
|
return this.sendCommand("delete_clip");
|
|
58
|
-
}
|
|
59
|
-
|
|
42
|
+
}
|
|
43
|
+
duplicateClipTo(slot) {
|
|
60
44
|
return this.sendCommand("duplicate_clip_to", { slot_id: slot.raw.id });
|
|
61
|
-
}
|
|
45
|
+
}
|
|
62
46
|
/**
|
|
63
47
|
* Fire a Clip if this Clipslot owns one,
|
|
64
48
|
* else trigger the stop button, if we have one.
|
|
65
49
|
*/
|
|
66
|
-
|
|
50
|
+
fire() {
|
|
67
51
|
return this.sendCommand("fire");
|
|
68
|
-
}
|
|
52
|
+
}
|
|
69
53
|
/**
|
|
70
54
|
* Set the ClipSlot's fire button state directly.
|
|
71
55
|
* Supports all launch modes.
|
|
72
56
|
*/
|
|
73
|
-
|
|
57
|
+
setFireButtonState(state) {
|
|
74
58
|
return this.sendCommand("set_fire_button_state", [state]);
|
|
75
|
-
}
|
|
59
|
+
}
|
|
76
60
|
/**
|
|
77
61
|
* Stop playing the contained Clip,
|
|
78
62
|
* if there is a Clip and its currently playing.
|
|
79
63
|
*/
|
|
80
|
-
|
|
64
|
+
stop() {
|
|
81
65
|
return this.sendCommand("stop");
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
}(_1.Namespace));
|
|
66
|
+
}
|
|
67
|
+
}
|
|
85
68
|
exports.ClipSlot = ClipSlot;
|