@opendaw/studio-adapters 0.2.0 → 0.3.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.
Files changed (61) hide show
  1. package/dist/AutomatableParameterFieldAdapter.d.ts +3 -2
  2. package/dist/AutomatableParameterFieldAdapter.d.ts.map +1 -1
  3. package/dist/AutomatableParameterFieldAdapter.js +6 -3
  4. package/dist/BoxAdapters.d.ts.map +1 -1
  5. package/dist/BoxAdapters.js +2 -0
  6. package/dist/ParameterAdapterSet.d.ts +2 -2
  7. package/dist/ParameterAdapterSet.d.ts.map +1 -1
  8. package/dist/ScriptCompiler.d.ts.map +1 -1
  9. package/dist/ScriptCompiler.js +4 -2
  10. package/dist/ScriptDeclaration.d.ts +1 -0
  11. package/dist/ScriptDeclaration.d.ts.map +1 -1
  12. package/dist/ScriptDeclaration.js +20 -5
  13. package/dist/audio-unit/AudioUnitBoxAdapter.js +4 -4
  14. package/dist/devices/audio-effects/DelayDeviceBoxAdapter.js +13 -13
  15. package/dist/devices/audio-effects/NeuralAmpDeviceBoxAdapter.js +2 -2
  16. package/dist/devices/audio-effects/RevampDeviceBoxAdapter.js +3 -3
  17. package/dist/devices/audio-effects/ReverbDeviceBoxAdapter.js +4 -4
  18. package/dist/devices/audio-effects/StereoToolDeviceBoxAdapter.js +1 -1
  19. package/dist/devices/instruments/Cubed/AblPattern.d.ts +42 -0
  20. package/dist/devices/instruments/Cubed/AblPattern.d.ts.map +1 -0
  21. package/dist/devices/instruments/Cubed/AblPattern.js +66 -0
  22. package/dist/devices/instruments/Cubed/CubedPatternData.d.ts +16 -0
  23. package/dist/devices/instruments/Cubed/CubedPatternData.d.ts.map +1 -0
  24. package/dist/devices/instruments/Cubed/CubedPatternData.js +75 -0
  25. package/dist/devices/instruments/Cubed/CubedRandomize.d.ts +22 -0
  26. package/dist/devices/instruments/Cubed/CubedRandomize.d.ts.map +1 -0
  27. package/dist/devices/instruments/Cubed/CubedRandomize.js +51 -0
  28. package/dist/devices/instruments/Cubed/CubedStep.d.ts +13 -0
  29. package/dist/devices/instruments/Cubed/CubedStep.d.ts.map +1 -0
  30. package/dist/devices/instruments/Cubed/CubedStep.js +15 -0
  31. package/dist/devices/instruments/CubedDeviceBoxAdapter.d.ts +48 -0
  32. package/dist/devices/instruments/CubedDeviceBoxAdapter.d.ts.map +1 -0
  33. package/dist/devices/instruments/CubedDeviceBoxAdapter.js +100 -0
  34. package/dist/devices/instruments/MIDIOutputDeviceBoxAdapter.d.ts.map +1 -1
  35. package/dist/devices/instruments/MIDIOutputDeviceBoxAdapter.js +19 -3
  36. package/dist/devices/instruments/NanoDeviceBoxAdapter.js +2 -2
  37. package/dist/devices/instruments/Playfield/ChopModel.d.ts +21 -0
  38. package/dist/devices/instruments/Playfield/ChopModel.d.ts.map +1 -0
  39. package/dist/devices/instruments/Playfield/ChopModel.js +109 -0
  40. package/dist/devices/instruments/PlayfieldDeviceBoxAdapter.d.ts +12 -2
  41. package/dist/devices/instruments/PlayfieldDeviceBoxAdapter.d.ts.map +1 -1
  42. package/dist/devices/instruments/PlayfieldDeviceBoxAdapter.js +21 -1
  43. package/dist/devices/instruments/TapeDeviceBoxAdapter.js +4 -4
  44. package/dist/devices/midi-effects/ArpeggioDeviceBoxAdapter.js +1 -1
  45. package/dist/devices/midi-effects/PitchDeviceBoxAdapter.js +3 -3
  46. package/dist/factories/InstrumentBox.d.ts +2 -2
  47. package/dist/factories/InstrumentBox.d.ts.map +1 -1
  48. package/dist/factories/InstrumentFactories.d.ts +5 -9
  49. package/dist/factories/InstrumentFactories.d.ts.map +1 -1
  50. package/dist/factories/InstrumentFactories.js +20 -4
  51. package/dist/grooves/GrooveShuffleBoxAdapter.js +2 -2
  52. package/dist/index.d.ts +6 -0
  53. package/dist/index.d.ts.map +1 -1
  54. package/dist/index.js +6 -0
  55. package/dist/timeline/TrackBoxAdapter.d.ts +1 -0
  56. package/dist/timeline/TrackBoxAdapter.d.ts.map +1 -1
  57. package/dist/timeline/TrackBoxAdapter.js +20 -11
  58. package/dist/timeline/event/InterpolationFieldAdapter.d.ts +3 -1
  59. package/dist/timeline/event/InterpolationFieldAdapter.d.ts.map +1 -1
  60. package/dist/timeline/event/InterpolationFieldAdapter.js +2 -0
  61. package/package.json +10 -10
@@ -0,0 +1,51 @@
1
+ import { Arrays, clamp } from "@opendaw/lib-std";
2
+ import { MidiKeys } from "@opendaw/lib-dsp";
3
+ import { CubedStep } from "./CubedStep";
4
+ export var CubedRandomize;
5
+ (function (CubedRandomize) {
6
+ CubedRandomize.Contours = ["free", "walk", "rise", "fall"];
7
+ CubedRandomize.Motifs = [0, 2, 3, 4, 8];
8
+ CubedRandomize.Default = {
9
+ root: 0,
10
+ scale: MidiKeys.StockScales[1],
11
+ octave: 1,
12
+ octaves: 3,
13
+ density: 0.6,
14
+ accent: 0.3,
15
+ slide: 0.2,
16
+ motif: 0,
17
+ contour: "free",
18
+ rootFirst: true
19
+ };
20
+ const keysOf = (scale) => {
21
+ const keys = Arrays.create(index => index, 12).filter(key => scale.has(key));
22
+ return keys.length === 0 ? [0] : keys;
23
+ };
24
+ CubedRandomize.steps = (options, count) => {
25
+ const keys = keysOf(options.scale);
26
+ const octaves = Math.max(1, options.octaves);
27
+ const span = keys.length * octaves;
28
+ const base = (options.octave + 2) * 12 + options.root;
29
+ const noteOf = (degree) => {
30
+ const bounded = clamp(degree, 0, span - 1);
31
+ return clamp(base + keys[bounded % keys.length] + Math.floor(bounded / keys.length) * 12, 0, 127);
32
+ };
33
+ const period = options.motif > 0 ? Math.min(options.motif, count) : count;
34
+ const jitter = (amount) => Math.round((Math.random() * 2 - 1) * amount);
35
+ const degrees = new Array(period);
36
+ for (let index = 0; index < period; index++) {
37
+ const ramp = period < 2 ? 0 : (index / (period - 1)) * (span - 1);
38
+ degrees[index] = options.rootFirst && index === 0 ? 0 : clamp(options.contour === "walk" ? (index === 0 ? span >> 1 : degrees[index - 1] + jitter(2))
39
+ : options.contour === "rise" ? Math.round(ramp) + jitter(1)
40
+ : options.contour === "fall" ? Math.round(span - 1 - ramp) + jitter(1)
41
+ : Math.floor(Math.random() * span), 0, span - 1);
42
+ }
43
+ const motif = Arrays.create(index => CubedStep.pack({
44
+ note: noteOf(degrees[index]),
45
+ active: (options.rootFirst && index === 0) || Math.random() < options.density,
46
+ slide: Math.random() < options.slide,
47
+ accent: Math.random() < options.accent
48
+ }), period);
49
+ return Arrays.create(index => motif[index % period], count);
50
+ };
51
+ })(CubedRandomize || (CubedRandomize = {}));
@@ -0,0 +1,13 @@
1
+ import { int } from "@opendaw/lib-std";
2
+ export type CubedStep = {
3
+ note: int;
4
+ active: boolean;
5
+ slide: boolean;
6
+ accent: boolean;
7
+ };
8
+ export declare namespace CubedStep {
9
+ const DefaultNote: int;
10
+ const pack: (step: CubedStep) => int;
11
+ const unpack: (bits: int) => CubedStep;
12
+ }
13
+ //# sourceMappingURL=CubedStep.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CubedStep.d.ts","sourceRoot":"","sources":["../../../../src/devices/instruments/Cubed/CubedStep.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,GAAG,EAAC,MAAM,kBAAkB,CAAA;AAEpC,MAAM,MAAM,SAAS,GAAG;IACpB,IAAI,EAAE,GAAG,CAAA;IACT,MAAM,EAAE,OAAO,CAAA;IACf,KAAK,EAAE,OAAO,CAAA;IACd,MAAM,EAAE,OAAO,CAAA;CAClB,CAAA;AAED,yBAAiB,SAAS,CAAC;IAChB,MAAM,WAAW,EAAE,GAAQ,CAAA;IAG3B,MAAM,IAAI,GAAI,MAAM,SAAS,KAAG,GAIL,CAAA;IAE3B,MAAM,MAAM,GAAI,MAAM,GAAG,KAAG,SAKjC,CAAA;CACL"}
@@ -0,0 +1,15 @@
1
+ export var CubedStep;
2
+ (function (CubedStep) {
3
+ CubedStep.DefaultNote = 60;
4
+ // one int32 per step: midi-note 0..6, active 7, slide 8, accent 9
5
+ CubedStep.pack = (step) => (step.note & 0x7F)
6
+ | ((step.active ? 1 : 0) << 7)
7
+ | ((step.slide ? 1 : 0) << 8)
8
+ | ((step.accent ? 1 : 0) << 9);
9
+ CubedStep.unpack = (bits) => ({
10
+ note: bits & 0x7F,
11
+ active: ((bits >> 7) & 1) === 1,
12
+ slide: ((bits >> 8) & 1) === 1,
13
+ accent: ((bits >> 9) & 1) === 1
14
+ });
15
+ })(CubedStep || (CubedStep = {}));
@@ -0,0 +1,48 @@
1
+ import { int, UUID } from "@opendaw/lib-std";
2
+ import { CubedDeviceBox, CubedPattern } from "@opendaw/studio-boxes";
3
+ import { Address, BooleanField, StringField } from "@opendaw/lib-box";
4
+ import { DeviceHost, InstrumentDeviceBoxAdapter } from "../../DeviceAdapter";
5
+ import { LabeledAudioOutput } from "../../LabeledAudioOutputsOwner";
6
+ import { BoxAdaptersContext } from "../../BoxAdaptersContext";
7
+ import { TrackType } from "../../timeline/TrackType";
8
+ import { AudioUnitBoxAdapter } from "../../audio-unit/AudioUnitBoxAdapter";
9
+ import { CubedPatternData } from "./Cubed/CubedPatternData";
10
+ import { CubedRandomizeOptions } from "./Cubed/CubedRandomize";
11
+ export declare class CubedDeviceBoxAdapter implements InstrumentDeviceBoxAdapter {
12
+ #private;
13
+ readonly type = "instrument";
14
+ readonly accepts = "midi";
15
+ readonly manualUrl = "manuals/devices/instruments/cubed";
16
+ readonly namedParameter: {
17
+ readonly tuning: import("../..").AutomatableParameterFieldAdapter<number>;
18
+ readonly cutoff: import("../..").AutomatableParameterFieldAdapter<import("@opendaw/lib-box").PrimitiveValues>;
19
+ readonly resonance: import("../..").AutomatableParameterFieldAdapter<import("@opendaw/lib-box").PrimitiveValues>;
20
+ readonly envMod: import("../..").AutomatableParameterFieldAdapter<import("@opendaw/lib-box").PrimitiveValues>;
21
+ readonly decay: import("../..").AutomatableParameterFieldAdapter<import("@opendaw/lib-box").PrimitiveValues>;
22
+ readonly accent: import("../..").AutomatableParameterFieldAdapter<import("@opendaw/lib-box").PrimitiveValues>;
23
+ readonly volume: import("../..").AutomatableParameterFieldAdapter<number>;
24
+ readonly waveform: import("../..").AutomatableParameterFieldAdapter<number>;
25
+ readonly patternIndex: import("../..").AutomatableParameterFieldAdapter<number>;
26
+ };
27
+ constructor(context: BoxAdaptersContext, box: CubedDeviceBox);
28
+ get box(): CubedDeviceBox;
29
+ get uuid(): UUID.Bytes;
30
+ get address(): Address;
31
+ get labelField(): StringField;
32
+ get iconField(): StringField;
33
+ get defaultTrackType(): TrackType;
34
+ get enabledField(): BooleanField;
35
+ get minimizedField(): BooleanField;
36
+ get acceptsMidiEvents(): boolean;
37
+ currentPattern(): CubedPattern;
38
+ readCurrentPattern(): CubedPatternData;
39
+ writeCurrentPattern({ length, steps }: CubedPatternData): void;
40
+ clearCurrentPattern(): void;
41
+ randomizeCurrentPattern(options?: CubedRandomizeOptions): void;
42
+ rotateCurrentPattern(offset: int): void;
43
+ deviceHost(): DeviceHost;
44
+ audioUnitBoxAdapter(): AudioUnitBoxAdapter;
45
+ labeledAudioOutputs(): Iterable<LabeledAudioOutput>;
46
+ terminate(): void;
47
+ }
48
+ //# sourceMappingURL=CubedDeviceBoxAdapter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CubedDeviceBoxAdapter.d.ts","sourceRoot":"","sources":["../../../src/devices/instruments/CubedDeviceBoxAdapter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,GAAG,EAAyB,IAAI,EAAe,MAAM,kBAAkB,CAAA;AACtF,OAAO,EAAC,cAAc,EAAE,YAAY,EAAC,MAAM,uBAAuB,CAAA;AAClE,OAAO,EAAC,OAAO,EAAE,YAAY,EAAE,WAAW,EAAC,MAAM,kBAAkB,CAAA;AACnE,OAAO,EAAC,UAAU,EAAW,0BAA0B,EAAC,MAAM,qBAAqB,CAAA;AACnF,OAAO,EAAC,kBAAkB,EAAC,MAAM,gCAAgC,CAAA;AACjE,OAAO,EAAC,kBAAkB,EAAC,MAAM,0BAA0B,CAAA;AAE3D,OAAO,EAAC,SAAS,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ivateFieldSet) || function (receiver, state, value, kind, f) {
2
+ if (kind === "m") throw new TypeError("Private method is not writable");
3
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
4
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
5
+ return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
6
+ };
7
+ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
8
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
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
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
11
+ };
12
+ var _CubedDeviceBoxAdapter_instances, _CubedDeviceBoxAdapter_context, _CubedDeviceBoxAdapter_box, _CubedDeviceBoxAdapter_parametric, _CubedDeviceBoxAdapter_wrapParameters;
13
+ import { clamp, Option, StringMapping, ValueMapping } from "@opendaw/lib-std";
14
+ import { Devices } from "../../DeviceAdapter";
15
+ import { ParameterAdapterSet } from "../../ParameterAdapterSet";
16
+ import { TrackType } from "../../timeline/TrackType";
17
+ import { CubedStep } from "./Cubed/CubedStep";
18
+ import { CubedRandomize } from "./Cubed/CubedRandomize";
19
+ const DefaultStep = CubedStep.pack({ note: CubedStep.DefaultNote, active: false, slide: false, accent: false });
20
+ export class CubedDeviceBoxAdapter {
21
+ constructor(context, box) {
22
+ _CubedDeviceBoxAdapter_instances.add(this);
23
+ this.type = "instrument";
24
+ this.accepts = "midi";
25
+ this.manualUrl = "manuals/devices/instruments/cubed";
26
+ _CubedDeviceBoxAdapter_context.set(this, void 0);
27
+ _CubedDeviceBoxAdapter_box.set(this, void 0);
28
+ _CubedDeviceBoxAdapter_parametric.set(this, void 0);
29
+ __classPrivateFieldSet(this, _CubedDeviceBoxAdapter_context, context, "f");
30
+ __classPrivateFieldSet(this, _CubedDeviceBoxAdapter_box, box, "f");
31
+ __classPrivateFieldSet(this, _CubedDeviceBoxAdapter_parametric, new ParameterAdapterSet(__classPrivateFieldGet(this, _CubedDeviceBoxAdapter_context, "f")), "f");
32
+ this.namedParameter = __classPrivateFieldGet(this, _CubedDeviceBoxAdapter_instances, "m", _CubedDeviceBoxAdapter_wrapParameters).call(this, box);
33
+ }
34
+ get box() { return __classPrivateFieldGet(this, _CubedDeviceBoxAdapter_box, "f"); }
35
+ get uuid() { return __classPrivateFieldGet(this, _CubedDeviceBoxAdapter_box, "f").address.uuid; }
36
+ get address() { return __classPrivateFieldGet(this, _CubedDeviceBoxAdapter_box, "f").address; }
37
+ get labelField() { return __classPrivateFieldGet(this, _CubedDeviceBoxAdapter_box, "f").label; }
38
+ get iconField() { return __classPrivateFieldGet(this, _CubedDeviceBoxAdapter_box, "f").icon; }
39
+ get defaultTrackType() { return TrackType.Notes; }
40
+ get enabledField() { return __classPrivateFieldGet(this, _CubedDeviceBoxAdapter_box, "f").enabled; }
41
+ get minimizedField() { return __classPrivateFieldGet(this, _CubedDeviceBoxAdapter_box, "f").minimized; }
42
+ get acceptsMidiEvents() { return true; }
43
+ currentPattern() { return __classPrivateFieldGet(this, _CubedDeviceBoxAdapter_box, "f").patterns.getField(__classPrivateFieldGet(this, _CubedDeviceBoxAdapter_box, "f").patternIndex.getValue()); }
44
+ readCurrentPattern() {
45
+ const pattern = this.currentPattern();
46
+ const length = pattern.length.getValue();
47
+ return {
48
+ length,
49
+ steps: pattern.steps.fields().slice(0, length).map(field => CubedStep.unpack(field.getValue()))
50
+ };
51
+ }
52
+ writeCurrentPattern({ length, steps }) {
53
+ const pattern = this.currentPattern();
54
+ const fields = pattern.steps.fields();
55
+ const used = Math.min(steps.length, fields.length);
56
+ fields.forEach((field, index) => field.setValue(index < used ? CubedStep.pack(steps[index]) : DefaultStep));
57
+ pattern.length.setValue(clamp(length, 1, fields.length));
58
+ }
59
+ clearCurrentPattern() {
60
+ this.currentPattern().steps.fields().forEach(field => field.setValue(DefaultStep));
61
+ }
62
+ randomizeCurrentPattern(options = CubedRandomize.Default) {
63
+ const pattern = this.currentPattern();
64
+ const length = pattern.length.getValue();
65
+ const steps = CubedRandomize.steps(options, length);
66
+ pattern.steps.fields().forEach((field, index) => field.setValue(index < length ? steps[index] : DefaultStep));
67
+ }
68
+ rotateCurrentPattern(offset) {
69
+ const pattern = this.currentPattern();
70
+ const length = pattern.length.getValue();
71
+ const fields = pattern.steps.fields().slice(0, length);
72
+ const values = fields.map(field => field.getValue());
73
+ fields.forEach((field, index) => field.setValue(values[(index + offset + length) % length]));
74
+ }
75
+ deviceHost() {
76
+ return __classPrivateFieldGet(this, _CubedDeviceBoxAdapter_context, "f").boxAdapters
77
+ .adapterFor(__classPrivateFieldGet(this, _CubedDeviceBoxAdapter_box, "f").host.targetVertex.unwrap("no device-host").box, Devices.isHost);
78
+ }
79
+ audioUnitBoxAdapter() { return this.deviceHost().audioUnitBoxAdapter(); }
80
+ *labeledAudioOutputs() {
81
+ yield { address: this.address, label: this.labelField.getValue(), children: () => Option.None };
82
+ }
83
+ terminate() {
84
+ __classPrivateFieldGet(this, _CubedDeviceBoxAdapter_parametric, "f").terminate();
85
+ }
86
+ }
87
+ _CubedDeviceBoxAdapter_context = new WeakMap(), _CubedDeviceBoxAdapter_box = new WeakMap(), _CubedDeviceBoxAdapter_parametric = new WeakMap(), _CubedDeviceBoxAdapter_instances = new WeakSet(), _CubedDeviceBoxAdapter_wrapParameters = function _CubedDeviceBoxAdapter_wrapParameters(box) {
88
+ const unipolar = (field, name, anchor) => __classPrivateFieldGet(this, _CubedDeviceBoxAdapter_parametric, "f").createParameter(field, ValueMapping.unipolar(), StringMapping.percent({ fractionDigits: 0 }), name, anchor);
89
+ return {
90
+ tuning: __classPrivateFieldGet(this, _CubedDeviceBoxAdapter_parametric, "f").createParameter(box.tuning, ValueMapping.linear(-1200, 1200), StringMapping.numeric({ unit: "ct", fractionDigits: 0 }), "Tuning", 0.5),
91
+ cutoff: unipolar(box.cutoff, "Cutoff"),
92
+ resonance: unipolar(box.resonance, "Resonance"),
93
+ envMod: unipolar(box.envMod, "Env Mod"),
94
+ decay: unipolar(box.decay, "Decay"),
95
+ accent: unipolar(box.accent, "Accent"),
96
+ volume: __classPrivateFieldGet(this, _CubedDeviceBoxAdapter_parametric, "f").createParameter(box.volume, ValueMapping.DefaultDecibel, StringMapping.numeric({ unit: "dB", fractionDigits: 1 }), "Volume"),
97
+ waveform: __classPrivateFieldGet(this, _CubedDeviceBoxAdapter_parametric, "f").createParameter(box.waveform, ValueMapping.linearInteger(0, 1), StringMapping.indices("", ["Sawtooth", "Square"]), "Waveform", 0.5),
98
+ patternIndex: __classPrivateFieldGet(this, _CubedDeviceBoxAdapter_parametric, "f").createParameter(box.patternIndex, ValueMapping.linearInteger(0, box.patterns.fields().length - 1), StringMapping.oneBasedIndex(), "Pattern")
99
+ };
100
+ };
@@ -1 +1 @@
1
- {"version":3,"file":"MIDIOutputDeviceBoxAdapter.d.ts","sourceRoot":"","sources":["../../../src/devices/instruments/MIDIOutputDeviceBoxAdapter.ts"],"names":[],"mappings":"AAAA,OAAO,EAGH,gBAAgB,EAIhB,IAAI,EAEP,MAAM,kBAAkB,CAAA;AACzB,OAAO,EAAC,aAAa,EAAE,mBAAmB,EAAyB,MAAM,uBAAuB,CAAA;AAChG,OAAO,EAAC,OAAO,EAAE,YAAY,EAAE,WAAW,EAAC,MAAM,kBAAkB,CAAA;AACnE,OAAO,EAAC,UAAU,EAAW,0BAA0B,EAAC,MAAM,qBAAqB,CAAA;AACnF,OAAO,EAAC,kBAAkB,EAAC,MAAM,gCAAgC,CAAA;AACjE,OAAO,EAAC,kBAAkB,EAAC,MAAM,0BAA0B,CAAA;AAE3D,OAAO,EAAC,mBAAmB,EAAC,MAAM,2BAA2B,CAAA;AAC7D,OAAO,EAAC,SAAS,EAAC,MAAM,0BAA0B,CAAA;AAClD,OAAO,EAAC,mBAAmB,EAAC,MAAM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,gCAAgC,CAAA;AACjE,OAAO,EAAC,kBAAkB,EAAC,MAAM,0BAA0B,CAAA;AAE3D,OAAO,EAAC,mBAAmB,EAAC,MAAM,2BAA2B,CAAA;AAC7D,OAAO,EAAC,SAAS,EAAC,MAAM,0BAA0B,CAAA;AAClD,OAAO,EAAC,mBAAmB,EAAC,MAAM,sCAAsC,CAAA;AAoBxE,qBAAa,0BAA2B,YAAW,0BAA0B;;IAGzE,QAAQ,CAAC,IAAI,gBAAe;IAC5B,QAAQ,CAAC,OAAO,UAAS;IACzB,QAAQ,CAAC,SAAS,6CAA8B;gBAQpC,OAAO,EAAE,kBAAkB,EAAE,GAAG,EAAE,mBAAmB;IAuBjE,IAAI,GAAG,IAAI,mBAAmB,CAAmB;IACjD,IAAI,IAAI,IAAI,IAAI,CAAC,KAAK,CAAgC;IACtD,IAAI,OAAO,IAAI,OAAO,CAA2B;IACjD,IAAI,UAAU,IAAI,WAAW,CAAyB;IACtD,IAAI,SAAS,IAAI,WAAW,CAAwB;IACpD,IAAI,gBAAgB,IAAI,SAAS,CAAyB;IAC1D,IAAI,YAAY,IAAI,YAAY,CAA2B;IAC3D,IAAI,cAAc,IAAI,YAAY,CAA6B;IAC/D,IAAI,iBAAiB,IAAI,OAAO,CAAc;IAC9C,IAAI,UAAU,IAAI,mBAAmB,CAA0B;IAC/D,IAAI,UAAU,IAAI,gBAAgB,CAAC,aAAa,CAAC,CAA0B;IAE3E,UAAU,IAAI,UAAU;IAKxB,mBAAmB,IAAI,mBAAmB;IAEzC,mBAAmB,IAAI,QAAQ,CAAC,kBAAkB,CAAC;IAIpD,SAAS,IAAI,IAAI;CACpB"}
@@ -10,12 +10,26 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
10
10
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
11
11
  };
12
12
  var _MIDIOutputDeviceBoxAdapter_terminator, _MIDIOutputDeviceBoxAdapter_context, _MIDIOutputDeviceBoxAdapter_box, _MIDIOutputDeviceBoxAdapter_midiDevice, _MIDIOutputDeviceBoxAdapter_parametric;
13
- import { asInstanceOf, MutableObservableOption, Option, StringMapping, Terminator, ValueMapping } from "@opendaw/lib-std";
13
+ import { asInstanceOf, MutableObservableOption, Option, StringMapping, Terminable, Terminator, ValueMapping } from "@opendaw/lib-std";
14
14
  import { MIDIOutputBox, MIDIOutputParameterBox } from "@opendaw/studio-boxes";
15
15
  import { Devices } from "../../DeviceAdapter";
16
16
  import { DeviceManualUrls } from "../../DeviceManualUrls";
17
17
  import { ParameterAdapterSet } from "../../ParameterAdapterSet";
18
18
  import { TrackType } from "../../timeline/TrackType";
19
+ const parameterName = (box) => new class {
20
+ getValue() {
21
+ const label = box.label.getValue().trim();
22
+ const controller = box.controller.getValue();
23
+ return label.length === 0 ? String(controller) : `${label} ${controller}`;
24
+ }
25
+ subscribe(observer) {
26
+ return Terminable.many(box.label.subscribe(() => observer(this)), box.controller.subscribe(() => observer(this)));
27
+ }
28
+ catchupAndSubscribe(observer) {
29
+ observer(this);
30
+ return this.subscribe(observer);
31
+ }
32
+ };
19
33
  export class MIDIOutputDeviceBoxAdapter {
20
34
  constructor(context, box) {
21
35
  _MIDIOutputDeviceBoxAdapter_terminator.set(this, new Terminator());
@@ -31,8 +45,10 @@ export class MIDIOutputDeviceBoxAdapter {
31
45
  __classPrivateFieldSet(this, _MIDIOutputDeviceBoxAdapter_midiDevice, new MutableObservableOption(), "f");
32
46
  __classPrivateFieldSet(this, _MIDIOutputDeviceBoxAdapter_parametric, __classPrivateFieldGet(this, _MIDIOutputDeviceBoxAdapter_terminator, "f").own(new ParameterAdapterSet(__classPrivateFieldGet(this, _MIDIOutputDeviceBoxAdapter_context, "f"))), "f");
33
47
  __classPrivateFieldGet(this, _MIDIOutputDeviceBoxAdapter_terminator, "f").ownAll(box.parameters.pointerHub.catchupAndSubscribe({
34
- onAdded: (({ box }) => __classPrivateFieldGet(this, _MIDIOutputDeviceBoxAdapter_parametric, "f")
35
- .createParameter(asInstanceOf(box, MIDIOutputParameterBox).value, ValueMapping.unipolar(), StringMapping.percent({ fractionDigits: 1 }), "", 0.0)),
48
+ onAdded: (({ box }) => {
49
+ const parameterBox = asInstanceOf(box, MIDIOutputParameterBox);
50
+ __classPrivateFieldGet(this, _MIDIOutputDeviceBoxAdapter_parametric, "f").createParameter(parameterBox.value, ValueMapping.unipolar(), StringMapping.percent({ fractionDigits: 1 }), parameterName(parameterBox), 0.0);
51
+ }),
36
52
  onRemoved: (({ box }) => __classPrivateFieldGet(this, _MIDIOutputDeviceBoxAdapter_parametric, "f")
37
53
  .removeParameter(asInstanceOf(box, MIDIOutputParameterBox).value.address))
38
54
  }), __classPrivateFieldGet(this, _MIDIOutputDeviceBoxAdapter_box, "f").device.catchupAndSubscribe(({ targetVertex }) => targetVertex.match({
@@ -52,7 +52,7 @@ export class NanoDeviceBoxAdapter {
52
52
  }
53
53
  _NanoDeviceBoxAdapter_context = new WeakMap(), _NanoDeviceBoxAdapter_box = new WeakMap(), _NanoDeviceBoxAdapter_parametric = new WeakMap(), _NanoDeviceBoxAdapter_instances = new WeakSet(), _NanoDeviceBoxAdapter_wrapParameters = function _NanoDeviceBoxAdapter_wrapParameters(box) {
54
54
  return {
55
- volume: __classPrivateFieldGet(this, _NanoDeviceBoxAdapter_parametric, "f").createParameter(box.volume, ValueMapping.DefaultDecibel, StringMapping.numeric({ unit: "db", fractionDigits: 1 }), "volume"),
56
- release: __classPrivateFieldGet(this, _NanoDeviceBoxAdapter_parametric, "f").createParameter(box.release, ValueMapping.exponential(0.001, 8.0), StringMapping.numeric({ unit: "s", fractionDigits: 3 }), "release")
55
+ volume: __classPrivateFieldGet(this, _NanoDeviceBoxAdapter_parametric, "f").createParameter(box.volume, ValueMapping.DefaultDecibel, StringMapping.numeric({ unit: "db", fractionDigits: 1 }), "Volume"),
56
+ release: __classPrivateFieldGet(this, _NanoDeviceBoxAdapter_parametric, "f").createParameter(box.release, ValueMapping.exponential(0.001, 8.0), StringMapping.numeric({ unit: "s", fractionDigits: 3 }), "Release")
57
57
  };
58
58
  };
@@ -0,0 +1,21 @@
1
+ import { int, unitValue } from "@opendaw/lib-std";
2
+ import { PlayfieldChopSlice } from "../PlayfieldDeviceBoxAdapter";
3
+ export type ChopMode = "transients" | "grid";
4
+ export declare const GridDivisions: readonly [number, number, number, number];
5
+ export type GridDivision = (typeof GridDivisions)[number];
6
+ export declare namespace ChopMath {
7
+ const MAX_KEY = 128;
8
+ const fitBpmPow2: (durationInSeconds: number) => number;
9
+ const sliceSecondsForGrid: (bpm: number, division: GridDivision) => number;
10
+ }
11
+ export declare class ChopModel {
12
+ #private;
13
+ get boundaries(): ReadonlyArray<unitValue>;
14
+ fromTransients(transientSeconds: ReadonlyArray<number>, durationInSeconds: number, maxSlices: int): void;
15
+ fromGrid(bpm: number, division: GridDivision, durationInSeconds: number, maxSlices: int): void;
16
+ dragBoundary(index: int, position: unitValue): void;
17
+ splitAt(position: unitValue): void;
18
+ removeBoundary(index: int): void;
19
+ slices(startKey: int): ReadonlyArray<PlayfieldChopSlice>;
20
+ }
21
+ //# sourceMappingURL=ChopModel.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ChopModel.d.ts","sourceRoot":"","sources":["../../../../src/devices/instruments/Playfield/ChopModel.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,GAAG,EAAE,SAAS,EAAC,MAAM,kBAAkB,CAAA;AACtD,OAAO,EAAC,kBAAkB,EAAC,MAAM,8BAA8B,CAAA;AAE/D,MAAM,MAAM,QAAQ,GAAG,YAAY,GAAG,MAAM,CAAA;AAE5C,eAAO,MAAM,aAAa,2CAA0C,CAAA;AACpE,MAAM,MAAM,YAAY,GAAG,CAAC,OAAO,aAAa,CAAC,CAAC,MAAM,CAAC,CAAA;AAEzD,yBAAiB,QAAQ,CAAC;IACf,MAAM,OAAO,MAAM,CAAA;IAEnB,MAAM,UAAU,GAAI,mBAAmB,MAAM,KAAG,MAMtD,CAAA;IAEM,MAAM,mBAAmB,GAAI,KAAK,MAAM,EAAE,UAAU,YAAY,KAAG,MAAqC,CAAA;CAClH;AAED,qBAAa,SAAS;;IAGlB,IAAI,UAAU,IAAI,aAAa,CAAC,SAAS,CAAC,CAA0B;IAepE,cAAc,CAAC,gBAAgB,EAAE,aAAa,CAAC,MAAM,CAAC,EAAE,iBAAiB,EAAE,MAAM,EAAE,SAAS,EAAE,GAAG,GAAG,IAAI;IAKxG,QAAQ,CAAC,GAAG,EAAE,MAAM,EAAE,QAAQ,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,EAAE,SAAS,EAAE,GAAG,GAAG,IAAI;IAY9F,YAAY,CAAC,KAAK,EAAE,GAAG,EAAE,QAAQ,EAAE,SAAS,GAAG,IAAI;IAOnD,OAAO,CAAC,QAAQ,EAAE,SAAS,GAAG,IAAI;IASlC,cAAc,CAAC,KAAK,EAAE,GAAG,GAAG,IAAI;IAKhC,MAAM,CAAC,QAAQ,EAAE,GAAG,GAAG,aAAa,CAAC,kBAAkB,CAAC;CAQ3D"}
@@ -0,0 +1,109 @@
1
+ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
2
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
3
+ 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");
4
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
5
+ };
6
+ var _ChopModel_instances, _ChopModel_boundaries, _ChopModel_set, _ChopModel_setCapped;
7
+ import { clamp } from "@opendaw/lib-std";
8
+ export const GridDivisions = [1 / 4, 1 / 8, 1 / 16, 1 / 32];
9
+ export var ChopMath;
10
+ (function (ChopMath) {
11
+ ChopMath.MAX_KEY = 128;
12
+ ChopMath.fitBpmPow2 = (durationInSeconds) => {
13
+ if (durationInSeconds <= 0.0) {
14
+ return 120;
15
+ }
16
+ let bpm = 60 / durationInSeconds;
17
+ while (bpm < 90) {
18
+ bpm *= 2;
19
+ }
20
+ while (bpm > 180) {
21
+ bpm /= 2;
22
+ }
23
+ return bpm;
24
+ };
25
+ ChopMath.sliceSecondsForGrid = (bpm, division) => (60 / bpm) * (4 * division);
26
+ })(ChopMath || (ChopMath = {}));
27
+ export class ChopModel {
28
+ constructor() {
29
+ _ChopModel_instances.add(this);
30
+ _ChopModel_boundaries.set(this, [0.0, 1.0]);
31
+ }
32
+ get boundaries() { return __classPrivateFieldGet(this, _ChopModel_boundaries, "f"); }
33
+ fromTransients(transientSeconds, durationInSeconds, maxSlices) {
34
+ if (durationInSeconds <= 0.0) {
35
+ __classPrivateFieldGet(this, _ChopModel_instances, "m", _ChopModel_set).call(this, [0.0, 1.0]);
36
+ return;
37
+ }
38
+ __classPrivateFieldGet(this, _ChopModel_instances, "m", _ChopModel_setCapped).call(this, transientSeconds.map(seconds => seconds / durationInSeconds), maxSlices);
39
+ }
40
+ fromGrid(bpm, division, durationInSeconds, maxSlices) {
41
+ if (durationInSeconds <= 0.0 || bpm <= 0.0) {
42
+ __classPrivateFieldGet(this, _ChopModel_instances, "m", _ChopModel_set).call(this, [0.0, 1.0]);
43
+ return;
44
+ }
45
+ const sliceSeconds = ChopMath.sliceSecondsForGrid(bpm, division);
46
+ if (sliceSeconds <= 0.0) {
47
+ __classPrivateFieldGet(this, _ChopModel_instances, "m", _ChopModel_set).call(this, [0.0, 1.0]);
48
+ return;
49
+ }
50
+ const boundaries = [];
51
+ for (let seconds = 0.0; seconds < durationInSeconds; seconds += sliceSeconds) {
52
+ boundaries.push(seconds / durationInSeconds);
53
+ }
54
+ boundaries.push(1.0);
55
+ __classPrivateFieldGet(this, _ChopModel_instances, "m", _ChopModel_setCapped).call(this, boundaries, maxSlices);
56
+ }
57
+ dragBoundary(index, position) {
58
+ if (index <= 0 || index >= __classPrivateFieldGet(this, _ChopModel_boundaries, "f").length - 1) {
59
+ return;
60
+ }
61
+ const lower = __classPrivateFieldGet(this, _ChopModel_boundaries, "f")[index - 1];
62
+ const upper = __classPrivateFieldGet(this, _ChopModel_boundaries, "f")[index + 1];
63
+ __classPrivateFieldGet(this, _ChopModel_boundaries, "f")[index] = clamp(position, lower, upper);
64
+ }
65
+ splitAt(position) {
66
+ const value = clamp(position, 0.0, 1.0);
67
+ if (value <= 0.0 || value >= 1.0) {
68
+ return;
69
+ }
70
+ const insertIndex = __classPrivateFieldGet(this, _ChopModel_boundaries, "f").findIndex(boundary => boundary > value);
71
+ if (insertIndex <= 0) {
72
+ return;
73
+ }
74
+ if (__classPrivateFieldGet(this, _ChopModel_boundaries, "f")[insertIndex - 1] === value) {
75
+ return;
76
+ }
77
+ __classPrivateFieldGet(this, _ChopModel_boundaries, "f").splice(insertIndex, 0, value);
78
+ }
79
+ removeBoundary(index) {
80
+ if (index <= 0 || index >= __classPrivateFieldGet(this, _ChopModel_boundaries, "f").length - 1) {
81
+ return;
82
+ }
83
+ __classPrivateFieldGet(this, _ChopModel_boundaries, "f").splice(index, 1);
84
+ }
85
+ slices(startKey) {
86
+ const count = Math.min(__classPrivateFieldGet(this, _ChopModel_boundaries, "f").length - 1, ChopMath.MAX_KEY - startKey);
87
+ const slices = [];
88
+ for (let index = 0; index < count; index++) {
89
+ slices.push({ start: __classPrivateFieldGet(this, _ChopModel_boundaries, "f")[index], end: __classPrivateFieldGet(this, _ChopModel_boundaries, "f")[index + 1] });
90
+ }
91
+ return slices;
92
+ }
93
+ }
94
+ _ChopModel_boundaries = new WeakMap(), _ChopModel_instances = new WeakSet(), _ChopModel_set = function _ChopModel_set(normalized) {
95
+ const sorted = Array.from(new Set(normalized.map(value => clamp(value, 0.0, 1.0)))).sort((a, b) => a - b);
96
+ if (sorted.length === 0 || sorted[0] > 0.0) {
97
+ sorted.unshift(0.0);
98
+ }
99
+ if (sorted.length < 2) {
100
+ sorted.push(1.0);
101
+ }
102
+ __classPrivateFieldGet(this, _ChopModel_boundaries, "f").length = 0;
103
+ __classPrivateFieldGet(this, _ChopModel_boundaries, "f").push(...sorted);
104
+ }, _ChopModel_setCapped = function _ChopModel_setCapped(normalized, maxSlices) {
105
+ __classPrivateFieldGet(this, _ChopModel_instances, "m", _ChopModel_set).call(this, normalized);
106
+ if (maxSlices > 0 && __classPrivateFieldGet(this, _ChopModel_boundaries, "f").length - 1 > maxSlices) {
107
+ __classPrivateFieldGet(this, _ChopModel_boundaries, "f").length = maxSlices + 1;
108
+ }
109
+ };
@@ -1,7 +1,7 @@
1
- import { PlayfieldDeviceBox } from "@opendaw/studio-boxes";
1
+ import { AudioFileBox, PlayfieldDeviceBox } from "@opendaw/studio-boxes";
2
2
  import { Address, BooleanField, StringField } from "@opendaw/lib-box";
3
3
  import { Pointers } from "@opendaw/studio-enums";
4
- import { UUID } from "@opendaw/lib-std";
4
+ import { int, unitValue, UUID } from "@opendaw/lib-std";
5
5
  import { DeviceHost, InstrumentDeviceBoxAdapter } from "../../DeviceAdapter";
6
6
  import { BoxAdaptersContext } from "../../BoxAdaptersContext";
7
7
  import { IndexedBoxAdapterCollection } from "../../IndexedBoxAdapterCollection";
@@ -9,6 +9,15 @@ import { PlayfieldSampleBoxAdapter } from "./Playfield/PlayfieldSampleBoxAdapter
9
9
  import { TrackType } from "../../timeline/TrackType";
10
10
  import { AudioUnitBoxAdapter } from "../../audio-unit/AudioUnitBoxAdapter";
11
11
  import { LabeledAudioOutput, LabeledAudioOutputsOwner } from "../../LabeledAudioOutputsOwner";
12
+ export type PlayfieldChopSlice = {
13
+ start: unitValue;
14
+ end: unitValue;
15
+ };
16
+ export type PlayfieldChopOptions = {
17
+ file: AudioFileBox;
18
+ startKey: int;
19
+ slices: ReadonlyArray<PlayfieldChopSlice>;
20
+ };
12
21
  export declare class PlayfieldDeviceBoxAdapter implements InstrumentDeviceBoxAdapter, LabeledAudioOutputsOwner {
13
22
  #private;
14
23
  readonly type = "instrument";
@@ -16,6 +25,7 @@ export declare class PlayfieldDeviceBoxAdapter implements InstrumentDeviceBoxAda
16
25
  readonly manualUrl = "manuals/devices/instruments/playfield";
17
26
  constructor(context: BoxAdaptersContext, box: PlayfieldDeviceBox);
18
27
  reset(): void;
28
+ chop({ file, startKey, slices }: PlayfieldChopOptions): void;
19
29
  get box(): PlayfieldDeviceBox;
20
30
  get uuid(): UUID.Bytes;
21
31
  get address(): Address;
@@ -1 +1 @@
1
- {"version":3,"file":"PlayfieldDeviceBoxAdapter.d.ts","sourceRoot":"","sources":["../../../src/devices/instruments/PlayfieldDeviceBoxAdapter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,kBAAkB,EAAC,MAAM,uBAAuB,CAAA;AACxD,OAAO,EAAC,OAAO,EAAE,YAAY,EAAE,WAAW,EAAC,MAAM,kBAAkB,CAAA;AACnE,OAAO,EAAC,QAAQ,EAAC,MAAM,uBAAuB,CAAA;AAC9C,OAAO,EAAS,IAAI,EAAC,MAAM,kBAAkB,CAAA;AAC7C,OAAO,EAAC,UAAU,EAAW,0BAA0B,EAAC,MAAM,qBAAqB,CAAA;AACnF,OAAO,EAAC,kBAAkB,EAAC,MAAM,0BAA0B,CAAA;AAE3D,OAAO,EAAC,2BAA2B,EAAC,MAAM,mCAAmC,CAAA;AAC7E,OAAO,EAAC,yBAAyB,EAAC,MAAM,uCAAuC,CAAA;AAE/E,OAAO,EAAC,SAAS,EAAC,MAAM,0BAA0B,CAAA;AAClD,OAAO,EAAC,mBAAmB,EAAC,MAAM,sCAAsC,CAAA;AACxE,OAAO,EAAC,kBAAkB,EAAE,wBAAwB,EAAC,MAAM,gCAAgC,CAAA;AAE3F,qBAAa,yBAA0B,YAAW,0BAA0B,EAAE,wBAAwB;;IAClG,QAAQ,CAAC,IAAI,gBAAe;IAC5B,QAAQ,CAAC,OAAO,UAAS;IACzB,QAAQ,CAAC,SAAS,2CAA6B;gBAQnC,OAAO,EAAE,kBAAkB,EAAE,GAAG,EAAE,kBAAkB;IAShE,KAAK,IAAI,IAAI;IAEb,IAAI,GAAG,IAAI,kBAAkB,CAAmB;IAChD,IAAI,IAAI,IAA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;IAExC,mBAAmB,IAAI,QAAQ,CAAC,kBAAkB,CAAC;IAerD,SAAS,IAAI,IAAI;CAGpB"}
@@ -10,8 +10,9 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
10
10
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
11
11
  };
12
12
  var _PlayfieldDeviceBoxAdapter_context, _PlayfieldDeviceBoxAdapter_box, _PlayfieldDeviceBoxAdapter_samples, _PlayfieldDeviceBoxAdapter_parametric;
13
+ import { PlayfieldSampleBox } from "@opendaw/studio-boxes";
13
14
  import { Pointers } from "@opendaw/studio-enums";
14
- import { Option } from "@opendaw/lib-std";
15
+ import { Option, UUID } from "@opendaw/lib-std";
15
16
  import { Devices } from "../../DeviceAdapter";
16
17
  import { DeviceManualUrls } from "../../DeviceManualUrls";
17
18
  import { IndexedBoxAdapterCollection } from "../../IndexedBoxAdapterCollection";
@@ -33,6 +34,25 @@ export class PlayfieldDeviceBoxAdapter {
33
34
  __classPrivateFieldSet(this, _PlayfieldDeviceBoxAdapter_parametric, new ParameterAdapterSet(__classPrivateFieldGet(this, _PlayfieldDeviceBoxAdapter_context, "f")), "f");
34
35
  }
35
36
  reset() { __classPrivateFieldGet(this, _PlayfieldDeviceBoxAdapter_samples, "f").adapters().forEach(adapter => adapter.box.delete()); }
37
+ chop({ file, startKey, slices }) {
38
+ const endKey = startKey + slices.length - 1;
39
+ __classPrivateFieldGet(this, _PlayfieldDeviceBoxAdapter_samples, "f").adapters()
40
+ .filter(adapter => {
41
+ const index = adapter.box.index.getValue();
42
+ return index >= startKey && index <= endKey;
43
+ })
44
+ .forEach(adapter => adapter.box.delete());
45
+ slices.forEach(({ start, end }, sliceIndex) => {
46
+ PlayfieldSampleBox.create(__classPrivateFieldGet(this, _PlayfieldDeviceBoxAdapter_context, "f").boxGraph, UUID.generate(), box => {
47
+ box.file.refer(file);
48
+ box.device.refer(__classPrivateFieldGet(this, _PlayfieldDeviceBoxAdapter_box, "f").samples);
49
+ box.index.setValue(startKey + sliceIndex);
50
+ box.sampleStart.setValue(start);
51
+ box.sampleEnd.setValue(end);
52
+ box.exclude.setValue(true);
53
+ });
54
+ });
55
+ }
36
56
  get box() { return __classPrivateFieldGet(this, _PlayfieldDeviceBoxAdapter_box, "f"); }
37
57
  get uuid() { return __classPrivateFieldGet(this, _PlayfieldDeviceBoxAdapter_box, "f").address.uuid; }
38
58
  get address() { return __classPrivateFieldGet(this, _PlayfieldDeviceBoxAdapter_box, "f").address; }
@@ -52,9 +52,9 @@ export class TapeDeviceBoxAdapter {
52
52
  }
53
53
  _TapeDeviceBoxAdapter_context = new WeakMap(), _TapeDeviceBoxAdapter_box = new WeakMap(), _TapeDeviceBoxAdapter_parametric = new WeakMap(), _TapeDeviceBoxAdapter_instances = new WeakSet(), _TapeDeviceBoxAdapter_wrapParameters = function _TapeDeviceBoxAdapter_wrapParameters(box) {
54
54
  return {
55
- flutter: __classPrivateFieldGet(this, _TapeDeviceBoxAdapter_parametric, "f").createParameter(box.flutter, ValueMapping.unipolar(), StringMapping.percent(), "flutter"),
56
- wow: __classPrivateFieldGet(this, _TapeDeviceBoxAdapter_parametric, "f").createParameter(box.wow, ValueMapping.unipolar(), StringMapping.percent(), "wow"),
57
- noise: __classPrivateFieldGet(this, _TapeDeviceBoxAdapter_parametric, "f").createParameter(box.noise, ValueMapping.unipolar(), StringMapping.percent(), "noise"),
58
- saturation: __classPrivateFieldGet(this, _TapeDeviceBoxAdapter_parametric, "f").createParameter(box.saturation, ValueMapping.unipolar(), StringMapping.percent(), "saturation")
55
+ flutter: __classPrivateFieldGet(this, _TapeDeviceBoxAdapter_parametric, "f").createParameter(box.flutter, ValueMapping.unipolar(), StringMapping.percent(), "Flutter"),
56
+ wow: __classPrivateFieldGet(this, _TapeDeviceBoxAdapter_parametric, "f").createParameter(box.wow, ValueMapping.unipolar(), StringMapping.percent(), "Wow"),
57
+ noise: __classPrivateFieldGet(this, _TapeDeviceBoxAdapter_parametric, "f").createParameter(box.noise, ValueMapping.unipolar(), StringMapping.percent(), "Noise"),
58
+ saturation: __classPrivateFieldGet(this, _TapeDeviceBoxAdapter_parametric, "f").createParameter(box.saturation, ValueMapping.unipolar(), StringMapping.percent(), "Saturation")
59
59
  };
60
60
  };
@@ -46,7 +46,7 @@ export class ArpeggioDeviceBoxAdapter {
46
46
  }
47
47
  _a = ArpeggioDeviceBoxAdapter, _ArpeggioDeviceBoxAdapter_context = new WeakMap(), _ArpeggioDeviceBoxAdapter_box = new WeakMap(), _ArpeggioDeviceBoxAdapter_parametric = new WeakMap(), _ArpeggioDeviceBoxAdapter_instances = new WeakSet(), _ArpeggioDeviceBoxAdapter_wrapParameters = function _ArpeggioDeviceBoxAdapter_wrapParameters(box) {
48
48
  return {
49
- modeIndex: __classPrivateFieldGet(this, _ArpeggioDeviceBoxAdapter_parametric, "f").createParameter(box.modeIndex, ValueMapping.linearInteger(0, 2), StringMapping.indices("", ["Up", "Down", "UpDown"]), "mode"),
49
+ modeIndex: __classPrivateFieldGet(this, _ArpeggioDeviceBoxAdapter_parametric, "f").createParameter(box.modeIndex, ValueMapping.linearInteger(0, 2), StringMapping.indices("", ["Up", "Down", "UpDown"]), "Mode"),
50
50
  numOctaves: __classPrivateFieldGet(this, _ArpeggioDeviceBoxAdapter_parametric, "f").createParameter(box.numOctaves, ValueMapping.linearInteger(1, 5), StringMapping.numeric({ unit: "", fractionDigits: 0 }), "Octaves"),
51
51
  rate: __classPrivateFieldGet(this, _ArpeggioDeviceBoxAdapter_parametric, "f").createParameter(box.rateIndex, ValueMapping.linearInteger(0, _a.RateFractions.length - 1), _a.RateStringMapping, "Rate"),
52
52
  gate: __classPrivateFieldGet(this, _ArpeggioDeviceBoxAdapter_parametric, "f").createParameter(box.gate, ValueMapping.linear(0.0, 2.0), StringMapping.percent({ fractionDigits: 0 }), "Gate"),
@@ -45,8 +45,8 @@ export class PitchDeviceBoxAdapter {
45
45
  }
46
46
  _PitchDeviceBoxAdapter_context = new WeakMap(), _PitchDeviceBoxAdapter_box = new WeakMap(), _PitchDeviceBoxAdapter_parametric = new WeakMap(), _PitchDeviceBoxAdapter_instances = new WeakSet(), _PitchDeviceBoxAdapter_wrapParameters = function _PitchDeviceBoxAdapter_wrapParameters(box) {
47
47
  return {
48
- octaves: __classPrivateFieldGet(this, _PitchDeviceBoxAdapter_parametric, "f").createParameter(box.octaves, ValueMapping.linearInteger(-7, 7), StringMapping.numeric({ unit: "oct", fractionDigits: 0 }), "octaves"),
49
- semiTones: __classPrivateFieldGet(this, _PitchDeviceBoxAdapter_parametric, "f").createParameter(box.semiTones, ValueMapping.linearInteger(-36, 36), StringMapping.numeric({ unit: "st", fractionDigits: 0 }), "semi-tones"),
50
- cent: __classPrivateFieldGet(this, _PitchDeviceBoxAdapter_parametric, "f").createParameter(box.cents, ValueMapping.linear(-50.0, 50.0), StringMapping.numeric({ unit: "cents", fractionDigits: 1 }), "cents")
48
+ octaves: __classPrivateFieldGet(this, _PitchDeviceBoxAdapter_parametric, "f").createParameter(box.octaves, ValueMapping.linearInteger(-7, 7), StringMapping.numeric({ unit: "oct", fractionDigits: 0 }), "Octaves"),
49
+ semiTones: __classPrivateFieldGet(this, _PitchDeviceBoxAdapter_parametric, "f").createParameter(box.semiTones, ValueMapping.linearInteger(-36, 36), StringMapping.numeric({ unit: "st", fractionDigits: 0 }), "Semi-Tones"),
50
+ cent: __classPrivateFieldGet(this, _PitchDeviceBoxAdapter_parametric, "f").createParameter(box.cents, ValueMapping.linear(-50.0, 50.0), StringMapping.numeric({ unit: "cents", fractionDigits: 1 }), "Cents")
51
51
  };
52
52
  };
@@ -1,3 +1,3 @@
1
- import { ApparatDeviceBox, NeonDeviceBox, MIDIOutputDeviceBox, NanoDeviceBox, PlayfieldDeviceBox, SoundfontDeviceBox, TapeDeviceBox, VaporisateurDeviceBox } from "@opendaw/studio-boxes";
2
- export type InstrumentBox = ApparatDeviceBox | TapeDeviceBox | VaporisateurDeviceBox | NeonDeviceBox | NanoDeviceBox | PlayfieldDeviceBox | SoundfontDeviceBox | MIDIOutputDeviceBox;
1
+ import { ApparatDeviceBox, CubedDeviceBox, NeonDeviceBox, MIDIOutputDeviceBox, NanoDeviceBox, PlayfieldDeviceBox, SoundfontDeviceBox, TapeDeviceBox, VaporisateurDeviceBox } from "@opendaw/studio-boxes";
2
+ export type InstrumentBox = ApparatDeviceBox | CubedDeviceBox | TapeDeviceBox | VaporisateurDeviceBox | NeonDeviceBox | NanoDeviceBox | PlayfieldDeviceBox | SoundfontDeviceBox | MIDIOutputDeviceBox;
3
3
  //# sourceMappingURL=InstrumentBox.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"InstrumentBox.d.ts","sourceRoot":"","sources":["../../src/factories/InstrumentBox.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,gBAAgB,EAChB,aAAa,EACb,mBAAmB,EACnB,aAAa,EACb,kBAAkB,EAClB,kBAAkB,EAClB,aAAa,EACb,qBAAqB,EACxB,MAAM,uBAAuB,CAAA;AAE9B,MAAM,MAAM,aAAa,GACnB,gBAAgB,GAChB,aAAa,GACb,qBAAqB,GACrB,aAAa,GACb,aAAa,GACb,kBAAkB,GAClB,kBAAkB,GAClB,mBAAmB,CAAA"}
1
+ {"version":3,"file":"InstrumentBox.d.ts","sourceRoot":"","sources":["../../src/factories/InstrumentBox.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,gBAAgB,EAChB,cAAc,EACd,aAAa,EACb,mBAAmB,EACnB,aAAa,EACb,kBAAkB,EAClB,kBAAkB,EAClB,aAAa,EACb,qBAAqB,EACxB,MAAM,uBAAuB,CAAA;AAE9B,MAAM,MAAM,aAAa,GACnB,gBAAgB,GAChB,cAAc,GACd,aAAa,GACb,qBAAqB,GACrB,aAAa,GACb,aAAa,GACb,kBAAkB,GAClB,kBAAkB,GAClB,mBAAmB,CAAA"}
@@ -1,4 +1,4 @@
1
- import { ApparatDeviceBox, AudioFileBox, NeonDeviceBox, MIDIOutputDeviceBox, NanoDeviceBox, PlayfieldDeviceBox, SoundfontDeviceBox, TapeDeviceBox, VaporisateurDeviceBox } from "@opendaw/studio-boxes";
1
+ import { ApparatDeviceBox, AudioFileBox, CubedDeviceBox, NeonDeviceBox, MIDIOutputDeviceBox, NanoDeviceBox, PlayfieldDeviceBox, SoundfontDeviceBox, SoundfontFileBox, TapeDeviceBox, VaporisateurDeviceBox } from "@opendaw/studio-boxes";
2
2
  import { byte, UUID } from "@opendaw/lib-std";
3
3
  import { InstrumentFactory } from "./InstrumentFactory";
4
4
  export declare namespace InstrumentFactories {
@@ -13,23 +13,19 @@ export declare namespace InstrumentFactories {
13
13
  }>;
14
14
  const Playfield: InstrumentFactory<PlayfieldAttachment, PlayfieldDeviceBox>;
15
15
  const Neon: InstrumentFactory<void, NeonDeviceBox>;
16
+ const Cubed: InstrumentFactory<void, CubedDeviceBox>;
16
17
  const Vaporisateur: InstrumentFactory<void, VaporisateurDeviceBox>;
17
18
  const MIDIOutput: InstrumentFactory<void, MIDIOutputDeviceBox>;
18
- const Soundfont: InstrumentFactory<{
19
- uuid: UUID.String;
20
- name: string;
21
- }, SoundfontDeviceBox>;
19
+ const Soundfont: InstrumentFactory<SoundfontFileBox, SoundfontDeviceBox>;
22
20
  const Apparat: InstrumentFactory<void, ApparatDeviceBox>;
23
21
  const Named: {
24
22
  Apparat: InstrumentFactory<void, ApparatDeviceBox>;
23
+ Cubed: InstrumentFactory<void, CubedDeviceBox>;
25
24
  Neon: InstrumentFactory<void, NeonDeviceBox>;
26
25
  MIDIOutput: InstrumentFactory<void, MIDIOutputDeviceBox>;
27
26
  Nano: InstrumentFactory<AudioFileBox, NanoDeviceBox>;
28
27
  Playfield: InstrumentFactory<PlayfieldAttachment, PlayfieldDeviceBox>;
29
- Soundfont: InstrumentFactory<{
30
- uuid: UUID.String;
31
- name: string;
32
- }, SoundfontDeviceBox>;
28
+ Soundfont: InstrumentFactory<SoundfontFileBox, SoundfontDeviceBox>;
33
29
  Tape: InstrumentFactory<void, TapeDeviceBox>;
34
30
  Vaporisateur: InstrumentFactory<void, VaporisateurDeviceBox>;
35
31
  };