@opendaw/studio-adapters 0.0.99 → 0.0.100
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/dist/AutomatableParameterFieldAdapter.d.ts +5 -0
- package/dist/AutomatableParameterFieldAdapter.d.ts.map +1 -1
- package/dist/AutomatableParameterFieldAdapter.js +20 -4
- package/dist/BoxAdapters.d.ts.map +1 -1
- package/dist/BoxAdapters.js +6 -0
- package/dist/DeviceManualUrls.d.ts +3 -0
- package/dist/DeviceManualUrls.d.ts.map +1 -1
- package/dist/DeviceManualUrls.js +3 -0
- package/dist/ParameterFieldAdapters.d.ts +10 -0
- package/dist/ParameterFieldAdapters.d.ts.map +1 -1
- package/dist/ParameterFieldAdapters.js +30 -3
- package/dist/ScriptCompiler.d.ts +25 -0
- package/dist/ScriptCompiler.d.ts.map +1 -0
- package/dist/ScriptCompiler.js +188 -0
- package/dist/ScriptParamDeclaration.d.ts +36 -0
- package/dist/ScriptParamDeclaration.d.ts.map +1 -0
- package/dist/ScriptParamDeclaration.js +197 -0
- package/dist/audio-unit/AudioUnitTracks.d.ts +1 -0
- package/dist/audio-unit/AudioUnitTracks.d.ts.map +1 -1
- package/dist/audio-unit/AudioUnitTracks.js +1 -0
- package/dist/devices/audio-effects/WerkstattDeviceBoxAdapter.d.ts +31 -0
- package/dist/devices/audio-effects/WerkstattDeviceBoxAdapter.d.ts.map +1 -0
- package/dist/devices/audio-effects/WerkstattDeviceBoxAdapter.js +55 -0
- package/dist/devices/instruments/ApparatDeviceBoxAdapter.d.ts +32 -0
- package/dist/devices/instruments/ApparatDeviceBoxAdapter.d.ts.map +1 -0
- package/dist/devices/instruments/ApparatDeviceBoxAdapter.js +57 -0
- package/dist/devices/midi-effects/SpielwerkDeviceBoxAdapter.d.ts +29 -0
- package/dist/devices/midi-effects/SpielwerkDeviceBoxAdapter.d.ts.map +1 -0
- package/dist/devices/midi-effects/SpielwerkDeviceBoxAdapter.js +52 -0
- package/dist/factories/DeviceFactory.d.ts +1 -0
- package/dist/factories/DeviceFactory.d.ts.map +1 -1
- package/dist/factories/InstrumentBox.d.ts +2 -2
- package/dist/factories/InstrumentBox.d.ts.map +1 -1
- package/dist/factories/InstrumentFactories.d.ts +7 -5
- package/dist/factories/InstrumentFactories.d.ts.map +1 -1
- package/dist/factories/InstrumentFactories.js +21 -2
- package/dist/index.d.ts +5 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -0
- package/dist/offline-renderer.d.ts +1 -0
- package/dist/offline-renderer.d.ts.map +1 -1
- package/dist/protocols.d.ts +1 -0
- package/dist/protocols.d.ts.map +1 -1
- package/dist/selection/VertexSelection.d.ts.map +1 -1
- package/dist/selection/VertexSelection.js +2 -1
- package/dist/timeline/TrackBoxAdapter.d.ts.map +1 -1
- package/dist/timeline/TrackBoxAdapter.js +31 -1
- package/package.json +9 -9
|
@@ -3,6 +3,7 @@ import { ppqn } from "@opendaw/lib-dsp";
|
|
|
3
3
|
import { Address, PrimitiveField, PrimitiveType, PrimitiveValues } from "@opendaw/lib-box";
|
|
4
4
|
import { Pointers } from "@opendaw/studio-enums";
|
|
5
5
|
import { TrackBoxAdapter } from "./timeline/TrackBoxAdapter";
|
|
6
|
+
import { AudioUnitTracks } from "./audio-unit/AudioUnitTracks";
|
|
6
7
|
import { BoxAdaptersContext } from "./BoxAdaptersContext";
|
|
7
8
|
export declare class AutomatableParameterFieldAdapter<T extends PrimitiveValues = any> implements Parameter<T>, Terminable {
|
|
8
9
|
#private;
|
|
@@ -16,6 +17,10 @@ export declare class AutomatableParameterFieldAdapter<T extends PrimitiveValues
|
|
|
16
17
|
get type(): PrimitiveType;
|
|
17
18
|
get address(): Address;
|
|
18
19
|
get track(): Option<TrackBoxAdapter>;
|
|
20
|
+
registerTracks(tracks: AudioUnitTracks): Terminable;
|
|
21
|
+
touchStart(): void;
|
|
22
|
+
touchEnd(): void;
|
|
23
|
+
updateMappings(valueMapping: ValueMapping<T>, stringMapping: StringMapping<T>): void;
|
|
19
24
|
valueAt(position: ppqn): T;
|
|
20
25
|
subscribe(observer: Observer<AutomatableParameterFieldAdapter<T>>): Subscription;
|
|
21
26
|
catchupAndSubscribe(observer: Observer<AutomatableParameterFieldAdapter<T>>): Subscription;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AutomatableParameterFieldAdapter.d.ts","sourceRoot":"","sources":["../src/AutomatableParameterFieldAdapter.ts"],"names":[],"mappings":"AAAA,OAAO,EAIH,qBAAqB,EAIrB,QAAQ,EACR,MAAM,EAEN,SAAS,EACT,aAAa,EACb,YAAY,EACZ,YAAY,EACZ,UAAU,EAEV,SAAS,EACT,YAAY,EACf,MAAM,kBAAkB,CAAA;AACzB,OAAO,EAAC,IAAI,EAAC,MAAM,kBAAkB,CAAA;AACrC,OAAO,EAAC,OAAO,EAA8B,cAAc,EAAE,aAAa,EAAE,eAAe,EAAC,MAAM,kBAAkB,CAAA;AACpH,OAAO,EAAC,QAAQ,EAAC,MAAM,uBAAuB,CAAA;AAE9C,OAAO,EAAC,eAAe,EAAC,MAAM,4BAA4B,CAAA;AAC1D,OAAO,EAAC,kBAAkB,EAAC,MAAM,sBAAsB,CAAA;AAQvD,qBAAa,gCAAgC,CAAC,CAAC,SAAS,eAAe,GAAG,GAAG,CAAE,YAAW,SAAS,CAAC,CAAC,CAAC,EAAE,UAAU;;
|
|
1
|
+
{"version":3,"file":"AutomatableParameterFieldAdapter.d.ts","sourceRoot":"","sources":["../src/AutomatableParameterFieldAdapter.ts"],"names":[],"mappings":"AAAA,OAAO,EAIH,qBAAqB,EAIrB,QAAQ,EACR,MAAM,EAEN,SAAS,EACT,aAAa,EACb,YAAY,EACZ,YAAY,EACZ,UAAU,EAEV,SAAS,EACT,YAAY,EACf,MAAM,kBAAkB,CAAA;AACzB,OAAO,EAAC,IAAI,EAAC,MAAM,kBAAkB,CAAA;AACrC,OAAO,EAAC,OAAO,EAA8B,cAAc,EAAE,aAAa,EAAE,eAAe,EAA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,EAAE,IAAI,GAAG,CAAC;IAW1B,SAAS,CAAC,QAAQ,EAAE,QAAQ,CAAC,gCAAgC,CAAC,CAAC,CAAC,CAAC,GAAG,YAAY;IAIhF,mBAAmB,CAAC,QAAQ,EAAE,QAAQ,CAAC,gCAAgC,CAAC,CAAC,CAAC,CAAC,GAAG,YAAY;IAK1F,iCAAiC,CAAC,QAAQ,EAAE,qBAAqB,GAAG,YAAY;IAMhF,QAAQ,IAAI,CAAC;IACb,QAAQ,CAAC,KAAK,EAAE,CAAC;IAMjB,YAAY,CAAC,KAAK,EAAE,SAAS,GAAG,IAAI;IACpC,YAAY,IAAI,SAAS;IACzB,kBAAkB,IAAI,CAAC;IACvB,sBAAsB,IAAI,SAAS;IACnC,uBAAuB,IAAI,QAAQ,CAAC,YAAY,CAAC;IACjD,aAAa,IAAI,QAAQ,CAAC,YAAY,CAAC;IACvC,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI;IAWjC,KAAK,IAAI,IAAI;IAEb,SAAS,IAAI,IAAI;CAKpB"}
|
|
@@ -9,7 +9,7 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
9
9
|
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
10
10
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
11
11
|
};
|
|
12
|
-
var _AutomatableParameterFieldAdapter_context, _AutomatableParameterFieldAdapter_field,
|
|
12
|
+
var _AutomatableParameterFieldAdapter_context, _AutomatableParameterFieldAdapter_field, _AutomatableParameterFieldAdapter_name, _AutomatableParameterFieldAdapter_anchor, _AutomatableParameterFieldAdapter_terminator, _AutomatableParameterFieldAdapter_valueChangeNotifier, _AutomatableParameterFieldAdapter_controlSource, _AutomatableParameterFieldAdapter_valueMapping, _AutomatableParameterFieldAdapter_stringMapping, _AutomatableParameterFieldAdapter_trackBoxAdapter, _AutomatableParameterFieldAdapter_automationHandle, _AutomatableParameterFieldAdapter_controlledValue, _AutomatableParameterFieldAdapter_midiControlled;
|
|
13
13
|
import { assert, clamp, Listeners, Notifier, Option, panic, Terminator } from "@opendaw/lib-std";
|
|
14
14
|
import { Pointers } from "@opendaw/studio-enums";
|
|
15
15
|
import { TrackBoxAdapter } from "./timeline/TrackBoxAdapter";
|
|
@@ -23,13 +23,13 @@ export class AutomatableParameterFieldAdapter {
|
|
|
23
23
|
constructor(context, field, valueMapping, stringMapping, name, anchor) {
|
|
24
24
|
_AutomatableParameterFieldAdapter_context.set(this, void 0);
|
|
25
25
|
_AutomatableParameterFieldAdapter_field.set(this, void 0);
|
|
26
|
-
_AutomatableParameterFieldAdapter_valueMapping.set(this, void 0);
|
|
27
|
-
_AutomatableParameterFieldAdapter_stringMapping.set(this, void 0);
|
|
28
26
|
_AutomatableParameterFieldAdapter_name.set(this, void 0);
|
|
29
27
|
_AutomatableParameterFieldAdapter_anchor.set(this, void 0);
|
|
30
28
|
_AutomatableParameterFieldAdapter_terminator.set(this, new Terminator());
|
|
31
29
|
_AutomatableParameterFieldAdapter_valueChangeNotifier.set(this, void 0);
|
|
32
30
|
_AutomatableParameterFieldAdapter_controlSource.set(this, void 0);
|
|
31
|
+
_AutomatableParameterFieldAdapter_valueMapping.set(this, void 0);
|
|
32
|
+
_AutomatableParameterFieldAdapter_stringMapping.set(this, void 0);
|
|
33
33
|
_AutomatableParameterFieldAdapter_trackBoxAdapter.set(this, Option.None);
|
|
34
34
|
_AutomatableParameterFieldAdapter_automationHandle.set(this, Option.None);
|
|
35
35
|
_AutomatableParameterFieldAdapter_controlledValue.set(this, null);
|
|
@@ -109,6 +109,19 @@ export class AutomatableParameterFieldAdapter {
|
|
|
109
109
|
get type() { return __classPrivateFieldGet(this, _AutomatableParameterFieldAdapter_field, "f").type; }
|
|
110
110
|
get address() { return __classPrivateFieldGet(this, _AutomatableParameterFieldAdapter_field, "f").address; }
|
|
111
111
|
get track() { return __classPrivateFieldGet(this, _AutomatableParameterFieldAdapter_trackBoxAdapter, "f"); }
|
|
112
|
+
registerTracks(tracks) {
|
|
113
|
+
return __classPrivateFieldGet(this, _AutomatableParameterFieldAdapter_context, "f").parameterFieldAdapters.registerTracks(this.address, tracks);
|
|
114
|
+
}
|
|
115
|
+
touchStart() {
|
|
116
|
+
__classPrivateFieldGet(this, _AutomatableParameterFieldAdapter_context, "f").parameterFieldAdapters.touchStart(this.address);
|
|
117
|
+
__classPrivateFieldGet(this, _AutomatableParameterFieldAdapter_context, "f").parameterFieldAdapters.notifyWrite(this, this.getUnitValue());
|
|
118
|
+
}
|
|
119
|
+
touchEnd() { __classPrivateFieldGet(this, _AutomatableParameterFieldAdapter_context, "f").parameterFieldAdapters.touchEnd(this.address); }
|
|
120
|
+
updateMappings(valueMapping, stringMapping) {
|
|
121
|
+
__classPrivateFieldSet(this, _AutomatableParameterFieldAdapter_valueMapping, valueMapping, "f");
|
|
122
|
+
__classPrivateFieldSet(this, _AutomatableParameterFieldAdapter_stringMapping, stringMapping, "f");
|
|
123
|
+
__classPrivateFieldGet(this, _AutomatableParameterFieldAdapter_valueChangeNotifier, "f").notify(this);
|
|
124
|
+
}
|
|
112
125
|
valueAt(position) {
|
|
113
126
|
const optTrack = __classPrivateFieldGet(this, _AutomatableParameterFieldAdapter_trackBoxAdapter, "f");
|
|
114
127
|
if (optTrack.nonEmpty()) {
|
|
@@ -136,6 +149,9 @@ export class AutomatableParameterFieldAdapter {
|
|
|
136
149
|
}
|
|
137
150
|
getValue() { return __classPrivateFieldGet(this, _AutomatableParameterFieldAdapter_field, "f").getValue(); }
|
|
138
151
|
setValue(value) {
|
|
152
|
+
if (value === this.getValue()) {
|
|
153
|
+
return;
|
|
154
|
+
}
|
|
139
155
|
const previousUnitValue = this.getUnitValue();
|
|
140
156
|
__classPrivateFieldGet(this, _AutomatableParameterFieldAdapter_field, "f").setValue(value);
|
|
141
157
|
__classPrivateFieldGet(this, _AutomatableParameterFieldAdapter_context, "f").parameterFieldAdapters.notifyWrite(this, previousUnitValue);
|
|
@@ -165,7 +181,7 @@ export class AutomatableParameterFieldAdapter {
|
|
|
165
181
|
__classPrivateFieldGet(this, _AutomatableParameterFieldAdapter_terminator, "f").terminate();
|
|
166
182
|
}
|
|
167
183
|
}
|
|
168
|
-
_AutomatableParameterFieldAdapter_context = new WeakMap(), _AutomatableParameterFieldAdapter_field = new WeakMap(),
|
|
184
|
+
_AutomatableParameterFieldAdapter_context = new WeakMap(), _AutomatableParameterFieldAdapter_field = new WeakMap(), _AutomatableParameterFieldAdapter_name = new WeakMap(), _AutomatableParameterFieldAdapter_anchor = new WeakMap(), _AutomatableParameterFieldAdapter_terminator = new WeakMap(), _AutomatableParameterFieldAdapter_valueChangeNotifier = new WeakMap(), _AutomatableParameterFieldAdapter_controlSource = new WeakMap(), _AutomatableParameterFieldAdapter_valueMapping = new WeakMap(), _AutomatableParameterFieldAdapter_stringMapping = new WeakMap(), _AutomatableParameterFieldAdapter_trackBoxAdapter = new WeakMap(), _AutomatableParameterFieldAdapter_automationHandle = new WeakMap(), _AutomatableParameterFieldAdapter_controlledValue = new WeakMap(), _AutomatableParameterFieldAdapter_midiControlled = new WeakMap();
|
|
169
185
|
const mapPointerToControlSource = (pointer) => {
|
|
170
186
|
switch (pointer) {
|
|
171
187
|
case Pointers.Automation:
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BoxAdapters.d.ts","sourceRoot":"","sources":["../src/BoxAdapters.ts"],"names":[],"mappings":"AAAA,OAAO,EAGH,UAAU,EACV,KAAK,EAEL,MAAM,EAIN,UAAU,EAEb,MAAM,kBAAkB,CAAA;AACzB,OAAO,EAAC,GAAG,EAAS,MAAM,kBAAkB,CAAA;
|
|
1
|
+
{"version":3,"file":"BoxAdapters.d.ts","sourceRoot":"","sources":["../src/BoxAdapters.ts"],"names":[],"mappings":"AAAA,OAAO,EAGH,UAAU,EACV,KAAK,EAEL,MAAM,EAIN,UAAU,EAEb,MAAM,kBAAkB,CAAA;AACzB,OAAO,EAAC,GAAG,EAAS,MAAM,kBAAkB,CAAA;AA4G5C,OAAO,EAAC,kBAAkB,EAAC,MAAM,sBAAsB,CAAA;AACvD,OAAO,EAAC,UAAU,EAAC,MAAM,cAAc,CAAA;AA0BvC,qBAAa,WAAY,YAAW,UAAU;;gBAO9B,OAAO,EAAE,kBAAkB;IAkBvC,SAAS,IAAI,IAAI;IAMjB,UAAU,CAAC,GAAG,SAAS,GAAG,EAAE,CAAC,SAAS,UAAU,EAAE,GAAG,EAAE,GAAG,EAAE,SAAS,EAAE,KAAK,CAAC,CAAC,CAAC,GAAG,UAAU,CAAC,CAAC,CAAC,GAAG,CAAC;IAkBnG,UAAU,CAAC,GAAG,EAAE,GAAG,GAAG,MAAM,CAAC,UAAU,CAAC;CAsE3C"}
|
package/dist/BoxAdapters.js
CHANGED
|
@@ -45,6 +45,8 @@ import { TapeDeviceBoxAdapter } from "./devices/instruments/TapeDeviceBoxAdapter
|
|
|
45
45
|
import { VaporisateurDeviceBoxAdapter } from "./devices/instruments/VaporisateurDeviceBoxAdapter";
|
|
46
46
|
import { ArpeggioDeviceBoxAdapter } from "./devices/midi-effects/ArpeggioDeviceBoxAdapter";
|
|
47
47
|
import { PitchDeviceBoxAdapter } from "./devices/midi-effects/PitchDeviceBoxAdapter";
|
|
48
|
+
import { SpielwerkDeviceBoxAdapter } from "./devices/midi-effects/SpielwerkDeviceBoxAdapter";
|
|
49
|
+
import { ApparatDeviceBoxAdapter } from "./devices/instruments/ApparatDeviceBoxAdapter";
|
|
48
50
|
import { NanoDeviceBoxAdapter } from "./devices/instruments/NanoDeviceBoxAdapter";
|
|
49
51
|
import { PlayfieldDeviceBoxAdapter } from "./devices/instruments/PlayfieldDeviceBoxAdapter";
|
|
50
52
|
import { StereoToolDeviceBoxAdapter } from "./devices/audio-effects/StereoToolDeviceBoxAdapter";
|
|
@@ -66,6 +68,7 @@ import { TidalDeviceBoxAdapter } from "./devices/audio-effects/TidalDeviceBoxAda
|
|
|
66
68
|
import { DattorroReverbDeviceBoxAdapter } from "./devices/audio-effects/DattorroReverbDeviceBoxAdapter";
|
|
67
69
|
import { NeuralAmpDeviceBoxAdapter } from "./devices/audio-effects/NeuralAmpDeviceBoxAdapter";
|
|
68
70
|
import { WaveshaperDeviceBoxAdapter } from "./devices/audio-effects/WaveshaperDeviceBoxAdapter";
|
|
71
|
+
import { WerkstattDeviceBoxAdapter } from "./devices/audio-effects/WerkstattDeviceBoxAdapter";
|
|
69
72
|
import { NeuralAmpModelBoxAdapter } from "./nam/NeuralAmpModelBoxAdapter";
|
|
70
73
|
import { AudioPitchStretchBoxAdapter } from "./audio/AudioPitchStretchBoxAdapter";
|
|
71
74
|
import { TransientMarkerBoxAdapter } from "./audio/TransientMarkerBoxAdapter";
|
|
@@ -128,6 +131,7 @@ _BoxAdapters_context = new WeakMap(), _BoxAdapters_adapters = new WeakMap(), _Bo
|
|
|
128
131
|
visitAudioPitchStretchBox: (box) => new AudioPitchStretchBoxAdapter(__classPrivateFieldGet(this, _BoxAdapters_context, "f"), box),
|
|
129
132
|
visitTransientMarkerBox: (box) => new TransientMarkerBoxAdapter(box),
|
|
130
133
|
visitWarpMarkerBox: (box) => new WarpMarkerBoxAdapter(__classPrivateFieldGet(this, _BoxAdapters_context, "f"), box),
|
|
134
|
+
visitApparatDeviceBox: (box) => new ApparatDeviceBoxAdapter(__classPrivateFieldGet(this, _BoxAdapters_context, "f"), box),
|
|
131
135
|
visitAudioRegionBox: (box) => new AudioRegionBoxAdapter(__classPrivateFieldGet(this, _BoxAdapters_context, "f"), box),
|
|
132
136
|
visitAudioUnitBox: (box) => new AudioUnitBoxAdapter(__classPrivateFieldGet(this, _BoxAdapters_context, "f"), box),
|
|
133
137
|
visitAuxSendBox: (box) => new AuxSendBoxAdapter(__classPrivateFieldGet(this, _BoxAdapters_context, "f"), box),
|
|
@@ -167,6 +171,7 @@ _BoxAdapters_context = new WeakMap(), _BoxAdapters_adapters = new WeakMap(), _Bo
|
|
|
167
171
|
visitRootBox: (box) => new RootBoxAdapter(__classPrivateFieldGet(this, _BoxAdapters_context, "f"), box),
|
|
168
172
|
visitSoundfontDeviceBox: (box) => new SoundfontDeviceBoxAdapter(__classPrivateFieldGet(this, _BoxAdapters_context, "f"), box),
|
|
169
173
|
visitSoundfontFileBox: (box) => new SoundfontFileBoxAdapter(__classPrivateFieldGet(this, _BoxAdapters_context, "f"), box),
|
|
174
|
+
visitSpielwerkDeviceBox: (box) => new SpielwerkDeviceBoxAdapter(__classPrivateFieldGet(this, _BoxAdapters_context, "f"), box),
|
|
170
175
|
visitStereoToolDeviceBox: (box) => new StereoToolDeviceBoxAdapter(__classPrivateFieldGet(this, _BoxAdapters_context, "f"), box),
|
|
171
176
|
visitTapeDeviceBox: (box) => new TapeDeviceBoxAdapter(__classPrivateFieldGet(this, _BoxAdapters_context, "f"), box),
|
|
172
177
|
visitTimelineBox: (box) => new TimelineBoxAdapter(__classPrivateFieldGet(this, _BoxAdapters_context, "f"), box),
|
|
@@ -179,6 +184,7 @@ _BoxAdapters_context = new WeakMap(), _BoxAdapters_adapters = new WeakMap(), _Bo
|
|
|
179
184
|
visitValueRegionBox: (box) => new ValueRegionBoxAdapter(__classPrivateFieldGet(this, _BoxAdapters_context, "f"), box),
|
|
180
185
|
visitVaporisateurDeviceBox: (box) => new VaporisateurDeviceBoxAdapter(__classPrivateFieldGet(this, _BoxAdapters_context, "f"), box),
|
|
181
186
|
visitWaveshaperDeviceBox: (box) => new WaveshaperDeviceBoxAdapter(__classPrivateFieldGet(this, _BoxAdapters_context, "f"), box),
|
|
187
|
+
visitWerkstattDeviceBox: (box) => new WerkstattDeviceBoxAdapter(__classPrivateFieldGet(this, _BoxAdapters_context, "f"), box),
|
|
182
188
|
visitVelocityDeviceBox: (box) => new VelocityDeviceBoxAdapter(__classPrivateFieldGet(this, _BoxAdapters_context, "f"), box),
|
|
183
189
|
visitZeitgeistDeviceBox: (box) => new ZeitgeistDeviceBoxAdapter(__classPrivateFieldGet(this, _BoxAdapters_context, "f"), box)
|
|
184
190
|
}), `Could not find factory for ${unknownBox}`);
|
|
@@ -2,6 +2,7 @@ export declare namespace DeviceManualUrls {
|
|
|
2
2
|
const AudioBus = "manuals/audio-bus";
|
|
3
3
|
const Arpeggio = "manuals/devices/midi/arpeggio";
|
|
4
4
|
const Pitch = "manuals/devices/midi/pitch";
|
|
5
|
+
const Spielwerk = "manuals/devices/midi/spielwerk";
|
|
5
6
|
const Velocity = "manuals/devices/midi/velocity";
|
|
6
7
|
const Zeitgeist = "manuals/devices/midi/zeitgeist";
|
|
7
8
|
const StereoTool = "manuals/devices/audio/stereo-tool";
|
|
@@ -18,6 +19,8 @@ export declare namespace DeviceManualUrls {
|
|
|
18
19
|
const Modular = "manuals/devices/audio/modular";
|
|
19
20
|
const NeuralAmp = "manuals/devices/audio/neural-amp";
|
|
20
21
|
const Waveshaper = "manuals/devices/audio/waveshaper";
|
|
22
|
+
const Werkstatt = "manuals/devices/audio/werkstatt";
|
|
23
|
+
const Apparat = "manuals/devices/instruments/apparat";
|
|
21
24
|
const Tape = "manuals/devices/instruments/tape";
|
|
22
25
|
const Nano = "manuals/devices/instruments/nano";
|
|
23
26
|
const Playfield = "manuals/devices/instruments/playfield";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DeviceManualUrls.d.ts","sourceRoot":"","sources":["../src/DeviceManualUrls.ts"],"names":[],"mappings":"AAAA,yBAAiB,gBAAgB,CAAC;IAEvB,MAAM,QAAQ,sBAAsB,CAAA;IAGpC,MAAM,QAAQ,kCAAkC,CAAA;IAChD,MAAM,KAAK,+BAA+B,CAAA;IAC1C,MAAM,QAAQ,kCAAkC,CAAA;IAChD,MAAM,SAAS,mCAAmC,CAAA;IAGlD,MAAM,UAAU,sCAAsC,CAAA;IACtD,MAAM,KAAK,gCAAgC,CAAA;IAC3C,MAAM,cAAc,0CAA0C,CAAA;IAC9D,MAAM,SAAS,oCAAoC,CAAA;IACnD,MAAM,UAAU,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AC/C,MAAM,SAAS,0CAA0C,CAAA;IACzD,MAAM,YAAY,6CAA6C,CAAA;IAC/D,MAAM,UAAU,4CAA4C,CAAA;IAC5D,MAAM,SAAS,0CAA0C,CAAA;CACnE"}
|
package/dist/DeviceManualUrls.js
CHANGED
|
@@ -5,6 +5,7 @@ export var DeviceManualUrls;
|
|
|
5
5
|
// MIDI Effects
|
|
6
6
|
DeviceManualUrls.Arpeggio = "manuals/devices/midi/arpeggio";
|
|
7
7
|
DeviceManualUrls.Pitch = "manuals/devices/midi/pitch";
|
|
8
|
+
DeviceManualUrls.Spielwerk = "manuals/devices/midi/spielwerk";
|
|
8
9
|
DeviceManualUrls.Velocity = "manuals/devices/midi/velocity";
|
|
9
10
|
DeviceManualUrls.Zeitgeist = "manuals/devices/midi/zeitgeist";
|
|
10
11
|
// Audio Effects
|
|
@@ -22,7 +23,9 @@ export var DeviceManualUrls;
|
|
|
22
23
|
DeviceManualUrls.Modular = "manuals/devices/audio/modular";
|
|
23
24
|
DeviceManualUrls.NeuralAmp = "manuals/devices/audio/neural-amp";
|
|
24
25
|
DeviceManualUrls.Waveshaper = "manuals/devices/audio/waveshaper";
|
|
26
|
+
DeviceManualUrls.Werkstatt = "manuals/devices/audio/werkstatt";
|
|
25
27
|
// Instruments
|
|
28
|
+
DeviceManualUrls.Apparat = "manuals/devices/instruments/apparat";
|
|
26
29
|
DeviceManualUrls.Tape = "manuals/devices/instruments/tape";
|
|
27
30
|
DeviceManualUrls.Nano = "manuals/devices/instruments/nano";
|
|
28
31
|
DeviceManualUrls.Playfield = "manuals/devices/instruments/playfield";
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { Observer, Option, Subscription, Terminable, unitValue } from "@opendaw/lib-std";
|
|
2
2
|
import { Address } from "@opendaw/lib-box";
|
|
3
3
|
import { AutomatableParameterFieldAdapter } from "./AutomatableParameterFieldAdapter";
|
|
4
|
+
import { AudioUnitTracks } from "./audio-unit/AudioUnitTracks";
|
|
5
|
+
export type AutomationMode = "read" | "touch" | "latch";
|
|
4
6
|
export type ParameterWriteEvent = {
|
|
5
7
|
adapter: AutomatableParameterFieldAdapter;
|
|
6
8
|
previousUnitValue: unitValue;
|
|
@@ -11,6 +13,14 @@ export declare class ParameterFieldAdapters {
|
|
|
11
13
|
register(adapter: AutomatableParameterFieldAdapter): Terminable;
|
|
12
14
|
get(address: Address): AutomatableParameterFieldAdapter;
|
|
13
15
|
opt(address: Address): Option<AutomatableParameterFieldAdapter>;
|
|
16
|
+
registerTracks(address: Address, tracks: AudioUnitTracks): Terminable;
|
|
17
|
+
getTracks(address: Address): Option<AudioUnitTracks>;
|
|
18
|
+
setMode(address: Address, mode: AutomationMode): void;
|
|
19
|
+
getMode(address: Address): AutomationMode;
|
|
20
|
+
touchStart(address: Address): void;
|
|
21
|
+
touchEnd(address: Address): void;
|
|
22
|
+
isTouched(address: Address): boolean;
|
|
23
|
+
subscribeTouchEnd(observer: Observer<Address>): Subscription;
|
|
14
24
|
subscribeWrites(observer: Observer<ParameterWriteEvent>): Subscription;
|
|
15
25
|
notifyWrite(adapter: AutomatableParameterFieldAdapter, previousUnitValue: unitValue): void;
|
|
16
26
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ParameterFieldAdapters.d.ts","sourceRoot":"","sources":["../src/ParameterFieldAdapters.ts"],"names":[],"mappings":"AAAA,OAAO,EAAW,QAAQ,EAAE,MAAM,EAAa,YAAY,EAAE,UAAU,EAAE,SAAS,EAAC,MAAM,kBAAkB,CAAA;AAC3G,OAAO,EAAC,OAAO,EAAC,MAAM,kBAAkB,CAAA;AACxC,OAAO,EAAC,gCAAgC,EAAC,MAAM,oCAAoC,CAAA;
|
|
1
|
+
{"version":3,"file":"ParameterFieldAdapters.d.ts","sourceRoot":"","sources":["../src/ParameterFieldAdapters.ts"],"names":[],"mappings":"AAAA,OAAO,EAAW,QAAQ,EAAE,MAAM,EAAa,YAAY,EAAE,UAAU,EAAE,SAAS,EAAC,MAAM,kB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classPrivateFieldGet) || function (
|
|
|
9
9
|
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
10
10
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
11
11
|
};
|
|
12
|
-
var _ParameterFieldAdapters_set, _ParameterFieldAdapters_writeNotifier;
|
|
13
|
-
import { Notifier } from "@opendaw/lib-std";
|
|
12
|
+
var _ParameterFieldAdapters_set, _ParameterFieldAdapters_writeNotifier, _ParameterFieldAdapters_tracksMap, _ParameterFieldAdapters_touchedSet, _ParameterFieldAdapters_touchEndNotifier, _ParameterFieldAdapters_modeMap;
|
|
13
|
+
import { Notifier, Option } from "@opendaw/lib-std";
|
|
14
14
|
import { Address } from "@opendaw/lib-box";
|
|
15
15
|
export class ParameterFieldAdapters {
|
|
16
16
|
constructor() {
|
|
17
17
|
_ParameterFieldAdapters_set.set(this, void 0);
|
|
18
18
|
_ParameterFieldAdapters_writeNotifier.set(this, void 0);
|
|
19
|
+
_ParameterFieldAdapters_tracksMap.set(this, void 0);
|
|
20
|
+
_ParameterFieldAdapters_touchedSet.set(this, void 0);
|
|
21
|
+
_ParameterFieldAdapters_touchEndNotifier.set(this, void 0);
|
|
22
|
+
_ParameterFieldAdapters_modeMap.set(this, void 0);
|
|
19
23
|
__classPrivateFieldSet(this, _ParameterFieldAdapters_set, Address.newSet(adapter => adapter.field.address), "f");
|
|
20
24
|
__classPrivateFieldSet(this, _ParameterFieldAdapters_writeNotifier, new Notifier(), "f");
|
|
25
|
+
__classPrivateFieldSet(this, _ParameterFieldAdapters_tracksMap, new Map(), "f");
|
|
26
|
+
__classPrivateFieldSet(this, _ParameterFieldAdapters_touchedSet, new Set(), "f");
|
|
27
|
+
__classPrivateFieldSet(this, _ParameterFieldAdapters_touchEndNotifier, new Notifier(), "f");
|
|
28
|
+
__classPrivateFieldSet(this, _ParameterFieldAdapters_modeMap, new Map(), "f");
|
|
21
29
|
}
|
|
22
30
|
register(adapter) {
|
|
23
31
|
__classPrivateFieldGet(this, _ParameterFieldAdapters_set, "f").add(adapter);
|
|
@@ -25,6 +33,25 @@ export class ParameterFieldAdapters {
|
|
|
25
33
|
}
|
|
26
34
|
get(address) { return __classPrivateFieldGet(this, _ParameterFieldAdapters_set, "f").get(address); }
|
|
27
35
|
opt(address) { return __classPrivateFieldGet(this, _ParameterFieldAdapters_set, "f").opt(address); }
|
|
36
|
+
registerTracks(address, tracks) {
|
|
37
|
+
const key = address.toString();
|
|
38
|
+
__classPrivateFieldGet(this, _ParameterFieldAdapters_tracksMap, "f").set(key, tracks);
|
|
39
|
+
return { terminate: () => __classPrivateFieldGet(this, _ParameterFieldAdapters_tracksMap, "f").delete(key) };
|
|
40
|
+
}
|
|
41
|
+
getTracks(address) {
|
|
42
|
+
return Option.wrap(__classPrivateFieldGet(this, _ParameterFieldAdapters_tracksMap, "f").get(address.toString()));
|
|
43
|
+
}
|
|
44
|
+
setMode(address, mode) { __classPrivateFieldGet(this, _ParameterFieldAdapters_modeMap, "f").set(address.toString(), mode); }
|
|
45
|
+
getMode(address) { return __classPrivateFieldGet(this, _ParameterFieldAdapters_modeMap, "f").get(address.toString()) ?? "read"; }
|
|
46
|
+
touchStart(address) { __classPrivateFieldGet(this, _ParameterFieldAdapters_touchedSet, "f").add(address.toString()); }
|
|
47
|
+
touchEnd(address) {
|
|
48
|
+
const key = address.toString();
|
|
49
|
+
if (__classPrivateFieldGet(this, _ParameterFieldAdapters_touchedSet, "f").delete(key)) {
|
|
50
|
+
__classPrivateFieldGet(this, _ParameterFieldAdapters_touchEndNotifier, "f").notify(address);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
isTouched(address) { return __classPrivateFieldGet(this, _ParameterFieldAdapters_touchedSet, "f").has(address.toString()); }
|
|
54
|
+
subscribeTouchEnd(observer) { return __classPrivateFieldGet(this, _ParameterFieldAdapters_touchEndNotifier, "f").subscribe(observer); }
|
|
28
55
|
subscribeWrites(observer) {
|
|
29
56
|
return __classPrivateFieldGet(this, _ParameterFieldAdapters_writeNotifier, "f").subscribe(observer);
|
|
30
57
|
}
|
|
@@ -32,4 +59,4 @@ export class ParameterFieldAdapters {
|
|
|
32
59
|
__classPrivateFieldGet(this, _ParameterFieldAdapters_writeNotifier, "f").notify({ adapter, previousUnitValue });
|
|
33
60
|
}
|
|
34
61
|
}
|
|
35
|
-
_ParameterFieldAdapters_set = new WeakMap(), _ParameterFieldAdapters_writeNotifier = new WeakMap();
|
|
62
|
+
_ParameterFieldAdapters_set = new WeakMap(), _ParameterFieldAdapters_writeNotifier = new WeakMap(), _ParameterFieldAdapters_tracksMap = new WeakMap(), _ParameterFieldAdapters_touchedSet = new WeakMap(), _ParameterFieldAdapters_touchEndNotifier = new WeakMap(), _ParameterFieldAdapters_modeMap = new WeakMap();
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { Editing, UUID } from "@opendaw/lib-std";
|
|
2
|
+
import { BoxGraph, Field, StringField } from "@opendaw/lib-box";
|
|
3
|
+
import { Pointers } from "@opendaw/studio-enums";
|
|
4
|
+
export declare namespace ScriptCompiler {
|
|
5
|
+
interface DeviceBox {
|
|
6
|
+
readonly graph: BoxGraph;
|
|
7
|
+
readonly address: {
|
|
8
|
+
readonly uuid: UUID.Bytes;
|
|
9
|
+
};
|
|
10
|
+
readonly code: StringField;
|
|
11
|
+
readonly parameters: Field<Pointers.Parameter>;
|
|
12
|
+
readonly samples: Field<Pointers.Sample>;
|
|
13
|
+
}
|
|
14
|
+
type Config = {
|
|
15
|
+
readonly headerTag: string;
|
|
16
|
+
readonly registryName: string;
|
|
17
|
+
readonly functionName: string;
|
|
18
|
+
};
|
|
19
|
+
const create: (config: Config) => {
|
|
20
|
+
stripHeader: (source: string) => string;
|
|
21
|
+
load: (audioContext: BaseAudioContext, deviceBox: DeviceBox) => Promise<void>;
|
|
22
|
+
compile: (audioContext: BaseAudioContext, editing: Editing, deviceBox: DeviceBox, source: string, append?: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asInstanceOf, isDefined, UUID } from "@opendaw/lib-std";
|
|
2
|
+
import { WerkstattParameterBox, WerkstattSampleBox } from "@opendaw/studio-boxes";
|
|
3
|
+
import { ScriptParamDeclaration } from "./ScriptParamDeclaration";
|
|
4
|
+
const COMPILER_VERSION = 1;
|
|
5
|
+
const createHeaderPattern = (tag) => new RegExp(`^// @${tag} (\\w+) (\\d+) (\\d+)\n`);
|
|
6
|
+
const parseHeader = (source, pattern) => {
|
|
7
|
+
const match = source.match(pattern);
|
|
8
|
+
return match !== null ? {
|
|
9
|
+
userCode: source.slice(match[0].length),
|
|
10
|
+
update: parseInt(match[3])
|
|
11
|
+
} : {
|
|
12
|
+
userCode: source,
|
|
13
|
+
update: 0
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
const cachedParamDeclarations = new WeakMap();
|
|
17
|
+
const reconcileParameters = (deviceBox, declared, order) => {
|
|
18
|
+
const boxGraph = deviceBox.graph;
|
|
19
|
+
const previousDeclarations = cachedParamDeclarations.get(deviceBox) ?? new Map();
|
|
20
|
+
const existingPointers = deviceBox.parameters.pointerHub.filter();
|
|
21
|
+
const existingByLabel = new Map();
|
|
22
|
+
for (const pointer of existingPointers) {
|
|
23
|
+
const paramBox = asInstanceOf(pointer.box, WerkstattParameterBox);
|
|
24
|
+
existingByLabel.set(paramBox.label.getValue(), paramBox);
|
|
25
|
+
}
|
|
26
|
+
const seen = new Set();
|
|
27
|
+
for (const { label } of declared) {
|
|
28
|
+
seen.add(label);
|
|
29
|
+
}
|
|
30
|
+
for (const [label, paramBox] of existingByLabel) {
|
|
31
|
+
if (!seen.has(label)) {
|
|
32
|
+
paramBox.delete();
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
seen.clear();
|
|
36
|
+
const newDeclarations = new Map();
|
|
37
|
+
for (const declaration of declared) {
|
|
38
|
+
if (seen.has(declaration.label)) {
|
|
39
|
+
continue;
|
|
40
|
+
}
|
|
41
|
+
seen.add(declaration.label);
|
|
42
|
+
const unifiedIndex = order.get(declaration.label) ?? 0;
|
|
43
|
+
const existing = existingByLabel.get(declaration.label);
|
|
44
|
+
const previous = previousDeclarations.get(declaration.label);
|
|
45
|
+
const declarationChanged = !isDefined(previous) || !ScriptParamDeclaration.isEqual(previous, declaration);
|
|
46
|
+
if (isDefined(existing) && declarationChanged) {
|
|
47
|
+
existing.delete();
|
|
48
|
+
existingByLabel.delete(declaration.label);
|
|
49
|
+
}
|
|
50
|
+
const current = existingByLabel.get(declaration.label);
|
|
51
|
+
if (isDefined(current)) {
|
|
52
|
+
if (current.index.getValue() !== unifiedIndex) {
|
|
53
|
+
current.index.setValue(unifiedIndex);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
else {
|
|
57
|
+
WerkstattParameterBox.create(boxGraph, UUID.generate(), paramBox => {
|
|
58
|
+
paramBox.owner.refer(deviceBox.parameters);
|
|
59
|
+
paramBox.label.setValue(declaration.label);
|
|
60
|
+
paramBox.index.setValue(unifiedIndex);
|
|
61
|
+
paramBox.value.setValue(declaration.defaultValue);
|
|
62
|
+
paramBox.defaultValue.setValue(declaration.defaultValue);
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
newDeclarations.set(declaration.label, declaration);
|
|
66
|
+
}
|
|
67
|
+
cachedParamDeclarations.set(deviceBox, newDeclarations);
|
|
68
|
+
};
|
|
69
|
+
const reconcileSamples = (deviceBox, declared, order) => {
|
|
70
|
+
const boxGraph = deviceBox.graph;
|
|
71
|
+
const existingPointers = deviceBox.samples.pointerHub.filter();
|
|
72
|
+
const existingByLabel = new Map();
|
|
73
|
+
for (const pointer of existingPointers) {
|
|
74
|
+
const sampleBox = asInstanceOf(pointer.box, WerkstattSampleBox);
|
|
75
|
+
existingByLabel.set(sampleBox.label.getValue(), sampleBox);
|
|
76
|
+
}
|
|
77
|
+
const seen = new Set();
|
|
78
|
+
for (const { label } of declared) {
|
|
79
|
+
seen.add(label);
|
|
80
|
+
}
|
|
81
|
+
for (const [label, sampleBox] of existingByLabel) {
|
|
82
|
+
if (!seen.has(label)) {
|
|
83
|
+
sampleBox.file.targetVertex.ifSome(({ box: fileBox }) => {
|
|
84
|
+
const mustDelete = fileBox.pointerHub.size() === 1;
|
|
85
|
+
sampleBox.file.defer();
|
|
86
|
+
if (mustDelete) {
|
|
87
|
+
fileBox.delete();
|
|
88
|
+
}
|
|
89
|
+
});
|
|
90
|
+
sampleBox.delete();
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
seen.clear();
|
|
94
|
+
for (const declaration of declared) {
|
|
95
|
+
if (seen.has(declaration.label)) {
|
|
96
|
+
continue;
|
|
97
|
+
}
|
|
98
|
+
seen.add(declaration.label);
|
|
99
|
+
const unifiedIndex = order.get(declaration.label) ?? 0;
|
|
100
|
+
const existing = existingByLabel.get(declaration.label);
|
|
101
|
+
if (isDefined(existing)) {
|
|
102
|
+
if (existing.index.getValue() !== unifiedIndex) {
|
|
103
|
+
existing.index.setValue(unifiedIndex);
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
else {
|
|
107
|
+
WerkstattSampleBox.create(boxGraph, UUID.generate(), sampleBox => {
|
|
108
|
+
sampleBox.owner.refer(deviceBox.samples);
|
|
109
|
+
sampleBox.label.setValue(declaration.label);
|
|
110
|
+
sampleBox.index.setValue(unifiedIndex);
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
};
|
|
115
|
+
const wrapCode = (config, uuid, update, userCode) => `
|
|
116
|
+
if (typeof globalThis.openDAW === "undefined") { globalThis.openDAW = {} }
|
|
117
|
+
if (typeof globalThis.openDAW.${config.registryName} === "undefined") { globalThis.openDAW.${config.registryName} = {} }
|
|
118
|
+
globalThis.openDAW.${config.registryName}["${uuid}"] = {
|
|
119
|
+
update: ${update},
|
|
120
|
+
create: (function ${config.functionName}() {
|
|
121
|
+
${userCode}
|
|
122
|
+
return Processor
|
|
123
|
+
})()
|
|
124
|
+
}
|
|
125
|
+
`;
|
|
126
|
+
const validateCode = (wrappedCode) => { new Function(wrappedCode); };
|
|
127
|
+
const registerWorklet = async (audioContext, wrappedCode) => {
|
|
128
|
+
const blob = new Blob([wrappedCode], { type: "application/javascript" });
|
|
129
|
+
const blobUrl = URL.createObjectURL(blob);
|
|
130
|
+
try {
|
|
131
|
+
await audioContext.audioWorklet.addModule(blobUrl);
|
|
132
|
+
}
|
|
133
|
+
finally {
|
|
134
|
+
URL.revokeObjectURL(blobUrl);
|
|
135
|
+
}
|
|
136
|
+
};
|
|
137
|
+
export var ScriptCompiler;
|
|
138
|
+
(function (ScriptCompiler) {
|
|
139
|
+
ScriptCompiler.create = (config) => {
|
|
140
|
+
const headerPattern = createHeaderPattern(config.headerTag);
|
|
141
|
+
const createHeader = (update) => `// @${config.headerTag} js ${COMPILER_VERSION} ${update}\n`;
|
|
142
|
+
let maxUpdate = 0;
|
|
143
|
+
return {
|
|
144
|
+
stripHeader: (source) => parseHeader(source, headerPattern).userCode,
|
|
145
|
+
load: async (audioContext, deviceBox) => {
|
|
146
|
+
const { userCode, update } = parseHeader(deviceBox.code.getValue(), headerPattern);
|
|
147
|
+
if (update === 0) {
|
|
148
|
+
return;
|
|
149
|
+
}
|
|
150
|
+
const params = ScriptParamDeclaration.parseParams(userCode);
|
|
151
|
+
const declMap = new Map();
|
|
152
|
+
for (const declaration of params) {
|
|
153
|
+
declMap.set(declaration.label, declaration);
|
|
154
|
+
}
|
|
155
|
+
cachedParamDeclarations.set(deviceBox, declMap);
|
|
156
|
+
const uuid = UUID.toString(deviceBox.address.uuid);
|
|
157
|
+
const wrappedCode = wrapCode(config, uuid, update, userCode);
|
|
158
|
+
validateCode(wrappedCode);
|
|
159
|
+
return registerWorklet(audioContext, wrappedCode);
|
|
160
|
+
},
|
|
161
|
+
compile: async (audioContext, editing, deviceBox, source, append = false) => {
|
|
162
|
+
const userCode = parseHeader(source, headerPattern).userCode;
|
|
163
|
+
const currentUpdate = parseHeader(deviceBox.code.getValue(), headerPattern).update;
|
|
164
|
+
maxUpdate = Math.max(maxUpdate, currentUpdate);
|
|
165
|
+
const newUpdate = maxUpdate + 1;
|
|
166
|
+
maxUpdate = newUpdate;
|
|
167
|
+
const uuid = UUID.toString(deviceBox.address.uuid);
|
|
168
|
+
const params = ScriptParamDeclaration.parseParams(userCode);
|
|
169
|
+
const samples = ScriptParamDeclaration.parseSamples(userCode);
|
|
170
|
+
const order = ScriptParamDeclaration.parseDeclarationOrder(userCode);
|
|
171
|
+
const wrappedCode = wrapCode(config, uuid, newUpdate, userCode);
|
|
172
|
+
validateCode(wrappedCode);
|
|
173
|
+
const modifier = () => {
|
|
174
|
+
deviceBox.code.setValue(createHeader(newUpdate) + userCode);
|
|
175
|
+
reconcileParameters(deviceBox, params, order);
|
|
176
|
+
reconcileSamples(deviceBox, samples, order);
|
|
177
|
+
};
|
|
178
|
+
if (append) {
|
|
179
|
+
editing.append(modifier);
|
|
180
|
+
}
|
|
181
|
+
else {
|
|
182
|
+
editing.modify(modifier);
|
|
183
|
+
}
|
|
184
|
+
return registerWorklet(audioContext, wrappedCode);
|
|
185
|
+
}
|
|
186
|
+
};
|
|
187
|
+
};
|
|
188
|
+
})(ScriptCompiler || (ScriptCompiler = {}));
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { Observable, StringMapping, Terminable, ValueMapping } from "@opendaw/lib-std";
|
|
2
|
+
import { Field, StringField } from "@opendaw/lib-box";
|
|
3
|
+
import { Pointers } from "@opendaw/studio-enums";
|
|
4
|
+
import { ParameterAdapterSet } from "./ParameterAdapterSet";
|
|
5
|
+
export type ParamMapping = "unipolar" | "linear" | "exp" | "int" | "bool";
|
|
6
|
+
export interface ParamDeclaration {
|
|
7
|
+
readonly label: string;
|
|
8
|
+
readonly defaultValue: number;
|
|
9
|
+
readonly min: number;
|
|
10
|
+
readonly max: number;
|
|
11
|
+
readonly mapping: ParamMapping;
|
|
12
|
+
readonly unit: string;
|
|
13
|
+
}
|
|
14
|
+
export interface SampleDeclaration {
|
|
15
|
+
readonly label: string;
|
|
16
|
+
}
|
|
17
|
+
export declare namespace ScriptParamDeclaration {
|
|
18
|
+
export const isEqual: (a: ParamDeclaration, b: ParamDeclaration) => boolean;
|
|
19
|
+
export const parseParams: (code: string) => ReadonlyArray<ParamDeclaration>;
|
|
20
|
+
export const parseSamples: (code: string) => ReadonlyArray<SampleDeclaration>;
|
|
21
|
+
export const parseDeclarationOrder: (code: string) => Map<string, number>;
|
|
22
|
+
export const resolveValueMapping: (declaration: ParamDeclaration) => ValueMapping<number>;
|
|
23
|
+
export const resolveStringMapping: (declaration: ParamDeclaration) => StringMapping<number>;
|
|
24
|
+
type ParamMapping = {
|
|
25
|
+
valueMapping: ValueMapping<number>;
|
|
26
|
+
stringMapping: StringMapping<number>;
|
|
27
|
+
};
|
|
28
|
+
export const resolveParamMappings: (declaration: ParamDeclaration) => ParamMapping;
|
|
29
|
+
export type ScriptParamsBinding = {
|
|
30
|
+
readonly terminable: Terminable;
|
|
31
|
+
readonly codeChanged: Observable<void>;
|
|
32
|
+
};
|
|
33
|
+
export const subscribeScriptParams: (parametric: ParameterAdapterSet, codeField: StringField, parametersField: Field<Pointers.Parameter>) => ScriptParamsBinding;
|
|
34
|
+
export {};
|
|
35
|
+
}
|
|
36
|
+
//# sourceMappingURL=ScriptParamDeclaration.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ScriptParamDeclaration.d.ts","sourceRoot":"","sources":["../src/ScriptParamDeclaration.ts"],"names":[],"mappings":"AAAA,OAAO,EAA8C,UAAU,EAAE,aAAa,EAAE,UAAU,EAAE,YAAY,EAAC,MAAM,kBAAkB,CAAA;AACjI,OAAO,EAAC,KAAK,EAAE,WAAW,EAAC,MAAM,kBAAkB,CAAA;AACnD,OAAO,EAAC,QAAQ,EAAC,MAAM,uBAAuB,CAAA;AAE9C,OAAO,EAAC,mBAAmB,EAAC,MAAM,uBAAuB,CAAA;AAEzD,MAAM,MAAM,YAAY,GAAG,UAAU,GAAG,QAAQ,G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