@opendaw/studio-core 0.0.8 → 0.0.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ColorCodes.d.ts +7 -0
- package/dist/ColorCodes.d.ts.map +1 -0
- package/dist/ColorCodes.js +32 -0
- package/dist/Colors.d.ts +15 -0
- package/dist/Colors.d.ts.map +1 -0
- package/dist/Colors.js +15 -0
- package/dist/Effects.d.ts +154 -0
- package/dist/Effects.d.ts.map +1 -0
- package/dist/Effects.js +166 -0
- package/dist/Modifier.d.ts +21 -0
- package/dist/Modifier.d.ts.map +1 -0
- package/dist/Modifier.js +168 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -0
- package/package.json +16 -16
@@ -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 = {}));
|
package/dist/Colors.d.ts
ADDED
@@ -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"}
|
package/dist/Effects.js
ADDED
@@ -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,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"}
|
package/dist/Modifier.js
ADDED
@@ -0,0 +1,168 @@
|
|
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 = {}));
|
package/dist/index.d.ts
CHANGED
@@ -6,10 +6,14 @@ export * from "./samples/SampleStorage";
|
|
6
6
|
export * from "./samples/MainThreadSampleLoader";
|
7
7
|
export * from "./samples/MainThreadSampleManager";
|
8
8
|
export * from "./samples/SampleProvider";
|
9
|
+
export * from "./ColorCodes";
|
10
|
+
export * from "./Colors";
|
11
|
+
export * from "./Effects";
|
9
12
|
export * from "./Engine";
|
10
13
|
export * from "./EngineFacade";
|
11
14
|
export * from "./EngineWorklet";
|
12
15
|
export * from "./Mixer";
|
16
|
+
export * from "./Modifier";
|
13
17
|
export * from "./Project";
|
14
18
|
export * from "./ProjectEnv";
|
15
19
|
export * from "./Wav";
|
package/dist/index.d.ts.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAA;AACjC,cAAc,0BAA0B,CAAA;AACxC,cAAc,0BAA0B,CAAA;AAExC,cAAc,uBAAuB,CAAA;AACrC,cAAc,yBAAyB,CAAA;AACvC,cAAc,kCAAkC,CAAA;AAChD,cAAc,mCAAmC,CAAA;AACjD,cAAc,0BAA0B,CAAA;AAExC,cAAc,UAAU,CAAA;AACxB,cAAc,gBAAgB,CAAA;AAC9B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,SAAS,CAAA;AACvB,cAAc,WAAW,CAAA;AACzB,cAAc,cAAc,CAAA;AAC5B,cAAc,OAAO,CAAA;AACrB,cAAc,gBAAgB,CAAA;AAC9B,cAAc,YAAY,CAAA"}
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAA;AACjC,cAAc,0BAA0B,CAAA;AACxC,cAAc,0BAA0B,CAAA;AAExC,cAAc,uBAAuB,CAAA;AACrC,cAAc,yBAAyB,CAAA;AACvC,cAAc,kCAAkC,CAAA;AAChD,cAAc,mCAAmC,CAAA;AACjD,cAAc,0BAA0B,CAAA;AAExC,cAAc,cAAc,CAAA;AAC5B,cAAc,UAAU,CAAA;AACxB,cAAc,WAAW,CAAA;AACzB,cAAc,UAAU,CAAA;AACxB,cAAc,gBAAgB,CAAA;AAC9B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,SAAS,CAAA;AACvB,cAAc,YAAY,CAAA;AAC1B,cAAc,WAAW,CAAA;AACzB,cAAc,cAAc,CAAA;AAC5B,cAAc,OAAO,CAAA;AACrB,cAAc,gBAAgB,CAAA;AAC9B,cAAc,YAAY,CAAA"}
|
package/dist/index.js
CHANGED
@@ -6,10 +6,14 @@ export * from "./samples/SampleStorage";
|
|
6
6
|
export * from "./samples/MainThreadSampleLoader";
|
7
7
|
export * from "./samples/MainThreadSampleManager";
|
8
8
|
export * from "./samples/SampleProvider";
|
9
|
+
export * from "./ColorCodes";
|
10
|
+
export * from "./Colors";
|
11
|
+
export * from "./Effects";
|
9
12
|
export * from "./Engine";
|
10
13
|
export * from "./EngineFacade";
|
11
14
|
export * from "./EngineWorklet";
|
12
15
|
export * from "./Mixer";
|
16
|
+
export * from "./Modifier";
|
13
17
|
export * from "./Project";
|
14
18
|
export * from "./ProjectEnv";
|
15
19
|
export * from "./Wav";
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@opendaw/studio-core",
|
3
|
-
"version": "0.0.
|
3
|
+
"version": "0.0.9",
|
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.
|
30
|
-
"@opendaw/lib-dom": "^0.0.
|
31
|
-
"@opendaw/lib-dsp": "^0.0.
|
32
|
-
"@opendaw/lib-fusion": "^0.0.
|
33
|
-
"@opendaw/lib-runtime": "^0.0.
|
34
|
-
"@opendaw/lib-std": "^0.0.
|
35
|
-
"@opendaw/studio-adapters": "^0.0.
|
36
|
-
"@opendaw/studio-boxes": "^0.0.
|
37
|
-
"@opendaw/studio-enums": "^0.0.
|
29
|
+
"@opendaw/lib-box": "^0.0.9",
|
30
|
+
"@opendaw/lib-dom": "^0.0.9",
|
31
|
+
"@opendaw/lib-dsp": "^0.0.9",
|
32
|
+
"@opendaw/lib-fusion": "^0.0.9",
|
33
|
+
"@opendaw/lib-runtime": "^0.0.9",
|
34
|
+
"@opendaw/lib-std": "^0.0.9",
|
35
|
+
"@opendaw/studio-adapters": "^0.0.9",
|
36
|
+
"@opendaw/studio-boxes": "^0.0.9",
|
37
|
+
"@opendaw/studio-enums": "^0.0.9"
|
38
38
|
},
|
39
39
|
"devDependencies": {
|
40
|
-
"@opendaw/eslint-config": "^0.0.
|
41
|
-
"@opendaw/studio-core-processors": "^0.0.
|
42
|
-
"@opendaw/studio-core-workers": "^0.0.
|
43
|
-
"@opendaw/studio-forge-boxes": "^0.0.
|
44
|
-
"@opendaw/typescript-config": "^0.0.
|
40
|
+
"@opendaw/eslint-config": "^0.0.9",
|
41
|
+
"@opendaw/studio-core-processors": "^0.0.9",
|
42
|
+
"@opendaw/studio-core-workers": "^0.0.3",
|
43
|
+
"@opendaw/studio-forge-boxes": "^0.0.9",
|
44
|
+
"@opendaw/typescript-config": "^0.0.9"
|
45
45
|
},
|
46
|
-
"gitHead": "
|
46
|
+
"gitHead": "3282403ddf3a1f562a64af2ec7395aa333d40f42"
|
47
47
|
}
|