@opendaw/studio-core 0.0.8 → 0.0.10

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.
@@ -0,0 +1,7 @@
1
+ import { AudioUnitType } from "@opendaw/studio-enums";
2
+ import { TrackType } from "@opendaw/studio-adapters";
3
+ export declare namespace ColorCodes {
4
+ const forAudioType: (type?: AudioUnitType) => string;
5
+ const forTrackType: (type?: TrackType) => number;
6
+ }
7
+ //# sourceMappingURL=ColorCodes.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ColorCodes.d.ts","sourceRoot":"","sources":["../src/ColorCodes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,aAAa,EAAC,MAAM,uBAAuB,CAAA;AACnD,OAAO,EAAC,SAAS,EAAC,MAAM,0BAA0B,CAAA;AAGlD,yBAAiB,UAAU,CAAC;IACjB,MAAM,YAAY,GAAI,OAAO,aAAa,KAAG,MAanD,CAAA;IAEM,MAAM,YAAY,GAAI,OAAO,SAAS,KAAG,MAW/C,CAAA;CACJ"}
@@ -0,0 +1,32 @@
1
+ import { AudioUnitType } from "@opendaw/studio-enums";
2
+ import { TrackType } from "@opendaw/studio-adapters";
3
+ import { Colors } from "./Colors";
4
+ export var ColorCodes;
5
+ (function (ColorCodes) {
6
+ ColorCodes.forAudioType = (type) => {
7
+ switch (type) {
8
+ case AudioUnitType.Output:
9
+ return Colors.blue;
10
+ case AudioUnitType.Aux:
11
+ return Colors.purple;
12
+ case AudioUnitType.Bus:
13
+ return Colors.orange;
14
+ case AudioUnitType.Instrument:
15
+ return Colors.green;
16
+ default:
17
+ return Colors.dark;
18
+ }
19
+ };
20
+ ColorCodes.forTrackType = (type) => {
21
+ switch (type) {
22
+ case TrackType.Audio:
23
+ return 200;
24
+ case TrackType.Notes:
25
+ return 45;
26
+ case TrackType.Value:
27
+ return 156;
28
+ default:
29
+ return 0;
30
+ }
31
+ };
32
+ })(ColorCodes || (ColorCodes = {}));
@@ -0,0 +1,15 @@
1
+ export declare const Colors: {
2
+ blue: string;
3
+ green: string;
4
+ yellow: string;
5
+ cream: string;
6
+ orange: string;
7
+ red: string;
8
+ purple: string;
9
+ bright: string;
10
+ gray: string;
11
+ dark: string;
12
+ shadow: string;
13
+ black: string;
14
+ };
15
+ //# sourceMappingURL=Colors.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Colors.d.ts","sourceRoot":"","sources":["../src/Colors.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,MAAM;;;;;;;;;;;;;CAalB,CAAA"}
package/dist/Colors.js ADDED
@@ -0,0 +1,15 @@
1
+ const computedStyle = getComputedStyle(document.documentElement);
2
+ export const Colors = {
3
+ blue: computedStyle.getPropertyValue("--color-blue"),
4
+ green: computedStyle.getPropertyValue("--color-green"),
5
+ yellow: computedStyle.getPropertyValue("--color-yellow"),
6
+ cream: computedStyle.getPropertyValue("--color-cream"),
7
+ orange: computedStyle.getPropertyValue("--color-orange"),
8
+ red: computedStyle.getPropertyValue("--color-red"),
9
+ purple: computedStyle.getPropertyValue("--color-purple"),
10
+ bright: computedStyle.getPropertyValue("--color-bright"),
11
+ gray: computedStyle.getPropertyValue("--color-gray"),
12
+ dark: computedStyle.getPropertyValue("--color-dark"),
13
+ shadow: computedStyle.getPropertyValue("--color-shadow"),
14
+ black: computedStyle.getPropertyValue("--color-black")
15
+ };
@@ -0,0 +1,154 @@
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
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Effects.d.ts","sourceRoot":"","sources":["../src/Effects.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,GAAG,EAAuB,MAAM,kBAAkB,CAAA;AAC1D,OAAO,EAAC,GAAG,EAAE,KAAK,EAAC,MAAM,kBAAkB,CAAA;AAC3C,OAAO,EACH,iBAAiB,EACjB,cAAc,EAKd,gBAAgB,EAEhB,cAAc,EACd,eAAe,EACf,eAAe,EACf,mBAAmB,EACnB,kBAAkB,EACrB,MAAM,uBAAuB,CAAA;AAC9B,OAAO,EAAC,iBAAiB,EAAE,UAAU,EAAC,MAAM,0BAA0B,CAAA;AACtE,OAAO,EAAC,OAAO,EAAC,MAAM,WAAW,CAAA;AAEjC,yBAAiB,OAAO,CAAC;IACrB,UAAiB,KAAK;QAClB,IAAI,IAAI,IAAI,MAAM,CAAA;QAClB,IAAI,WAAW,IAAI,MAAM,CAAA;QACzB,IAAI,IAAI,IAAI,UAAU,CAAA;QACtB,IAAI,eAAe,IAAI,OAAO,CAAA;QAC9B,IAAI,IAAI,IAAI,OAAO,GAAG,MAAM,CAAA;QAE5B,MAAM,CAAC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,KAAK,CAAC,iBAAiB,CAAC,EAAE,KAAK,EAAE,GAAG,GAAG,GAAG,CAAA;KAC5E;IAEM,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;KA+CrB,CAAA;IAEM,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KA4GtB,CAAA;IAEM,MAAM,QAAQ,EAAE,aAAa,CAAC,QAAQ,CAAC,KAAK,CAAC,CAA4B,CAAA;IACzE,MAAM,SAAS,EAAE,aAAa,CAAC,QAAQ,CAAC,KAAK,CAAC,CAA6B,CAAA;IAC3E,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAAgC,CAAA;IAExD,KAAY,cAAc,GAAG,MAAM,OAAO,SAAS,CAAA;IACnD,KAAY,eAAe,GAAG,MAAM,OAAO,UAAU,CAAA;CACxD"}
@@ -0,0 +1,166 @@
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 = {}));
@@ -0,0 +1,35 @@
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
@@ -0,0 +1 @@
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,CAAA;AAG9B,OAAO,EAAC,QAAQ,EAAC,MAAM,kBAAkB,CAAA;AAEzC,OAAO,EAAsB,UAAU,EAAE,UAAU,EAAY,MAAM,0BAA0B,CAAA;AAE/F,OAAO,EAAC,OAAO,EAAC,MAAM,WAAW,CAAA;AAEjC,yBAAiB,WAAW,CAAC;IACzB,UAAiB,OAAO;QACpB,WAAW,EAAE,MAAM,CAAA;QACnB,IAAI,EAAE,UAAU,CAAA;QAChB,WAAW,EAAE,MAAM,CAAA;QACnB,YAAY,EAAE,CAAC,QAAQ,EAAE,QAAQ,EAAE,UAAU,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,UAAU,KAAK,SAAS,CAAA;QACvG,WAAW,EAAE,CAAC,QAAQ,EAAE,QAAQ,EAAE,UAAU,EAAE,UAAU,KAAK,QAAQ,CAAA;KACxE;IAED,KAAY,eAAe,GAAG;QAAE,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,UAAU,CAAA;KAAE,CAAA;IAElE,KAAY,SAAS,GAAG,aAAa,GAAG,qBAAqB,GAAG,aAAa,GAAG,kBAAkB,CAAA;IAElG,KAAY,aAAa,GAAG;QACxB,MAAM,EAAE,SAAS,CAAA;QACjB,KAAK,EAAE,QAAQ,CAAA;KAClB,CAAA;IAOM,MAAM,IAAI,EAAE,OAqBlB,CAAA;IAEM,MAAM,IAAI,EAAE,OAwBlB,CAAA;IAEM,MAAM,SAAS,EAAE,OAuCvB,CAAA;IAEM,MAAM,YAAY,EAAE,OAuB1B,CAAA;IAEM,MAAM,MAAM,GAAI,SAAS,OAAO,EAChB,SAAS,OAAO,EAAE,iBAAc,eAAoB,KAAG,aAe7E,CAAA;IAEM,MAAM,KAAK;;;;;KAAwC,CAAA;IAC1D,KAAY,IAAI,GAAG,MAAM,OAAO,KAAK,CAAA;CACxC"}
@@ -0,0 +1,135 @@
1
+ import { AudioFileBox, NanoDeviceBox, PlayfieldDeviceBox, PlayfieldSampleBox, TapeDeviceBox, TrackBox, VaporisateurDeviceBox } from "@opendaw/studio-boxes";
2
+ import { Strings, UUID } from "@opendaw/lib-std";
3
+ import { Waveform } from "@opendaw/lib-dsp";
4
+ import { AudioUnitType } from "@opendaw/studio-enums";
5
+ import { AudioUnitBoxAdapter, IconSymbol, TrackType } from "@opendaw/studio-adapters";
6
+ import { Modifier } from "./Modifier";
7
+ export var Instruments;
8
+ (function (Instruments) {
9
+ const useFile = (boxGraph, fileUUID, name) => boxGraph.findBox(fileUUID)
10
+ .unwrapOrElse(() => AudioFileBox.create(boxGraph, fileUUID, box => {
11
+ box.fileName.setValue(name);
12
+ }));
13
+ Instruments.Tape = {
14
+ defaultName: "Tape",
15
+ icon: IconSymbol.Tape,
16
+ description: "Plays audio regions & clips",
17
+ createDevice: (boxGraph, deviceHost, name, icon) => TapeDeviceBox.create(boxGraph, UUID.generate(), box => {
18
+ box.label.setValue(name);
19
+ box.icon.setValue(IconSymbol.toName(icon));
20
+ box.flutter.setValue(0.2);
21
+ box.wow.setValue(0.05);
22
+ box.noise.setValue(0.02);
23
+ box.saturation.setValue(0.5);
24
+ box.host.refer(deviceHost.inputField);
25
+ }),
26
+ createTrack: (boxGraph, deviceHost) => TrackBox.create(boxGraph, UUID.generate(), box => {
27
+ box.index.setValue(0);
28
+ box.type.setValue(TrackType.Audio);
29
+ box.tracks.refer(deviceHost.tracksField);
30
+ box.target.refer(deviceHost.audioUnitBoxAdapter().box);
31
+ })
32
+ };
33
+ Instruments.Nano = {
34
+ defaultName: "Nano",
35
+ icon: IconSymbol.NanoWave,
36
+ description: "Simple Sampler",
37
+ createDevice: (boxGraph, deviceHost, name, icon) => {
38
+ const fileUUID = UUID.parse("c1678daa-4a47-4cba-b88f-4f4e384663c3");
39
+ const audioFileBox = boxGraph.findBox(fileUUID)
40
+ .unwrapOrElse(() => AudioFileBox.create(boxGraph, fileUUID, box => {
41
+ box.fileName.setValue("Rhode");
42
+ }));
43
+ return NanoDeviceBox.create(boxGraph, UUID.generate(), box => {
44
+ box.label.setValue(name);
45
+ box.icon.setValue(IconSymbol.toName(icon));
46
+ box.file.refer(audioFileBox);
47
+ box.host.refer(deviceHost.inputField);
48
+ });
49
+ },
50
+ createTrack: (boxGraph, deviceHost) => TrackBox.create(boxGraph, UUID.generate(), box => {
51
+ box.index.setValue(0);
52
+ box.type.setValue(TrackType.Notes);
53
+ box.tracks.refer(deviceHost.tracksField);
54
+ box.target.refer(deviceHost.audioUnitBoxAdapter().box);
55
+ })
56
+ };
57
+ Instruments.Playfield = {
58
+ defaultName: "Playfield",
59
+ icon: IconSymbol.Playfield,
60
+ description: "Drumcomputer",
61
+ createDevice: (boxGraph, deviceHost, name, icon) => {
62
+ const deviceBox = PlayfieldDeviceBox.create(boxGraph, UUID.generate(), box => {
63
+ box.label.setValue(name);
64
+ box.icon.setValue(IconSymbol.toName(icon));
65
+ box.host.refer(deviceHost.inputField);
66
+ });
67
+ const files = [
68
+ useFile(boxGraph, UUID.parse("8bb2c6e8-9a6d-4d32-b7ec-1263594ef367"), "909 Bassdrum"),
69
+ useFile(boxGraph, UUID.parse("0017fa18-a5eb-4d9d-b6f2-e2ddd30a3010"), "909 Snare"),
70
+ useFile(boxGraph, UUID.parse("28d14cb9-1dc6-4193-9dd7-4e881f25f520"), "909 Low Tom"),
71
+ useFile(boxGraph, UUID.parse("21f92306-d6e7-446c-a34b-b79620acfefc"), "909 Mid Tom"),
72
+ useFile(boxGraph, UUID.parse("ad503883-8a72-46ab-a05b-a84149953e17"), "909 High Tom"),
73
+ useFile(boxGraph, UUID.parse("cfee850b-7658-4d08-9e3b-79d196188504"), "909 Rimshot"),
74
+ useFile(boxGraph, UUID.parse("32a6f36f-06eb-4b84-bb57-5f51103eb9e6"), "909 Clap"),
75
+ useFile(boxGraph, UUID.parse("e0ac4b39-23fb-4a56-841d-c9e0ff440cab"), "909 Closed Hat"),
76
+ useFile(boxGraph, UUID.parse("51c5eea4-391c-4743-896a-859692ec1105"), "909 Open Hat"),
77
+ useFile(boxGraph, UUID.parse("42a56ff6-89b6-4f2e-8a66-5a41d316f4cb"), "909 Crash"),
78
+ useFile(boxGraph, UUID.parse("87cde966-b799-4efc-a994-069e703478d3"), "909 Ride")
79
+ ];
80
+ const samples = files.map((file, index) => PlayfieldSampleBox.create(boxGraph, UUID.generate(), box => {
81
+ box.device.refer(deviceBox.samples);
82
+ box.file.refer(file);
83
+ box.index.setValue(60 + index);
84
+ }));
85
+ samples[7].exclude.setValue(true);
86
+ samples[8].exclude.setValue(true);
87
+ return deviceBox;
88
+ },
89
+ createTrack: (boxGraph, deviceHost) => TrackBox.create(boxGraph, UUID.generate(), box => {
90
+ box.index.setValue(0);
91
+ box.type.setValue(TrackType.Notes);
92
+ box.tracks.refer(deviceHost.tracksField);
93
+ box.target.refer(deviceHost.audioUnitBoxAdapter().box);
94
+ })
95
+ };
96
+ Instruments.Vaporisateur = {
97
+ defaultName: "Vaporisateur",
98
+ icon: IconSymbol.Piano,
99
+ description: "Classic subtractive synthesizer",
100
+ createDevice: (boxGraph, deviceHost, name, icon) => VaporisateurDeviceBox.create(boxGraph, UUID.generate(), box => {
101
+ box.label.setValue(name);
102
+ box.icon.setValue(IconSymbol.toName(icon));
103
+ box.tune.setInitValue(0.0);
104
+ box.cutoff.setInitValue(1000.0);
105
+ box.resonance.setInitValue(0.1);
106
+ box.attack.setInitValue(0.005);
107
+ box.release.setInitValue(0.1);
108
+ box.waveform.setInitValue(Waveform.sine);
109
+ box.host.refer(deviceHost.inputField);
110
+ }),
111
+ createTrack: (boxGraph, deviceHost) => TrackBox.create(boxGraph, UUID.generate(), box => {
112
+ box.index.setValue(0);
113
+ box.type.setValue(TrackType.Notes);
114
+ box.tracks.refer(deviceHost.tracksField);
115
+ box.target.refer(deviceHost.audioUnitBoxAdapter().box);
116
+ })
117
+ };
118
+ Instruments.create = (project, factory, { name, icon } = {}) => {
119
+ const { boxGraph, boxAdapters, rootBoxAdapter, userEditingManager } = project;
120
+ const existingNames = rootBoxAdapter.audioUnits.adapters()
121
+ .map(adapter => adapter.input.getValue().match({
122
+ none: () => "Untitled",
123
+ some: adapter => adapter.labelField.getValue()
124
+ }));
125
+ const audioUnitBox = Modifier.createAudioUnit(project, AudioUnitType.Instrument);
126
+ const audioUnitBoxAdapter = boxAdapters.adapterFor(audioUnitBox, AudioUnitBoxAdapter);
127
+ const uniqueName = Strings.getUniqueName(existingNames, name ?? factory.defaultName);
128
+ const iconSymbol = icon ?? factory.icon;
129
+ const device = factory.createDevice(boxGraph, audioUnitBoxAdapter, uniqueName, iconSymbol);
130
+ const track = factory.createTrack(boxGraph, audioUnitBoxAdapter);
131
+ userEditingManager.audioUnit.edit(audioUnitBox.editing);
132
+ return { device, track };
133
+ };
134
+ Instruments.Named = { Vaporisateur: Instruments.Vaporisateur, Playfield: Instruments.Playfield, Nano: Instruments.Nano, Tape: Instruments.Tape };
135
+ })(Instruments || (Instruments = {}));
@@ -0,0 +1,21 @@
1
+ import { int, Option } from "@opendaw/lib-std";
2
+ import { ppqn } from "@opendaw/lib-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
@@ -0,0 +1 @@
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"}