@opendaw/studio-core 0.0.10 → 0.0.12

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 (46) hide show
  1. package/dist/EffectFactories.d.ts +38 -0
  2. package/dist/EffectFactories.d.ts.map +1 -0
  3. package/dist/EffectFactories.js +163 -0
  4. package/dist/EffectFactory.d.ts +13 -0
  5. package/dist/EffectFactory.d.ts.map +1 -0
  6. package/dist/EffectFactory.js +1 -0
  7. package/dist/InstrumentBox.d.ts +3 -0
  8. package/dist/InstrumentBox.d.ts.map +1 -0
  9. package/dist/InstrumentBox.js +1 -0
  10. package/dist/InstrumentFactories.d.ts +15 -0
  11. package/dist/InstrumentFactories.d.ts.map +1 -0
  12. package/dist/{Instruments.js → InstrumentFactories.js} +31 -69
  13. package/dist/InstrumentFactory.d.ts +11 -0
  14. package/dist/InstrumentFactory.d.ts.map +1 -0
  15. package/dist/InstrumentFactory.js +1 -0
  16. package/dist/InstrumentOptions.d.ts +8 -0
  17. package/dist/InstrumentOptions.d.ts.map +1 -0
  18. package/dist/InstrumentOptions.js +1 -0
  19. package/dist/InstrumentProduct.d.ts +8 -0
  20. package/dist/InstrumentProduct.d.ts.map +1 -0
  21. package/dist/InstrumentProduct.js +1 -0
  22. package/dist/Project.d.ts +3 -1
  23. package/dist/Project.d.ts.map +1 -1
  24. package/dist/Project.js +7 -59
  25. package/dist/ProjectApi.d.ts +44 -0
  26. package/dist/ProjectApi.d.ts.map +1 -0
  27. package/dist/ProjectApi.js +217 -0
  28. package/dist/ProjectMigration.d.ts +5 -0
  29. package/dist/ProjectMigration.d.ts.map +1 -0
  30. package/dist/ProjectMigration.js +60 -0
  31. package/dist/index.d.ts +8 -3
  32. package/dist/index.d.ts.map +1 -1
  33. package/dist/index.js +8 -3
  34. package/dist/processors.js +2 -2
  35. package/dist/processors.js.map +3 -3
  36. package/dist/workers.js +2 -2
  37. package/dist/workers.js.map +4 -4
  38. package/package.json +16 -16
  39. package/dist/Effects.d.ts +0 -154
  40. package/dist/Effects.d.ts.map +0 -1
  41. package/dist/Effects.js +0 -166
  42. package/dist/Instruments.d.ts +0 -35
  43. package/dist/Instruments.d.ts.map +0 -1
  44. package/dist/Modifier.d.ts +0 -21
  45. package/dist/Modifier.d.ts.map +0 -1
  46. package/dist/Modifier.js +0 -168
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opendaw/studio-core",
3
- "version": "0.0.10",
3
+ "version": "0.0.12",
4
4
  "license": "LGPL-3.0-or-later",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -26,22 +26,22 @@
26
26
  "test": "echo \"No tests to run\""
27
27
  },
28
28
  "dependencies": {
29
- "@opendaw/lib-box": "^0.0.10",
30
- "@opendaw/lib-dom": "^0.0.10",
31
- "@opendaw/lib-dsp": "^0.0.10",
32
- "@opendaw/lib-fusion": "^0.0.10",
33
- "@opendaw/lib-runtime": "^0.0.10",
34
- "@opendaw/lib-std": "^0.0.10",
35
- "@opendaw/studio-adapters": "^0.0.10",
36
- "@opendaw/studio-boxes": "^0.0.10",
37
- "@opendaw/studio-enums": "^0.0.10"
29
+ "@opendaw/lib-box": "^0.0.12",
30
+ "@opendaw/lib-dom": "^0.0.12",
31
+ "@opendaw/lib-dsp": "^0.0.12",
32
+ "@opendaw/lib-fusion": "^0.0.12",
33
+ "@opendaw/lib-runtime": "^0.0.12",
34
+ "@opendaw/lib-std": "^0.0.12",
35
+ "@opendaw/studio-adapters": "^0.0.12",
36
+ "@opendaw/studio-boxes": "^0.0.12",
37
+ "@opendaw/studio-enums": "^0.0.12"
38
38
  },
39
39
  "devDependencies": {
40
- "@opendaw/eslint-config": "^0.0.10",
41
- "@opendaw/studio-core-processors": "^0.0.10",
42
- "@opendaw/studio-core-workers": "^0.0.4",
43
- "@opendaw/studio-forge-boxes": "^0.0.10",
44
- "@opendaw/typescript-config": "^0.0.10"
40
+ "@opendaw/eslint-config": "^0.0.12",
41
+ "@opendaw/studio-core-processors": "^0.0.12",
42
+ "@opendaw/studio-core-workers": "^0.0.6",
43
+ "@opendaw/studio-forge-boxes": "^0.0.12",
44
+ "@opendaw/typescript-config": "^0.0.12"
45
45
  },
46
- "gitHead": "2c7dbb9cda7b9fdafc91008eac3272affcc78c08"
46
+ "gitHead": "a24f67e337c10d2f5a186d48f2b2769b64c87607"
47
47
  }
package/dist/Effects.d.ts DELETED
@@ -1,154 +0,0 @@
1
- import { int } from "@opendaw/lib-std";
2
- import { Box, Field } from "@opendaw/lib-box";
3
- import { ArpeggioDeviceBox, DelayDeviceBox, ModularDeviceBox, PitchDeviceBox, RevampDeviceBox, ReverbDeviceBox, StereoToolDeviceBox, ZeitgeistDeviceBox } from "@opendaw/studio-boxes";
4
- import { EffectPointerType, IconSymbol } from "@opendaw/studio-adapters";
5
- import { Project } from "./Project";
6
- export declare namespace Effects {
7
- interface Entry {
8
- get name(): string;
9
- get description(): string;
10
- get icon(): IconSymbol;
11
- get separatorBefore(): boolean;
12
- get type(): "audio" | "midi";
13
- create(project: Project, unit: Field<EffectPointerType>, index: int): Box;
14
- }
15
- const MidiNamed: {
16
- arpeggio: {
17
- name: string;
18
- description: string;
19
- icon: IconSymbol.Stack;
20
- separatorBefore: false;
21
- type: "midi";
22
- create: ({ boxGraph }: Project, unit: Field<EffectPointerType, import("@opendaw/lib-box").Fields>, index: number) => ArpeggioDeviceBox;
23
- };
24
- pitch: {
25
- name: string;
26
- description: string;
27
- icon: IconSymbol.Note;
28
- separatorBefore: false;
29
- type: "midi";
30
- create: ({ boxGraph }: Project, unit: Field<EffectPointerType, import("@opendaw/lib-box").Fields>, index: number) => PitchDeviceBox;
31
- };
32
- Zeitgeist: {
33
- name: string;
34
- description: string;
35
- icon: IconSymbol.Zeitgeist;
36
- separatorBefore: false;
37
- type: "midi";
38
- create: ({ boxGraph, rootBoxAdapter }: Project, unit: Field<EffectPointerType, import("@opendaw/lib-box").Fields>, index: number) => ZeitgeistDeviceBox;
39
- };
40
- };
41
- const AudioNamed: {
42
- StereoTool: {
43
- name: string;
44
- description: string;
45
- icon: IconSymbol.Stereo;
46
- separatorBefore: false;
47
- type: "audio";
48
- create: ({ boxGraph }: Project, unit: Field<EffectPointerType, import("@opendaw/lib-box").Fields>, index: number) => StereoToolDeviceBox;
49
- };
50
- Delay: {
51
- name: string;
52
- description: string;
53
- icon: IconSymbol.Time;
54
- separatorBefore: false;
55
- type: "audio";
56
- create: ({ boxGraph }: Project, unit: Field<EffectPointerType, import("@opendaw/lib-box").Fields>, index: number) => DelayDeviceBox;
57
- };
58
- Reverb: {
59
- name: string;
60
- description: string;
61
- icon: IconSymbol.Cube;
62
- separatorBefore: false;
63
- type: "audio";
64
- create: ({ boxGraph }: Project, unit: Field<EffectPointerType, import("@opendaw/lib-box").Fields>, index: number) => ReverbDeviceBox;
65
- };
66
- Revamp: {
67
- name: string;
68
- description: string;
69
- icon: IconSymbol.EQ;
70
- separatorBefore: false;
71
- type: "audio";
72
- create: ({ boxGraph }: Project, unit: Field<EffectPointerType, import("@opendaw/lib-box").Fields>, index: number) => RevampDeviceBox;
73
- };
74
- Modular: {
75
- name: string;
76
- description: string;
77
- icon: IconSymbol.Box;
78
- separatorBefore: true;
79
- type: "audio";
80
- create: (project: Project, unit: Field<EffectPointerType, import("@opendaw/lib-box").Fields>, index: number) => ModularDeviceBox;
81
- };
82
- };
83
- const MidiList: ReadonlyArray<Readonly<Entry>>;
84
- const AudioList: ReadonlyArray<Readonly<Entry>>;
85
- const MergedNamed: {
86
- StereoTool: {
87
- name: string;
88
- description: string;
89
- icon: IconSymbol.Stereo;
90
- separatorBefore: false;
91
- type: "audio";
92
- create: ({ boxGraph }: Project, unit: Field<EffectPointerType, import("@opendaw/lib-box").Fields>, index: number) => StereoToolDeviceBox;
93
- };
94
- Delay: {
95
- name: string;
96
- description: string;
97
- icon: IconSymbol.Time;
98
- separatorBefore: false;
99
- type: "audio";
100
- create: ({ boxGraph }: Project, unit: Field<EffectPointerType, import("@opendaw/lib-box").Fields>, index: number) => DelayDeviceBox;
101
- };
102
- Reverb: {
103
- name: string;
104
- description: string;
105
- icon: IconSymbol.Cube;
106
- separatorBefore: false;
107
- type: "audio";
108
- create: ({ boxGraph }: Project, unit: Field<EffectPointerType, import("@opendaw/lib-box").Fields>, index: number) => ReverbDeviceBox;
109
- };
110
- Revamp: {
111
- name: string;
112
- description: string;
113
- icon: IconSymbol.EQ;
114
- separatorBefore: false;
115
- type: "audio";
116
- create: ({ boxGraph }: Project, unit: Field<EffectPointerType, import("@opendaw/lib-box").Fields>, index: number) => RevampDeviceBox;
117
- };
118
- Modular: {
119
- name: string;
120
- description: string;
121
- icon: IconSymbol.Box;
122
- separatorBefore: true;
123
- type: "audio";
124
- create: (project: Project, unit: Field<EffectPointerType, import("@opendaw/lib-box").Fields>, index: number) => ModularDeviceBox;
125
- };
126
- arpeggio: {
127
- name: string;
128
- description: string;
129
- icon: IconSymbol.Stack;
130
- separatorBefore: false;
131
- type: "midi";
132
- create: ({ boxGraph }: Project, unit: Field<EffectPointerType, import("@opendaw/lib-box").Fields>, index: number) => ArpeggioDeviceBox;
133
- };
134
- pitch: {
135
- name: string;
136
- description: string;
137
- icon: IconSymbol.Note;
138
- separatorBefore: false;
139
- type: "midi";
140
- create: ({ boxGraph }: Project, unit: Field<EffectPointerType, import("@opendaw/lib-box").Fields>, index: number) => PitchDeviceBox;
141
- };
142
- Zeitgeist: {
143
- name: string;
144
- description: string;
145
- icon: IconSymbol.Zeitgeist;
146
- separatorBefore: false;
147
- type: "midi";
148
- create: ({ boxGraph, rootBoxAdapter }: Project, unit: Field<EffectPointerType, import("@opendaw/lib-box").Fields>, index: number) => ZeitgeistDeviceBox;
149
- };
150
- };
151
- type MidiEffectKeys = keyof typeof MidiNamed;
152
- type AudioEffectKeys = keyof typeof AudioNamed;
153
- }
154
- //# sourceMappingURL=Effects.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Effects.d.ts","sourceRoot":"","sources":["../src/Effects.ts"],"names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M,OAAO,UAAU,CAAA;CACxD"}
package/dist/Effects.js DELETED
@@ -1,166 +0,0 @@
1
- import { INVERSE_SQRT_2, UUID } from "@opendaw/lib-std";
2
- import { ArpeggioDeviceBox, DelayDeviceBox, GrooveShuffleBox, ModularAudioInputBox, ModularAudioOutputBox, ModularBox, ModularDeviceBox, ModuleConnectionBox, PitchDeviceBox, RevampDeviceBox, ReverbDeviceBox, StereoToolDeviceBox, ZeitgeistDeviceBox } from "@opendaw/studio-boxes";
3
- import { IconSymbol } from "@opendaw/studio-adapters";
4
- export var Effects;
5
- (function (Effects) {
6
- Effects.MidiNamed = {
7
- arpeggio: {
8
- name: "Arpeggio",
9
- description: "Generates rhythmic note sequences from chords",
10
- icon: IconSymbol.Stack,
11
- separatorBefore: false,
12
- type: "midi",
13
- create: ({ boxGraph }, unit, index) => ArpeggioDeviceBox.create(boxGraph, UUID.generate(), box => {
14
- box.label.setValue("Arpeggio");
15
- box.index.setValue(index);
16
- box.host.refer(unit);
17
- })
18
- },
19
- pitch: {
20
- name: "Pitch",
21
- description: "Shifts the pitch of incoming notes",
22
- icon: IconSymbol.Note,
23
- separatorBefore: false,
24
- type: "midi",
25
- create: ({ boxGraph }, unit, index) => PitchDeviceBox.create(boxGraph, UUID.generate(), box => {
26
- box.label.setValue("Pitch");
27
- box.index.setValue(index);
28
- box.host.refer(unit);
29
- })
30
- },
31
- Zeitgeist: {
32
- name: "Zeitgeist",
33
- description: "Distorts space and time",
34
- icon: IconSymbol.Zeitgeist,
35
- separatorBefore: false,
36
- type: "midi",
37
- create: ({ boxGraph, rootBoxAdapter }, unit, index) => {
38
- const useGlobal = false; // TODO First Zeitgeist should be true
39
- const shuffleBox = useGlobal
40
- ? rootBoxAdapter.groove.box
41
- : GrooveShuffleBox.create(boxGraph, UUID.generate(), box => {
42
- box.label.setValue("Shuffle");
43
- box.duration.setValue(480);
44
- });
45
- return ZeitgeistDeviceBox.create(boxGraph, UUID.generate(), box => {
46
- box.label.setValue("Zeitgeist");
47
- box.groove.refer(shuffleBox);
48
- box.index.setValue(index);
49
- box.host.refer(unit);
50
- });
51
- }
52
- }
53
- };
54
- Effects.AudioNamed = {
55
- StereoTool: {
56
- name: "Stereo Tool",
57
- description: "Computes a stereo transformation matrix with volume, panning, phase inversion and stereo width.",
58
- icon: IconSymbol.Stereo,
59
- separatorBefore: false,
60
- type: "audio",
61
- create: ({ boxGraph }, unit, index) => StereoToolDeviceBox.create(boxGraph, UUID.generate(), box => {
62
- box.label.setValue("Stereo Tool");
63
- box.index.setValue(index);
64
- box.host.refer(unit);
65
- })
66
- },
67
- Delay: {
68
- name: "Delay",
69
- description: "Echoes the input signal with time-based repeats",
70
- icon: IconSymbol.Time,
71
- separatorBefore: false,
72
- type: "audio",
73
- create: ({ boxGraph }, unit, index) => DelayDeviceBox.create(boxGraph, UUID.generate(), box => {
74
- box.label.setValue("Delay");
75
- box.index.setValue(index);
76
- box.host.refer(unit);
77
- })
78
- },
79
- Reverb: {
80
- name: "Reverb",
81
- description: "Simulates space and depth with reflections",
82
- icon: IconSymbol.Cube,
83
- separatorBefore: false,
84
- type: "audio",
85
- create: ({ boxGraph }, unit, index) => ReverbDeviceBox.create(boxGraph, UUID.generate(), box => {
86
- box.label.setValue("Reverb");
87
- box.preDelay.setInitValue(0.001);
88
- box.index.setValue(index);
89
- box.host.refer(unit);
90
- })
91
- },
92
- Revamp: {
93
- name: "Revamp",
94
- description: "Shapes the frequency balance of the sound",
95
- icon: IconSymbol.EQ,
96
- separatorBefore: false,
97
- type: "audio",
98
- create: ({ boxGraph }, unit, index) => RevampDeviceBox.create(boxGraph, UUID.generate(), box => {
99
- box.label.setValue("Revamp");
100
- box.highPass.frequency.setInitValue(40.0);
101
- box.highPass.order.setInitValue(2);
102
- box.highPass.q.setInitValue(INVERSE_SQRT_2);
103
- box.highPass.enabled.setInitValue(true);
104
- box.lowShelf.frequency.setInitValue(80.0);
105
- box.lowShelf.gain.setInitValue(6);
106
- box.lowBell.frequency.setInitValue(120.0);
107
- box.lowBell.gain.setInitValue(6);
108
- box.lowBell.q.setInitValue(INVERSE_SQRT_2);
109
- box.midBell.frequency.setInitValue(640.0);
110
- box.midBell.q.setInitValue(INVERSE_SQRT_2);
111
- box.midBell.gain.setInitValue(6);
112
- box.highBell.frequency.setInitValue(3600.0);
113
- box.highBell.q.setInitValue(INVERSE_SQRT_2);
114
- box.highBell.gain.setInitValue(6);
115
- box.highShelf.frequency.setInitValue(10000.0);
116
- box.highShelf.gain.setInitValue(6);
117
- box.lowPass.frequency.setInitValue(15000.0);
118
- box.lowPass.order.setInitValue(2);
119
- box.lowPass.q.setInitValue(INVERSE_SQRT_2);
120
- box.index.setValue(index);
121
- box.host.refer(unit);
122
- })
123
- },
124
- Modular: {
125
- name: "🔇 Create New Modular Audio Effect (inaudible yet)",
126
- description: "",
127
- icon: IconSymbol.Box,
128
- separatorBefore: true,
129
- type: "audio",
130
- create: (project, unit, index) => {
131
- const graph = project.boxGraph;
132
- const moduleSetupBox = ModularBox.create(graph, UUID.generate(), box => {
133
- box.collection.refer(project.rootBox.modularSetups);
134
- box.label.setValue("Modular");
135
- });
136
- const modularInput = ModularAudioInputBox.create(graph, UUID.generate(), box => {
137
- box.attributes.collection.refer(moduleSetupBox.modules);
138
- box.attributes.label.setValue("Modular Input");
139
- box.attributes.x.setValue(-256);
140
- box.attributes.y.setValue(32);
141
- });
142
- const modularOutput = ModularAudioOutputBox.create(graph, UUID.generate(), box => {
143
- box.attributes.collection.refer(moduleSetupBox.modules);
144
- box.attributes.label.setValue("Modular Output");
145
- box.attributes.x.setValue(256);
146
- box.attributes.y.setValue(32);
147
- });
148
- ModuleConnectionBox.create(graph, UUID.generate(), box => {
149
- box.collection.refer(moduleSetupBox.connections);
150
- box.source.refer(modularInput.output);
151
- box.target.refer(modularOutput.input);
152
- });
153
- project.userEditingManager.modularSystem.edit(moduleSetupBox.editing);
154
- return ModularDeviceBox.create(graph, UUID.generate(), box => {
155
- box.label.setValue("Modular");
156
- box.modularSetup.refer(moduleSetupBox.device);
157
- box.index.setValue(index);
158
- box.host.refer(unit);
159
- });
160
- }
161
- }
162
- };
163
- Effects.MidiList = Object.values(Effects.MidiNamed);
164
- Effects.AudioList = Object.values(Effects.AudioNamed);
165
- Effects.MergedNamed = { ...Effects.MidiNamed, ...Effects.AudioNamed };
166
- })(Effects || (Effects = {}));
@@ -1,35 +0,0 @@
1
- import { NanoDeviceBox, PlayfieldDeviceBox, TapeDeviceBox, TrackBox, VaporisateurDeviceBox } from "@opendaw/studio-boxes";
2
- import { BoxGraph } from "@opendaw/lib-box";
3
- import { DeviceHost, IconSymbol } from "@opendaw/studio-adapters";
4
- import { Project } from "./Project";
5
- export declare namespace Instruments {
6
- interface Factory {
7
- defaultName: string;
8
- icon: IconSymbol;
9
- description: string;
10
- createDevice: (boxGraph: BoxGraph, deviceHost: DeviceHost, name: string, icon: IconSymbol) => DeviceBox;
11
- createTrack: (boxGraph: BoxGraph, deviceHost: DeviceHost) => TrackBox;
12
- }
13
- type CreationOptions = {
14
- name?: string;
15
- icon?: IconSymbol;
16
- };
17
- type DeviceBox = TapeDeviceBox | VaporisateurDeviceBox | NanoDeviceBox | PlayfieldDeviceBox;
18
- type FactoryResult = {
19
- device: DeviceBox;
20
- track: TrackBox;
21
- };
22
- const Tape: Factory;
23
- const Nano: Factory;
24
- const Playfield: Factory;
25
- const Vaporisateur: Factory;
26
- const create: (project: Project, factory: Factory, { name, icon }?: CreationOptions) => FactoryResult;
27
- const Named: {
28
- Vaporisateur: Factory;
29
- Playfield: Factory;
30
- Nano: Factory;
31
- Tape: Factory;
32
- };
33
- type Keys = keyof typeof Named;
34
- }
35
- //# sourceMappingURL=Instruments.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Instruments.d.ts","sourceRoot":"","sources":["../src/Instruments.ts"],"names":[],"mappings":"AAAA,OAAO,EAEH,aAAa,EACb,kBAAkB,EAElB,aAAa,EACb,QAAQ,EACR,qBAAqB,EACxB,MAAM,uBAAuB,CAA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dsp";
3
- import { AudioUnitType } from "@opendaw/studio-enums";
4
- import { AudioBusBox, AudioUnitBox, NoteRegionBox, ValueRegionBox } from "@opendaw/studio-boxes";
5
- import { AnyClipBox, AudioUnitBoxAdapter, DeviceHost, IconSymbol, RootBoxAdapter, TrackClips, TrackRegions } from "@opendaw/studio-adapters";
6
- import { Project } from "./Project";
7
- import { Effects } from "./Effects";
8
- export declare namespace Modifier {
9
- const createAudioUnit: ({ boxGraph, rootBox, rootBoxAdapter, masterBusBox }: Project, type: AudioUnitType, index?: int) => AudioUnitBox;
10
- const pushAudioUnitsIndices: (rootBoxAdapter: RootBoxAdapter, type: AudioUnitType, count?: int) => int;
11
- const deleteAudioUnit: ({ rootBoxAdapter }: Project, adapter: AudioUnitBoxAdapter) => void;
12
- const createAudioBus: (project: Project, name: string, icon: IconSymbol, type: AudioUnitType, color: string) => AudioBusBox;
13
- const createEffect: (project: Project, host: DeviceHost, entry: Effects.Entry, newIndex: int) => Option<import("@opendaw/lib-box").Box<import("@opendaw/lib-box").PointerTypes, any>>;
14
- const createClip: (clips: TrackClips, clipIndex: int, { name }?: {
15
- name?: string;
16
- }) => Option<AnyClipBox>;
17
- const createRegion: (regions: TrackRegions, position: ppqn, duration: ppqn, { name }?: {
18
- name?: string;
19
- }) => Option<NoteRegionBox> | Option<ValueRegionBox>;
20
- }
21
- //# sourceMappingURL=Modifier.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Modifier.d.ts","sourceRoot":"","sources":["../src/Modifier.ts"],"names":[],"mappings":"AAAA,OAAO,EAAS,GAAG,EAAE,MAAM,EAAc,MAAM,kBAAkB,CAAA;AACjE,OAAO,EAAC,IAAI,EAAO,MAAM,kBAAkB,CAAA;AAE3C,OAAO,EAAC,aAAa,EAAC,MAAM,uBAAuB,CAAA;AACnD,OAAO,EACH,WAAW,EACX,YAAY,EAGZ,aAAa,EAIb,cAAc,EACjB,MAAM,uBAAuB,CAAA;AAC9B,OAAO,EACH,UAAU,EACV,mBAAmB,EACnB,UAAU,EAGV,UAAU,EACV,cAAc,EACd,UAAU,EACV,YAAY,EAEf,MAAM,0BAA0B,CAAA;AACjC,OAAO,EAAC,OAAO,EAAC,MAAM,WAAW,CAAA;AAEjC,OAAO,EAAC,OAAO,EAAC,MAAM,WAAW,CAAA;AAEjC,yBAAiB,QAAQ,CAAC;IAQf,MAAM,eAAe,GACvB,qDAAmD,OAAO,EAAE,MAAM,aAAa,EAAE,QAAQ,GAAG,iBAS5F,CAAA;IAEE,MAAM,qBAAqB,GAAI,gBAAgB,cAAc,EAAE,MAAM,aAAa,EAAE,QAAO,GAAO,KAAG,GAY3G,CAAA;IAEM,MAAM,eAAe,GAAI,oBAAkB,OAAO,EAAE,SAAS,mBAAmB,KAAG,IAczF,CAAA;IAEM,MAAM,cAAc,GAAI,SAAS,OAAO,EAChB,MAAM,MAAM,EACZ,MAAM,UAAU,EAChB,MAAM,aAAa,EACnB,OAAO,MAAM,KAAG,WAoB9C,CAAA;IAEM,MAAM,YAAY,GAAI,SAAS,OAAO,EAAE,MAAM,UAAU,EAAE,OAAO,OAAO,CAAC,KAAK,EAAE,UAAU,GAAG,yFAmBnG,CAAA;IAEM,MAAM,UAAU,GAAI,OAAO,UAAU,EAAE,WAAW,GAAG,EAAE,WAAQ;QAClE,IAAI,CAAC,EAAE,MAAM,CAAA;KACX,KAAG,MAAM,CAAC,UAAU,CAkCzB,CAAA;IAEM,MAAM,YAAY,GAAI,SAAS,YAAY,EACrB,UAAU,IAAI,EACd,UAAU,IAAI,EAAE,WAAQ;QAAE,IAAI,CAAC,EAAE,MAAM,CAAA;KAAO,mDAgC1E,CAAA;CACJ"}
package/dist/Modifier.js DELETED
@@ -1,168 +0,0 @@
1
- import { assert, Option, panic, UUID } from "@opendaw/lib-std";
2
- import { PPQN } from "@opendaw/lib-dsp";
3
- import { AudioUnitType } from "@opendaw/studio-enums";
4
- import { AudioBusBox, AudioUnitBox, NoteClipBox, NoteEventCollectionBox, NoteRegionBox, TrackBox, ValueClipBox, ValueEventCollectionBox, ValueRegionBox } from "@opendaw/studio-boxes";
5
- import { IconSymbol, TrackType } from "@opendaw/studio-adapters";
6
- import { ColorCodes } from "./ColorCodes";
7
- export var Modifier;
8
- (function (Modifier) {
9
- const AudioUnitOrdering = {
10
- [AudioUnitType.Instrument]: 0,
11
- [AudioUnitType.Aux]: 1,
12
- [AudioUnitType.Bus]: 2,
13
- [AudioUnitType.Output]: 3
14
- };
15
- Modifier.createAudioUnit = ({ boxGraph, rootBox, rootBoxAdapter, masterBusBox }, type, index) => {
16
- const insertIndex = index ?? Modifier.pushAudioUnitsIndices(rootBoxAdapter, type, 1);
17
- console.debug(`createAudioUnit type: ${type}, insertIndex: ${insertIndex}`);
18
- return AudioUnitBox.create(boxGraph, UUID.generate(), box => {
19
- box.collection.refer(rootBox.audioUnits);
20
- box.output.refer(masterBusBox.input);
21
- box.index.setValue(insertIndex);
22
- box.type.setValue(type);
23
- });
24
- };
25
- Modifier.pushAudioUnitsIndices = (rootBoxAdapter, type, count = 1) => {
26
- const adapters = rootBoxAdapter.audioUnits.adapters();
27
- const order = AudioUnitOrdering[type];
28
- let index = 0 | 0;
29
- for (; index < adapters.length; index++) {
30
- if (AudioUnitOrdering[adapters[index].type] > order) {
31
- break;
32
- }
33
- }
34
- const insertIndex = index;
35
- while (index < adapters.length) {
36
- adapters[index].indexField.setValue(count + index++);
37
- }
38
- return insertIndex;
39
- };
40
- Modifier.deleteAudioUnit = ({ rootBoxAdapter }, adapter) => {
41
- const adapters = rootBoxAdapter.audioUnits.adapters();
42
- const boxIndex = adapter.indexField.getValue();
43
- const deleteIndex = adapters.indexOf(adapter);
44
- console.debug(`deleteAudioUnit adapter: ${adapter.toString()}, deleteIndex: ${deleteIndex}, indexField: ${boxIndex}`);
45
- if (deleteIndex === -1) {
46
- return panic(`Cannot delete ${adapter}. Does not exist.`);
47
- }
48
- if (deleteIndex !== boxIndex) {
49
- console.debug("indices", adapters.map(x => x.box.index.getValue()).join(", "));
50
- return panic(`Cannot delete ${adapter}. Wrong index.`);
51
- }
52
- for (let index = deleteIndex + 1; index < adapters.length; index++) {
53
- adapters[index].indexField.setValue(index - 1);
54
- }
55
- adapter.box.delete();
56
- };
57
- Modifier.createAudioBus = (project, name, icon, type, color) => {
58
- console.debug(`createAudioBus '${name}', type: ${type}, color: ${color}`);
59
- const { rootBox, boxGraph } = project;
60
- assert(rootBox.audioBusses.isAttached(), "rootBox not attached");
61
- const uuid = UUID.generate();
62
- const audioBusBox = AudioBusBox.create(boxGraph, uuid, box => {
63
- box.collection.refer(rootBox.audioBusses);
64
- box.label.setValue(name);
65
- box.icon.setValue(IconSymbol.toName(icon));
66
- box.color.setValue(color);
67
- });
68
- const audioUnitBox = Modifier.createAudioUnit(project, type);
69
- TrackBox.create(boxGraph, UUID.generate(), box => {
70
- box.tracks.refer(audioUnitBox.tracks);
71
- box.target.refer(audioUnitBox);
72
- box.index.setValue(0);
73
- box.type.setValue(TrackType.Undefined);
74
- });
75
- audioBusBox.output.refer(audioUnitBox.input);
76
- return audioBusBox;
77
- };
78
- Modifier.createEffect = (project, host, entry, newIndex) => {
79
- let chain;
80
- let field;
81
- if (entry.type === "audio") {
82
- chain = host.audioEffects.adapters();
83
- field = host.audioEffects.field();
84
- }
85
- else if (entry.type === "midi") {
86
- chain = host.midiEffects.adapters();
87
- field = host.midiEffects.field();
88
- }
89
- else {
90
- return panic(`Unknown factory type: ${entry.type}`);
91
- }
92
- return project.editing.modify(() => {
93
- const box = entry.create(project, field, newIndex);
94
- for (let index = newIndex; index < chain.length; index++) {
95
- chain[index].indexField.setValue(index + 1);
96
- }
97
- return box;
98
- });
99
- };
100
- Modifier.createClip = (clips, clipIndex, { name } = {}) => {
101
- if (clips.collection.getAdapterByIndex(clipIndex).nonEmpty()) {
102
- console.warn("Cannot create Clip on occupied cell.");
103
- return Option.None;
104
- }
105
- const graph = clips.trackBoxAdapter.box.graph;
106
- const type = clips.trackBoxAdapter.type;
107
- switch (type) {
108
- case TrackType.Notes: {
109
- const events = NoteEventCollectionBox.create(graph, UUID.generate());
110
- return Option.wrap(NoteClipBox.create(graph, UUID.generate(), box => {
111
- box.index.setValue(clipIndex);
112
- box.label.setValue(name ?? "Notes");
113
- box.hue.setValue(ColorCodes.forTrackType(type));
114
- box.mute.setValue(false);
115
- box.duration.setValue(PPQN.Bar);
116
- box.clips.refer(clips.trackBoxAdapter.box.clips);
117
- box.events.refer(events.owners);
118
- }));
119
- }
120
- case TrackType.Value: {
121
- const events = ValueEventCollectionBox.create(graph, UUID.generate());
122
- return Option.wrap(ValueClipBox.create(graph, UUID.generate(), box => {
123
- box.index.setValue(clipIndex);
124
- box.label.setValue(name ?? "CV");
125
- box.hue.setValue(ColorCodes.forTrackType(type));
126
- box.mute.setValue(false);
127
- box.duration.setValue(PPQN.Bar);
128
- box.events.refer(events.owners);
129
- box.clips.refer(clips.trackBoxAdapter.box.clips);
130
- }));
131
- }
132
- }
133
- return Option.None;
134
- };
135
- Modifier.createRegion = (regions, position, duration, { name } = {}) => {
136
- const graph = regions.trackBoxAdapter.box.graph;
137
- const type = regions.trackBoxAdapter.type;
138
- switch (type) {
139
- case TrackType.Notes: {
140
- const events = NoteEventCollectionBox.create(graph, UUID.generate());
141
- return Option.wrap(NoteRegionBox.create(graph, UUID.generate(), box => {
142
- box.position.setValue(Math.max(position, 0));
143
- box.label.setValue(name ?? "Notes");
144
- box.hue.setValue(ColorCodes.forTrackType(type));
145
- box.mute.setValue(false);
146
- box.duration.setValue(duration);
147
- box.loopDuration.setValue(PPQN.Bar);
148
- box.events.refer(events.owners);
149
- box.regions.refer(regions.trackBoxAdapter.box.regions);
150
- }));
151
- }
152
- case TrackType.Value: {
153
- const events = ValueEventCollectionBox.create(graph, UUID.generate());
154
- return Option.wrap(ValueRegionBox.create(graph, UUID.generate(), box => {
155
- box.position.setValue(Math.max(position, 0));
156
- box.label.setValue(name ?? "Automation");
157
- box.hue.setValue(ColorCodes.forTrackType(type));
158
- box.mute.setValue(false);
159
- box.duration.setValue(duration);
160
- box.loopDuration.setValue(PPQN.Bar);
161
- box.events.refer(events.owners);
162
- box.regions.refer(regions.trackBoxAdapter.box.regions);
163
- }));
164
- }
165
- }
166
- return Option.None;
167
- };
168
- })(Modifier || (Modifier = {}));