@opendaw/studio-adapters 0.1.0 → 0.1.1
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.
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { int, Option } from "@opendaw/lib-std";
|
|
2
|
-
import { ppqn } from "@opendaw/lib-dsp";
|
|
2
|
+
import { AudioData, ppqn } from "@opendaw/lib-dsp";
|
|
3
|
+
import { EngineSettings } from "./engine/EnginePreferencesSchema";
|
|
3
4
|
export type ProcessorOptions = {};
|
|
4
5
|
export type EngineProcessorAttachment = {
|
|
5
6
|
syncStreamBuffer: SharedArrayBuffer;
|
|
@@ -21,12 +22,26 @@ export type ExportRange = "full" | {
|
|
|
21
22
|
start: ppqn;
|
|
22
23
|
end: ppqn;
|
|
23
24
|
};
|
|
25
|
+
export type ExportMetronomeConfiguration = {
|
|
26
|
+
includeInMixdown?: boolean;
|
|
27
|
+
stem?: {
|
|
28
|
+
fileName: string;
|
|
29
|
+
};
|
|
30
|
+
settings?: Partial<Omit<EngineSettings["metronome"], "enabled">>;
|
|
31
|
+
clickSounds?: {
|
|
32
|
+
downbeat?: AudioData;
|
|
33
|
+
beat?: AudioData;
|
|
34
|
+
};
|
|
35
|
+
};
|
|
24
36
|
export type ExportConfiguration = {
|
|
25
37
|
stems?: Record<string, ExportStemConfiguration>;
|
|
38
|
+
metronome?: ExportMetronomeConfiguration;
|
|
26
39
|
range?: ExportRange;
|
|
27
40
|
};
|
|
28
41
|
export declare namespace ExportConfiguration {
|
|
29
42
|
const countStems: (config: Option<ExportConfiguration>) => int;
|
|
43
|
+
const isMetronomeAudible: (config: Option<ExportConfiguration>) => boolean;
|
|
44
|
+
const stemFileNames: (config: ExportConfiguration) => ReadonlyArray<string>;
|
|
30
45
|
const sanitizeFileName: (name: string) => string;
|
|
31
46
|
const sanitizeExportNamesInPlace: (configuration: ExportConfiguration) => void;
|
|
32
47
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EngineProcessorAttachment.d.ts","sourceRoot":"","sources":["../src/EngineProcessorAttachment.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,GAAG,EAAa,MAAM,EAAC,MAAM,kBAAkB,CAAA;AACvD,OAAO,EAAC,IAAI,EAAC,MAAM,kBAAkB,CAAA;
|
|
1
|
+
{"version":3,"file":"EngineProcessorAttachment.d.ts","sourceRoot":"","sources":["../src/EngineProcessorAttachment.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,GAAG,EAAa,MAAM,EAAC,MAAM,kBAAkB,CAAA;AACvD,OAAO,EAAC,SAAS,EAAE,IAAI,EAAC,MAAM,kBAAkB,CAAA;AAChD,OAAO,EAAC,cAAc,EAAC,MAAM,kCAAkC,CAAA;AAE/D,MAAM,MAAM,gBAAgB,GAAG,EAAE,CAAA;AAGjC,MAAM,MAAM,yBAAyB,GAAG;IACpC,gBAAgB,EAAE,iBAAiB,CAAA;IACnC,kBAAkB,EAAE,iBAAiB,CAAA;IACrC,aAAa,EAAE,iBAAiB,CAAA;IAChC,OAAO,EAAE,eAAe,CAAA;IACxB,mBAAmB,CAAC,EAAE,mBAAmB,CAAA;IACzC,OAAO,CAAC,EAAE,gBAAgB,CAAA;IAC1B,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CACpC,CAAA;AAED,MAAM,MAAM,uBAAuB,GAAG;IAClC,mBAAmB,EAAE,OAAO,CAAA;IAC5B,YAAY,EAAE,OAAO,CAAA;IACrB,mBAAmB,EAAE,OAAO,CAAA;IAC5B,gBAAgB,CAAC,EAAE,OAAO,CAAA;IAC1B,QAAQ,EAAE,MAAM,CAAA;CACnB,CAAA;AAED,MAAM,MAAM,WAAW,GAAG,MAAM,GAAG;IAAE,KAAK,EAAE,IAAI,CAAC;IAAC,GAAG,EAAE,IAAI,CAAA;CAAE,CAAA;AAM7D,MAAM,MAAM,4BAA4B,GAAG;IAEvC,gBAAgB,CAAC,EAAE,OAAO,CAAA;IAE1B,IAAI,CAAC,EAAE;QAAE,QAAQ,EAAE,MAAM,CAAA;KAAE,CAAA;IAI3B,QAAQ,CAAC,EAAE,OAAO,CAAC,IAAI,CAAC,cAAc,CAAC,WAAW,CAAC,EAAE,SAAS,CAAC,CAAC,CAAA;IAOhE,WAAW,CAAC,EAAE;QAAE,QAAQ,CAAC,EAAE,SAAS,CAAC;QAAC,IAAI,CAAC,EAAE,SAAS,CAAA;KAAE,CAAA;CAC3D,CAAA;AAED,MAAM,MAAM,mBAAmB,GAAG;IAC9B,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,uBAAuB,CAAC,CAAA;IAC/C,SAAS,CAAC,EAAE,4BAA4B,CAAA;IACxC,KAAK,CAAC,EAAE,WAAW,CAAA;CACtB,CAAA;AAED,yBAAiB,mBAAmB,CAAC;IAG1B,MAAM,UAAU,GAAI,QAAQ,MAAM,CAAC,mBAAmB,CAAC,KAAG,GAM3D,CAAA;IAGC,MAAM,kBAAkB,GAAI,QAAQ,MAAM,CAAC,mBAAmB,CAAC,KAAG,OAMnE,CAAA;IAMC,MAAM,aAAa,GAAI,QAAQ,mBAAmB,KAAG,aAAa,CAAC,MAAM,CAK/E,CAAA;IAEM,MAAM,gBAAgB,GAAI,MAAM,MAAM,KAAG,MAA4D,CAAA;IAErG,MAAM,0BAA0B,GAAI,eAAe,mBAAmB,KAAG,IA0B/E,CAAA;CACJ"}
|
|
@@ -1,16 +1,40 @@
|
|
|
1
1
|
import { isDefined } from "@opendaw/lib-std";
|
|
2
2
|
export var ExportConfiguration;
|
|
3
3
|
(function (ExportConfiguration) {
|
|
4
|
+
// The number of STEREO PAIRS a render writes, which sizes `numberOfChannels` (pairs * 2). Without stems a
|
|
5
|
+
// render is a single mixdown pair and the metronome (if any) mixes INTO it rather than adding a pair.
|
|
4
6
|
ExportConfiguration.countStems = (config) => config.match({
|
|
5
7
|
none: () => 1,
|
|
6
|
-
some: cfg => isDefined(cfg.stems)
|
|
8
|
+
some: cfg => isDefined(cfg.stems)
|
|
9
|
+
? Object.keys(cfg.stems).length + (isDefined(cfg.metronome?.stem) ? 1 : 0)
|
|
10
|
+
: 1
|
|
7
11
|
});
|
|
12
|
+
// Whether the engine must render the metronome at all for this configuration.
|
|
13
|
+
ExportConfiguration.isMetronomeAudible = (config) => config.match({
|
|
14
|
+
none: () => false,
|
|
15
|
+
some: cfg => isDefined(cfg.stems)
|
|
16
|
+
? isDefined(cfg.metronome?.stem)
|
|
17
|
+
: cfg.metronome?.includeInMixdown === true
|
|
18
|
+
});
|
|
19
|
+
// The stem file names in CHANNEL ORDER: the unit stems in `stems` key order, then the metronome pair LAST.
|
|
20
|
+
// That is exactly the order the engine stages them in (`set_stem_export` writes the unit records, then
|
|
21
|
+
// `copy_stem_outputs` appends the metronome), and a writer maps channel pair i to name i. Derive the names
|
|
22
|
+
// from HERE rather than re-walking `stems`, which yields one name too few and writes `undefined.wav`.
|
|
23
|
+
ExportConfiguration.stemFileNames = (config) => {
|
|
24
|
+
const names = Object.values(config.stems ?? {}).map(({ fileName }) => fileName);
|
|
25
|
+
const metronomeStem = config.metronome?.stem;
|
|
26
|
+
if (isDefined(metronomeStem)) {
|
|
27
|
+
names.push(metronomeStem.fileName);
|
|
28
|
+
}
|
|
29
|
+
return names;
|
|
30
|
+
};
|
|
8
31
|
ExportConfiguration.sanitizeFileName = (name) => name.replace(/[<>:"/\\|?*\x00-\x1F]/g, "_").trim();
|
|
9
32
|
ExportConfiguration.sanitizeExportNamesInPlace = (configuration) => {
|
|
10
|
-
|
|
33
|
+
const metronomeStem = configuration.metronome?.stem;
|
|
34
|
+
if (!isDefined(configuration.stems) && !isDefined(metronomeStem)) {
|
|
11
35
|
return;
|
|
12
36
|
}
|
|
13
|
-
const stems = configuration.stems;
|
|
37
|
+
const stems = configuration.stems ?? {};
|
|
14
38
|
const sanitizedNames = new Map();
|
|
15
39
|
const getUniqueName = (baseName) => {
|
|
16
40
|
let count = sanitizedNames.get(baseName) ?? 0;
|
|
@@ -27,5 +51,11 @@ export var ExportConfiguration;
|
|
|
27
51
|
const entry = stems[key];
|
|
28
52
|
entry.fileName = getUniqueName(ExportConfiguration.sanitizeFileName(entry.fileName));
|
|
29
53
|
});
|
|
54
|
+
// The metronome shares the unit stems' namespace (they all land in one zip, where a duplicate name
|
|
55
|
+
// silently overwrites) and is sanitized LAST, matching its channel order, so a collision renames the
|
|
56
|
+
// click rather than a project stem.
|
|
57
|
+
if (isDefined(metronomeStem)) {
|
|
58
|
+
metronomeStem.fileName = getUniqueName(ExportConfiguration.sanitizeFileName(metronomeStem.fileName));
|
|
59
|
+
}
|
|
30
60
|
};
|
|
31
61
|
})(ExportConfiguration || (ExportConfiguration = {}));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@opendaw/studio-adapters",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"license": "LGPL-3.0-or-later",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -27,17 +27,17 @@
|
|
|
27
27
|
"dependencies": {
|
|
28
28
|
"@opendaw/lib-box": "^0.0.90",
|
|
29
29
|
"@opendaw/lib-dsp": "^0.0.88",
|
|
30
|
-
"@opendaw/lib-fusion": "^0.0.
|
|
30
|
+
"@opendaw/lib-fusion": "^0.0.99",
|
|
31
31
|
"@opendaw/lib-midi": "^0.0.70",
|
|
32
32
|
"@opendaw/lib-runtime": "^0.0.83",
|
|
33
33
|
"@opendaw/lib-std": "^0.0.82",
|
|
34
|
-
"@opendaw/studio-boxes": "^0.0.
|
|
35
|
-
"@opendaw/studio-enums": "^0.0.
|
|
34
|
+
"@opendaw/studio-boxes": "^0.0.99",
|
|
35
|
+
"@opendaw/studio-enums": "^0.0.82",
|
|
36
36
|
"soundfont2": "^0.5.0"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
39
|
"@opendaw/eslint-config": "^0.0.28",
|
|
40
40
|
"@opendaw/typescript-config": "^0.0.32"
|
|
41
41
|
},
|
|
42
|
-
"gitHead": "
|
|
42
|
+
"gitHead": "7c1920cfb1d90ae20f6c04e4ce61d3d0bf0678ae"
|
|
43
43
|
}
|