@opendaw/studio-adapters 0.0.101 → 0.0.103
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/ScriptDeclaration.d.ts +17 -1
- package/dist/ScriptDeclaration.d.ts.map +1 -1
- package/dist/ScriptDeclaration.js +35 -0
- package/dist/engine/EnginePreferencesSchema.d.ts +3 -0
- package/dist/engine/EnginePreferencesSchema.d.ts.map +1 -1
- package/dist/engine/EnginePreferencesSchema.js +5 -0
- package/dist/preset/PresetDecoder.js +1 -1
- package/dist/project/ProjectSkeleton.js +1 -1
- package/package.json +9 -9
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Observable, Option, StringMapping, Terminable, ValueMapping } from "@opendaw/lib-std";
|
|
1
|
+
import { Nullable, Observable, Option, StringMapping, Terminable, ValueMapping } from "@opendaw/lib-std";
|
|
2
2
|
import { Field, StringField } from "@opendaw/lib-box";
|
|
3
3
|
import { Pointers } from "@opendaw/studio-enums";
|
|
4
4
|
import { ParameterAdapterSet } from "./ParameterAdapterSet";
|
|
@@ -14,12 +14,28 @@ export interface ParamDeclaration {
|
|
|
14
14
|
export interface SampleDeclaration {
|
|
15
15
|
readonly label: string;
|
|
16
16
|
}
|
|
17
|
+
export interface GroupDeclaration {
|
|
18
|
+
readonly label: string;
|
|
19
|
+
readonly color: string;
|
|
20
|
+
}
|
|
21
|
+
export type DeclarationItem = {
|
|
22
|
+
readonly type: "param";
|
|
23
|
+
readonly declaration: ParamDeclaration;
|
|
24
|
+
} | {
|
|
25
|
+
readonly type: "sample";
|
|
26
|
+
readonly declaration: SampleDeclaration;
|
|
27
|
+
};
|
|
28
|
+
export interface DeclarationSection {
|
|
29
|
+
readonly group: Nullable<GroupDeclaration>;
|
|
30
|
+
readonly items: ReadonlyArray<DeclarationItem>;
|
|
31
|
+
}
|
|
17
32
|
export declare namespace ScriptDeclaration {
|
|
18
33
|
export const isEqual: (a: ParamDeclaration, b: ParamDeclaration) => boolean;
|
|
19
34
|
export const parseLabel: (code: string) => Option<string>;
|
|
20
35
|
export const parseParams: (code: string) => ReadonlyArray<ParamDeclaration>;
|
|
21
36
|
export const parseSamples: (code: string) => ReadonlyArray<SampleDeclaration>;
|
|
22
37
|
export const parseDeclarationOrder: (code: string) => Map<string, number>;
|
|
38
|
+
export const parseGroups: (code: string) => ReadonlyArray<DeclarationSection>;
|
|
23
39
|
export const resolveValueMapping: (declaration: ParamDeclaration) => ValueMapping<number>;
|
|
24
40
|
export const resolveStringMapping: (declaration: ParamDeclaration) => StringMapping<number>;
|
|
25
41
|
type ParamMapping = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ScriptDeclaration.d.ts","sourceRoot":"","sources":["../src/ScriptDeclaration.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"ScriptDeclaration.d.ts","sourceRoot":"","sources":["../src/ScriptDeclaration.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoC,QAAQ,EAAE,UAAU,EAAE,MAAM,EAAE,aAAa,EAAE,UAAU,EAAE,YAAY,EAAC,MAAM,kBAAkB,CAAA;AACzI,OAAO,EAAC,KAAK,EAAE,WAAW,EAAC,MAAM,kBAAkB,CAAA;AACnD,OAAO,EAAC,QAAQ,EAAC,MAAM,uBAAuB,CAAA;AAE9C,OAAO,EAAC,mBAAmB,EAAC,MAAM,uBAAuB,CAAA;AAEzD,MAAM,MAAM,YAAY,GAAG,UAAU,GAAG,QAAQ,GAAG,KAAK,GAAG,KAAK,GAAG,MAAM,CAAA;AAEzE,MAAM,WAAW,gBAAgB;IAC7B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;IACtB,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAA;IAC7B,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAA;IACpB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAA;IACpB,QAAQ,CAAC,OAAO,EAAE,YAAY,CAAA;IAC9B,QAAQ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B,KAAG,YAAY,CAAC,MAAM,CAatF,CAAA;IAED,MAAM,CAAC,MAAM,oBAAoB,GAAI,aAAa,gBAAgB,KAAG,aAAa,CAAC,MAAM,CAaxF,CAAA;IAED,KAAK,YAAY,GAAG;QAChB,YAAY,EAAE,YAAY,CAAC,MAAM,CAAC,CAAA;QAClC,aAAa,EAAE,aAAa,CAAC,MAAM,CAAC,CAAA;KACvC,CAAA;IAED,MAAM,CAAC,MAAM,oBAAoB,GAAI,aAAa,gBAAgB,KAAG,YAGnE,CAAA;IAEF,MAAM,MAAM,mBAAmB,GAAG;QAC9B,QAAQ,CAAC,UAAU,EAAE,UAAU,CAAA;QAC/B,QAAQ,CAAC,WAAW,EAAE,UAAU,CAAC,IAAI,CAAC,CAAA;KACzC,CAAA;IAED,MAAM,CAAC,MAAM,qBAAqB,GAAI,YAAY,mBAAmB,EAC/B,WAAW,WAAW,EACtB,iBAAiB,KAAK,CAAC,QAAQ,CAAC,SAAS,CAAC,KAAG,mBA0ClF,CAAA;;CACJ"}
|
|
@@ -3,6 +3,8 @@ import { WerkstattParameterBox } from "@opendaw/studio-boxes";
|
|
|
3
3
|
const LABEL_LINE = /^\/\/ @label .+$/m;
|
|
4
4
|
const PARAM_LINE = /^\/\/ @param .+$/gm;
|
|
5
5
|
const SAMPLE_LINE = /^\/\/ @sample .+$/gm;
|
|
6
|
+
const GROUP_LINE = /^\/\/ @group .+$/gm;
|
|
7
|
+
const DIRECTIVE_LINE = /^\/\/ @(group|param|sample) .+$/gm;
|
|
6
8
|
const DECLARATION_LINE = /^\/\/ @(?:param|sample) \S+/gm;
|
|
7
9
|
const FLOAT_TOLERANCE = 1e-6;
|
|
8
10
|
const VALID_MAPPINGS = ["linear", "exp", "int", "bool"];
|
|
@@ -130,6 +132,39 @@ export var ScriptDeclaration;
|
|
|
130
132
|
}
|
|
131
133
|
return order;
|
|
132
134
|
};
|
|
135
|
+
ScriptDeclaration.parseGroups = (code) => {
|
|
136
|
+
const sections = [];
|
|
137
|
+
let currentGroup = null;
|
|
138
|
+
let currentItems = [];
|
|
139
|
+
DIRECTIVE_LINE.lastIndex = 0;
|
|
140
|
+
let match;
|
|
141
|
+
while ((match = DIRECTIVE_LINE.exec(code)) !== null) {
|
|
142
|
+
const line = match[0];
|
|
143
|
+
const type = match[1];
|
|
144
|
+
if (type === "group") {
|
|
145
|
+
if (currentItems.length > 0 || currentGroup !== null) {
|
|
146
|
+
sections.push({ group: currentGroup, items: currentItems });
|
|
147
|
+
}
|
|
148
|
+
const tokens = line.replace(/^\/\/ @group\s+/, "").trim().split(/\s+/);
|
|
149
|
+
currentGroup = { label: tokens[0], color: tokens[1] ?? "dark" };
|
|
150
|
+
currentItems = [];
|
|
151
|
+
}
|
|
152
|
+
else if (type === "param") {
|
|
153
|
+
currentItems.push({ type: "param", declaration: parseSingleParam(line) });
|
|
154
|
+
}
|
|
155
|
+
else if (type === "sample") {
|
|
156
|
+
const tokens = line.replace(/^\/\/ @sample\s+/, "").replace(/\s+\/\/.*$/, "").trim().split(/\s+/);
|
|
157
|
+
if (tokens.length === 0 || tokens[0].length === 0) {
|
|
158
|
+
throw new Error(`Malformed @sample: '${line}' — expected: // @sample <name>`);
|
|
159
|
+
}
|
|
160
|
+
currentItems.push({ type: "sample", declaration: { label: tokens[0] } });
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
if (currentItems.length > 0 || currentGroup !== null) {
|
|
164
|
+
sections.push({ group: currentGroup, items: currentItems });
|
|
165
|
+
}
|
|
166
|
+
return sections;
|
|
167
|
+
};
|
|
133
168
|
ScriptDeclaration.resolveValueMapping = (declaration) => {
|
|
134
169
|
switch (declaration.mapping) {
|
|
135
170
|
case "unipolar":
|
|
@@ -11,6 +11,9 @@ export declare const EngineSettingsSchema: z.ZodObject<{
|
|
|
11
11
|
pauseOnLoopDisabled: z.ZodBoolean;
|
|
12
12
|
truncateNotesAtRegionEnd: z.ZodBoolean;
|
|
13
13
|
}, z.core.$strip>>;
|
|
14
|
+
debug: z.ZodDefault<z.ZodObject<{
|
|
15
|
+
dspLoadMeasurement: z.ZodBoolean;
|
|
16
|
+
}, z.core.$strip>>;
|
|
14
17
|
recording: z.ZodDefault<z.ZodObject<{
|
|
15
18
|
countInBars: z.ZodUnion<z.ZodLiteral<2 | 1 | 3 | 8 | 6 | 4 | 5 | 7>[]>;
|
|
16
19
|
allowTakes: z.ZodBoolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EnginePreferencesSchema.d.ts","sourceRoot":"","sources":["../../src/engine/EnginePreferencesSchema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAA;AAOrB,eAAO,MAAM,oBAAoB
|
|
1
|
+
{"version":3,"file":"EnginePreferencesSchema.d.ts","sourceRoot":"","sources":["../../src/engine/EnginePreferencesSchema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAA;AAOrB,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;iBAuC/B,CAAA;AAEF,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAA;AAEjE,yBAAiB,cAAc,CAAC;IACrB,MAAM,sBAAsB,uBAA0B,CAAA;IACtD,MAAM,oBAAoB,mCAAwB,CAAA;IAClD,MAAM,sBAAsB,2CAA0B,CAAA;IACtD,MAAM,qBAAqB,mCAAyB,CAAA;CAC9D"}
|
|
@@ -24,6 +24,11 @@ export const EngineSettingsSchema = z.object({
|
|
|
24
24
|
pauseOnLoopDisabled: false,
|
|
25
25
|
truncateNotesAtRegionEnd: false
|
|
26
26
|
}),
|
|
27
|
+
debug: z.object({
|
|
28
|
+
dspLoadMeasurement: z.boolean()
|
|
29
|
+
}).default({
|
|
30
|
+
dspLoadMeasurement: false
|
|
31
|
+
}),
|
|
27
32
|
recording: z.object({
|
|
28
33
|
countInBars: z.union(_RecordingCountInBars.map(value => z.literal(value))),
|
|
29
34
|
allowTakes: z.boolean(),
|
|
@@ -26,7 +26,7 @@ export var PresetDecoder;
|
|
|
26
26
|
}
|
|
27
27
|
const sourceBoxGraph = new BoxGraph(Option.wrap(BoxIO.create));
|
|
28
28
|
try {
|
|
29
|
-
sourceBoxGraph.fromArrayBuffer(bytes.slice(8));
|
|
29
|
+
sourceBoxGraph.fromArrayBuffer(bytes.slice(8), false);
|
|
30
30
|
}
|
|
31
31
|
catch (reason) {
|
|
32
32
|
RuntimeNotifier.info({
|
|
@@ -77,7 +77,7 @@ export var ProjectSkeleton;
|
|
|
77
77
|
const boxGraphChunk = new Int8Array(boxGraphChunkLength);
|
|
78
78
|
input.readBytes(boxGraphChunk);
|
|
79
79
|
const boxGraph = new BoxGraph(Option.wrap(BoxIO.create));
|
|
80
|
-
boxGraph.fromArrayBuffer(boxGraphChunk.buffer);
|
|
80
|
+
boxGraph.fromArrayBuffer(boxGraphChunk.buffer, false);
|
|
81
81
|
return { boxGraph, mandatoryBoxes: ProjectSkeleton.findMandatoryBoxes(boxGraph) };
|
|
82
82
|
};
|
|
83
83
|
ProjectSkeleton.findMandatoryBoxes = (boxGraph) => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@opendaw/studio-adapters",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.103",
|
|
4
4
|
"license": "LGPL-3.0-or-later",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -23,18 +23,18 @@
|
|
|
23
23
|
"test": "echo \"No tests to run\""
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@opendaw/lib-box": "^0.0.
|
|
27
|
-
"@opendaw/lib-dsp": "^0.0.
|
|
28
|
-
"@opendaw/lib-fusion": "^0.0.
|
|
29
|
-
"@opendaw/lib-runtime": "^0.0.
|
|
30
|
-
"@opendaw/lib-std": "^0.0.
|
|
31
|
-
"@opendaw/studio-boxes": "^0.0.
|
|
32
|
-
"@opendaw/studio-enums": "^0.0.
|
|
26
|
+
"@opendaw/lib-box": "^0.0.81",
|
|
27
|
+
"@opendaw/lib-dsp": "^0.0.80",
|
|
28
|
+
"@opendaw/lib-fusion": "^0.0.88",
|
|
29
|
+
"@opendaw/lib-runtime": "^0.0.76",
|
|
30
|
+
"@opendaw/lib-std": "^0.0.75",
|
|
31
|
+
"@opendaw/studio-boxes": "^0.0.86",
|
|
32
|
+
"@opendaw/studio-enums": "^0.0.71",
|
|
33
33
|
"soundfont2": "^0.5.0"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
36
|
"@opendaw/eslint-config": "^0.0.27",
|
|
37
37
|
"@opendaw/typescript-config": "^0.0.29"
|
|
38
38
|
},
|
|
39
|
-
"gitHead": "
|
|
39
|
+
"gitHead": "ff6efcb5332559bb0ba064be829ab0d18a6ba226"
|
|
40
40
|
}
|