@opendaw/studio-adapters 0.0.83 → 0.0.85
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/MetaData.d.ts +10 -1
- package/dist/MetaData.d.ts.map +1 -1
- package/dist/MetaData.js +49 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -1
- package/dist/preset/PresetDecoder.d.ts.map +1 -1
- package/dist/preset/PresetDecoder.js +16 -3
- package/dist/preset/PresetEncoder.d.ts.map +1 -1
- package/dist/preset/PresetEncoder.js +16 -6
- package/dist/protocols.d.ts +5 -0
- package/dist/protocols.d.ts.map +1 -1
- package/dist/transfer/TransferAudioUnits.d.ts +15 -0
- package/dist/transfer/TransferAudioUnits.d.ts.map +1 -0
- package/dist/transfer/TransferAudioUnits.js +26 -0
- package/dist/transfer/TransferRegions.d.ts +12 -0
- package/dist/transfer/TransferRegions.d.ts.map +1 -0
- package/dist/transfer/TransferRegions.js +81 -0
- package/dist/transfer/TransferUtils.d.ts +19 -0
- package/dist/transfer/TransferUtils.d.ts.map +1 -0
- package/dist/{project/ProjectUtils.js → transfer/TransferUtils.js} +67 -100
- package/dist/transfer/index.d.ts +4 -0
- package/dist/transfer/index.d.ts.map +1 -0
- package/dist/transfer/index.js +3 -0
- package/package.json +10 -10
- package/dist/project/ProjectUtils.d.ts +0 -13
- package/dist/project/ProjectUtils.d.ts.map +0 -1
package/dist/MetaData.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Box } from "@opendaw/lib-box";
|
|
2
2
|
import { Pointers } from "@opendaw/studio-enums";
|
|
3
|
-
import { JSONValue, Nullable } from "@opendaw/lib-std";
|
|
3
|
+
import { JSONValue, Nullable, Observer, Option, Terminable } from "@opendaw/lib-std";
|
|
4
4
|
export declare namespace MetaData {
|
|
5
5
|
/**
|
|
6
6
|
* Stores the given JSONValue in the target box under the given origin.
|
|
@@ -24,5 +24,14 @@ export declare namespace MetaData {
|
|
|
24
24
|
* @param origin The origin of the meta-data. Must be unique to the app.
|
|
25
25
|
*/
|
|
26
26
|
const clear: (target: Box<Pointers.MetaData>, origin: string) => void;
|
|
27
|
+
/**
|
|
28
|
+
* Subscribes to meta-data changes on the target box for the given origin.
|
|
29
|
+
* Catches up with existing meta-data and subscribes to future additions/removals.
|
|
30
|
+
* The observer receives the parsed JSONValue or null when cleared.
|
|
31
|
+
* @param target The box to observe meta-data on.
|
|
32
|
+
* @param origin The origin of the meta-data. Must be unique to the app.
|
|
33
|
+
* @param observer Called with the current value whenever it changes, or null when removed.
|
|
34
|
+
*/
|
|
35
|
+
const catchupAndSubscribeMessage: (target: Box<Pointers.MetaData>, origin: string, observer: Observer<Option<JSONValue>>) => Terminable;
|
|
27
36
|
}
|
|
28
37
|
//# sourceMappingURL=MetaData.d.ts.map
|
package/dist/MetaData.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MetaData.d.ts","sourceRoot":"","sources":["../src/MetaData.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,GAAG,
|
|
1
|
+
{"version":3,"file":"MetaData.d.ts","sourceRoot":"","sources":["../src/MetaData.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,GAAG,EAAe,MAAM,kBAAkB,CAAA;AAClD,OAAO,EAAC,QAAQ,EAAC,MAAM,uBAAuB,CAAA;AAC9C,OAAO,EAEH,SAAS,EACT,QAAQ,EACR,QAAQ,EACR,MAAM,EAGN,UAAU,EAGb,MAAM,kBAAkB,CAAA;AAGzB,yBAAiB,QAAQ,CAAC;IACtB;;;;;;OAMG;IACI,MAAM,KAAK,GAAI,QAAQ,GAAG,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE,OAAO,SAAS,EAAE,QAAQ,MAAM,KAAG,IAgBxF,CAAA;IAED;;;;;OAKG;IACI,MAAM,IAAI,GAAI,QAAQ,GAAG,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE,QAAQ,MAAM,KAAG,QAAQ,CAAC,SAAS,CAYvF,CAAA;IAED;;;;;OAKG;IACI,MAAM,KAAK,GAAI,QAAQ,GAAG,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE,QAAQ,MAAM,KAAG,IAOtE,CAAA;IAED;;;;;;;OAOG;IACI,MAAM,0BAA0B,GAAI,QAAQ,GAAG,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAC9B,QAAQ,MAAM,EACd,UAAU,QAAQ,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,KAAG,UAgClF,CAAA;CACJ"}
|
package/dist/MetaData.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Pointers } from "@opendaw/studio-enums";
|
|
2
|
-
import { isNotUndefined, panic, tryCatch, UUID } from "@opendaw/lib-std";
|
|
2
|
+
import { isNotUndefined, Option, panic, tryCatch, UUID } from "@opendaw/lib-std";
|
|
3
3
|
import { MetaDataBox } from "@opendaw/studio-boxes";
|
|
4
4
|
export var MetaData;
|
|
5
5
|
(function (MetaData) {
|
|
@@ -69,4 +69,52 @@ export var MetaData;
|
|
|
69
69
|
.filter((box) => box instanceof MetaDataBox && box.origin.getValue() === origin)
|
|
70
70
|
.forEach(box => box.delete());
|
|
71
71
|
};
|
|
72
|
+
/**
|
|
73
|
+
* Subscribes to meta-data changes on the target box for the given origin.
|
|
74
|
+
* Catches up with existing meta-data and subscribes to future additions/removals.
|
|
75
|
+
* The observer receives the parsed JSONValue or null when cleared.
|
|
76
|
+
* @param target The box to observe meta-data on.
|
|
77
|
+
* @param origin The origin of the meta-data. Must be unique to the app.
|
|
78
|
+
* @param observer Called with the current value whenever it changes, or null when removed.
|
|
79
|
+
*/
|
|
80
|
+
MetaData.catchupAndSubscribeMessage = (target, origin, observer) => {
|
|
81
|
+
if (origin === "") {
|
|
82
|
+
return panic("MetaData.catchupAndSubscribeMessage: origin must be unique to your app.");
|
|
83
|
+
}
|
|
84
|
+
const subscriptions = UUID.newSet(entry => entry.uuid);
|
|
85
|
+
const notifyValue = (metaDataBox) => {
|
|
86
|
+
const { status, value, error } = tryCatch(() => JSON.parse(metaDataBox.value.getValue()));
|
|
87
|
+
if (status === "success") {
|
|
88
|
+
observer(Option.wrap(value));
|
|
89
|
+
}
|
|
90
|
+
else {
|
|
91
|
+
console.warn(error);
|
|
92
|
+
observer(Option.None);
|
|
93
|
+
}
|
|
94
|
+
};
|
|
95
|
+
const pointerHubSubscription = target.pointerHub.catchupAndSubscribe({
|
|
96
|
+
onAdded: ({ box }) => {
|
|
97
|
+
if (!(box instanceof MetaDataBox) || box.origin.getValue() !== origin) {
|
|
98
|
+
return;
|
|
99
|
+
}
|
|
100
|
+
const subscription = box.value.catchupAndSubscribe(() => notifyValue(box));
|
|
101
|
+
subscriptions.add({ uuid: box.address.uuid, subscription });
|
|
102
|
+
},
|
|
103
|
+
onRemoved: ({ box }) => {
|
|
104
|
+
if (!(box instanceof MetaDataBox) || box.origin.getValue() !== origin) {
|
|
105
|
+
return;
|
|
106
|
+
}
|
|
107
|
+
const entry = subscriptions.removeByKey(box.address.uuid);
|
|
108
|
+
entry.subscription.terminate();
|
|
109
|
+
observer(Option.None);
|
|
110
|
+
}
|
|
111
|
+
}, Pointers.MetaData);
|
|
112
|
+
return {
|
|
113
|
+
terminate: () => {
|
|
114
|
+
pointerHubSubscription.terminate();
|
|
115
|
+
subscriptions.forEach(({ subscription }) => subscription.terminate());
|
|
116
|
+
subscriptions.clear();
|
|
117
|
+
}
|
|
118
|
+
};
|
|
119
|
+
};
|
|
72
120
|
})(MetaData || (MetaData = {}));
|
package/dist/index.d.ts
CHANGED
|
@@ -110,7 +110,6 @@ export * from "./preset/PresetHeader";
|
|
|
110
110
|
export * from "./project/ProjectMandatoryBoxes";
|
|
111
111
|
export * from "./project/ProjectQueries";
|
|
112
112
|
export * from "./project/ProjectSkeleton";
|
|
113
|
-
export * from "./project/ProjectUtils";
|
|
114
113
|
export * from "./protocols";
|
|
115
114
|
export * from "./sample/Sample";
|
|
116
115
|
export * from "./sample/SampleLoader";
|
|
@@ -155,6 +154,9 @@ export * from "./timeline/region/FadingAdapter";
|
|
|
155
154
|
export * from "./timeline/region/MutableRegion";
|
|
156
155
|
export * from "./timeline/region/NoteRegionBoxAdapter";
|
|
157
156
|
export * from "./timeline/region/ValueRegionBoxAdapter";
|
|
157
|
+
export * from "./transfer/TransferAudioUnits";
|
|
158
|
+
export * from "./transfer/TransferRegions";
|
|
159
|
+
export * from "./transfer/TransferUtils";
|
|
158
160
|
export * from "./unions";
|
|
159
161
|
export type { Preferences, PreferencesProtocol } from "@opendaw/lib-fusion";
|
|
160
162
|
export { PreferencesClient, PreferencesFacade, PreferencesHost } from "@opendaw/lib-fusion";
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA,cAAc,oCAAoC,CAAA;AAClD,cAAc,cAAc,CAAA;AAC5B,cAAc,wBAAwB,CAAA;AACtC,cAAc,eAAe,CAAA;AAC7B,cAAc,sBAAsB,CAAA;AACpC,cAAc,cAAc,CAAA;AAC5B,cAAc,qBAAqB,CAAA;AACnC,cAAc,kBAAkB,CAAA;AAChC,cAAc,iBAAiB,CAAA;AAC/B,cAAc,aAAa,CAAA;AAC3B,cAAc,oBAAoB,CAAA;AAClC,cAAc,mBAAmB,CAAA;AACjC,cAAc,6BAA6B,CAAA;AAC3C,cAAc,qBAAqB,CAAA;AACnC,cAAc,gBAAgB,CAAA;AAC9B,cAAc,mBAAmB,CAAA;AACjC,cAAc,+BAA+B,CAAA;AAC7C,cAAc,4BAA4B,CAAA;AAC1C,cAAc,YAAY,CAAA;AAC1B,cAAc,mBAAmB,CAAA;AACjC,cAAc,iBAAiB,CAAA;AAC/B,cAAc,cAAc,CAAA;AAC5B,cAAc,sBAAsB,CAAA;AACpC,cAAc,uBAAuB,CAAA;AACrC,cAAc,0BAA0B,CA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AA4B,CAAA;AAC1C,cAAc,uBAAuB,CAAA;AACrC,cAAc,yBAAyB,CAAA;AACvC,cAAc,sBAAsB,CAAA;AACpC,cAAc,qCAAqC,CAAA;AACnD,cAAc,oCAAoC,CAAA;AAClD,cAAc,qCAAqC,CAAA;AACnD,cAAc,qDAAqD,CAAA;AACnE,cAAc,sDAAsD,CAAA;AACpE,cAAc,4CAA4C,CAAA;AAC1D,cAAc,sCAAsC,CAAA;AACpD,cAAc,uCAAuC,CAAA;AACrD,cAAc,uCAAuC,CAAA;AACrD,cAAc,yCAAyC,CAAA;AACvD,cAAc,iCAAiC,CAAA;AAC/C,cAAc,iCAAiC,CAAA;AAC/C,cAAc,wCAAwC,CAAA;AACtD,cAAc,yCAAyC,CAAA;AACvD,cAAc,+BAA+B,CAAA;AAC7C,cAAc,4BAA4B,CAAA;AAC1C,cAAc,0BAA0B,CAAA;AACxC,cAAc,UAAU,CAAA;AACxB,YAAY,EAAC,WAAW,EAAE,mBAAmB,EAAC,MAAM,qBAAqB,CAAA;AACzE,OAAO,EAAC,iBAAiB,EAAE,iBAAiB,EAAE,eAAe,EAAC,MAAM,qBAAqB,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -112,7 +112,6 @@ export * from "./preset/PresetHeader";
|
|
|
112
112
|
export * from "./project/ProjectMandatoryBoxes";
|
|
113
113
|
export * from "./project/ProjectQueries";
|
|
114
114
|
export * from "./project/ProjectSkeleton";
|
|
115
|
-
export * from "./project/ProjectUtils";
|
|
116
115
|
export * from "./protocols";
|
|
117
116
|
export * from "./sample/Sample";
|
|
118
117
|
export * from "./sample/SampleLoader";
|
|
@@ -157,5 +156,8 @@ export * from "./timeline/region/FadingAdapter";
|
|
|
157
156
|
export * from "./timeline/region/MutableRegion";
|
|
158
157
|
export * from "./timeline/region/NoteRegionBoxAdapter";
|
|
159
158
|
export * from "./timeline/region/ValueRegionBoxAdapter";
|
|
159
|
+
export * from "./transfer/TransferAudioUnits";
|
|
160
|
+
export * from "./transfer/TransferRegions";
|
|
161
|
+
export * from "./transfer/TransferUtils";
|
|
160
162
|
export * from "./unions";
|
|
161
163
|
export { PreferencesClient, PreferencesFacade, PreferencesHost } from "@opendaw/lib-fusion";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PresetDecoder.d.ts","sourceRoot":"","sources":["../../src/preset/PresetDecoder.ts"],"names":[],"mappings":"AAAA,OAAO,EAGH,OAAO,EASV,MAAM,kBAAkB,CAAA;AAGzB,OAAO,EAEH,YAAY,EAOf,MAAM,uBAAuB,CAAA;AAC9B,OAAO,EAAC,eAAe,EAAC,MAAM,4BAA4B,CAAA;AAK1D,yBAAiB,aAAa,CAAC;IACpB,MAAM,MAAM,GAAI,OAAO,eAAe,EAAE,QAAQ,eAAe,
|
|
1
|
+
{"version":3,"file":"PresetDecoder.d.ts","sourceRoot":"","sources":["../../src/preset/PresetDecoder.ts"],"names":[],"mappings":"AAAA,OAAO,EAGH,OAAO,EASV,MAAM,kBAAkB,CAAA;AAGzB,OAAO,EAEH,YAAY,EAOf,MAAM,uBAAuB,CAAA;AAC9B,OAAO,EAAC,eAAe,EAAC,MAAM,4BAA4B,CAAA;AAK1D,yBAAiB,aAAa,CAAC;IACpB,MAAM,MAAM,GAAI,OAAO,eAAe,EAAE,QAAQ,eAAe,SAoErE,CAAA;IAEM,MAAM,gBAAgB,GAAI,aAAa,WAAW,EAAE,oBAAoB,YAAY,EAAE,UAAU;QACnG,eAAe,CAAC,EAAE,OAAO,CAAA;QACzB,gBAAgB,CAAC,EAAE,OAAO,CAAA;KAC7B,KAAG,OAAO,CAAC,IAAI,EAAE,MAAM,CAyGvB,CAAA;CACJ"}
|
|
@@ -3,9 +3,9 @@ import { BoxGraph, PointerField } from "@opendaw/lib-box";
|
|
|
3
3
|
import { AudioUnitType } from "@opendaw/studio-enums";
|
|
4
4
|
import { AudioFileBox, AudioUnitBox, BoxIO, CaptureAudioBox, CaptureMidiBox, SoundfontFileBox, TrackBox } from "@opendaw/studio-boxes";
|
|
5
5
|
import { ProjectSkeleton } from "../project/ProjectSkeleton";
|
|
6
|
-
import {
|
|
7
|
-
import { TrackType } from "../timeline/TrackType";
|
|
6
|
+
import { TransferUtils } from "../transfer";
|
|
8
7
|
import { PresetHeader } from "./PresetHeader";
|
|
8
|
+
import { TrackType } from "../timeline/TrackType";
|
|
9
9
|
export var PresetDecoder;
|
|
10
10
|
(function (PresetDecoder) {
|
|
11
11
|
PresetDecoder.decode = (bytes, target) => {
|
|
@@ -38,7 +38,20 @@ export var PresetDecoder;
|
|
|
38
38
|
const sourceAudioUnitBoxes = sourceBoxGraph.boxes()
|
|
39
39
|
.filter(box => isInstanceOf(box, AudioUnitBox))
|
|
40
40
|
.filter(box => box.type.getValue() !== AudioUnitType.Output);
|
|
41
|
-
|
|
41
|
+
const excludeBox = (box) => TransferUtils.shouldExclude(box) || TransferUtils.excludeTimelinePredicate(box);
|
|
42
|
+
const dependencies = Array.from(sourceBoxGraph.dependenciesOf(sourceAudioUnitBoxes, {
|
|
43
|
+
alwaysFollowMandatory: true,
|
|
44
|
+
stopAtResources: true,
|
|
45
|
+
excludeBox
|
|
46
|
+
}).boxes);
|
|
47
|
+
const { mandatoryBoxes: { rootBox, primaryAudioBus } } = target;
|
|
48
|
+
const uuidMap = TransferUtils.generateMap(sourceAudioUnitBoxes, dependencies, rootBox.audioUnits.address.uuid, primaryAudioBus.address.uuid);
|
|
49
|
+
TransferUtils.copyBoxes(uuidMap, target.boxGraph, sourceAudioUnitBoxes, dependencies);
|
|
50
|
+
TransferUtils.reorderAudioUnits(uuidMap, sourceAudioUnitBoxes, rootBox);
|
|
51
|
+
sourceAudioUnitBoxes
|
|
52
|
+
.map(source => asInstanceOf(rootBox.graph
|
|
53
|
+
.findBox(uuidMap.get(source.address.uuid).target)
|
|
54
|
+
.unwrap("Target AudioUnit has not been copied"), AudioUnitBox))
|
|
42
55
|
.filter(box => box.type.getValue() !== AudioUnitType.Output)
|
|
43
56
|
.forEach((audioUnitBox) => {
|
|
44
57
|
const inputBox = audioUnitBox.input.pointerHub.incoming().at(0)?.box;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PresetEncoder.d.ts","sourceRoot":"","sources":["../../src/preset/PresetEncoder.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"PresetEncoder.d.ts","sourceRoot":"","sources":["../../src/preset/PresetEncoder.ts"],"names":[],"mappings":"AAEA,OAAO,EAAC,YAAY,EAAC,MAAM,uBAAuB,CAAA;AAKlD,yBAAiB,aAAa,CAAC;IACpB,MAAM,MAAM,GAAI,cAAc,YAAY,KAAG,eAuBnD,CAAA;CACJ"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Arrays, ByteArrayOutput } from "@opendaw/lib-std";
|
|
2
2
|
import { ProjectSkeleton } from "../project/ProjectSkeleton";
|
|
3
|
-
import {
|
|
3
|
+
import { TransferUtils } from "../transfer";
|
|
4
4
|
import { PresetHeader } from "./PresetHeader";
|
|
5
5
|
export var PresetEncoder;
|
|
6
6
|
(function (PresetEncoder) {
|
|
@@ -9,11 +9,21 @@ export var PresetEncoder;
|
|
|
9
9
|
header.writeInt(PresetHeader.MAGIC_HEADER_OPEN);
|
|
10
10
|
header.writeInt(PresetHeader.FORMAT_VERSION);
|
|
11
11
|
const preset = ProjectSkeleton.empty({ createOutputCompressor: false, createDefaultUser: false });
|
|
12
|
-
preset
|
|
13
|
-
|
|
14
|
-
|
|
12
|
+
const { boxGraph, mandatoryBoxes: { rootBox, primaryAudioBus } } = preset;
|
|
13
|
+
const audioUnitBoxes = [audioUnitBox];
|
|
14
|
+
const excludeBox = (box) => TransferUtils.shouldExclude(box) || TransferUtils.excludeTimelinePredicate(box);
|
|
15
|
+
boxGraph.beginTransaction();
|
|
16
|
+
const dependencies = Array.from(audioUnitBox.graph.dependenciesOf(audioUnitBoxes, {
|
|
17
|
+
alwaysFollowMandatory: true,
|
|
18
|
+
stopAtResources: true,
|
|
19
|
+
excludeBox
|
|
20
|
+
}).boxes);
|
|
21
|
+
const uuidMap = TransferUtils.generateMap(audioUnitBoxes, dependencies, rootBox.audioUnits.address.uuid, primaryAudioBus.address.uuid);
|
|
22
|
+
TransferUtils.copyBoxes(uuidMap, boxGraph, audioUnitBoxes, dependencies);
|
|
23
|
+
TransferUtils.reorderAudioUnits(uuidMap, audioUnitBoxes, rootBox);
|
|
24
|
+
boxGraph.endTransaction();
|
|
15
25
|
console.debug("SAVING...");
|
|
16
|
-
|
|
17
|
-
return Arrays.concatArrayBuffers(header.toArrayBuffer(),
|
|
26
|
+
boxGraph.debugBoxes();
|
|
27
|
+
return Arrays.concatArrayBuffers(header.toArrayBuffer(), boxGraph.toArrayBuffer());
|
|
18
28
|
};
|
|
19
29
|
})(PresetEncoder || (PresetEncoder = {}));
|
package/dist/protocols.d.ts
CHANGED
|
@@ -11,16 +11,21 @@ export interface EngineCommands extends Terminable {
|
|
|
11
11
|
play(): void;
|
|
12
12
|
stop(reset: boolean): void;
|
|
13
13
|
setPosition(position: ppqn): void;
|
|
14
|
+
/** @internal */
|
|
14
15
|
prepareRecordingState(countIn: boolean): void;
|
|
16
|
+
/** @internal */
|
|
15
17
|
stopRecording(): void;
|
|
16
18
|
queryLoadingComplete(): Promise<boolean>;
|
|
17
19
|
panic(): void;
|
|
18
20
|
noteSignal(signal: NoteSignal): void;
|
|
21
|
+
/** @internal */
|
|
19
22
|
ignoreNoteRegion(uuid: UUID.Bytes): void;
|
|
20
23
|
scheduleClipPlay(clipIds: ReadonlyArray<UUID.Bytes>): void;
|
|
21
24
|
scheduleClipStop(trackIds: ReadonlyArray<UUID.Bytes>): void;
|
|
25
|
+
/** @internal */
|
|
22
26
|
setupMIDI(port: MessagePort, buffer: SharedArrayBuffer): void;
|
|
23
27
|
loadClickSound(index: 0 | 1, data: AudioData): void;
|
|
28
|
+
/** @internal */
|
|
24
29
|
updateMonitoringMap(map: ReadonlyArray<MonitoringMapEntry>): void;
|
|
25
30
|
}
|
|
26
31
|
export interface EngineToClient {
|
package/dist/protocols.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"protocols.d.ts","sourceRoot":"","sources":["../src/protocols.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,GAAG,EAAE,QAAQ,EAAE,UAAU,EAAE,IAAI,EAAC,MAAM,kBAAkB,CAAA;AAChE,OAAO,EAAC,SAAS,EAAE,IAAI,EAAC,MAAM,kBAAkB,CAAA;AAChD,OAAO,EAAC,qBAAqB,EAAC,MAAM,qBAAqB,CAAA;AACzD,OAAO,EAAC,UAAU,EAAC,MAAM,cAAc,CAAA;AACvC,OAAO,KAAK,EAAC,UAAU,EAAC,MAAM,YAAY,CAAA;AAE1C,MAAM,MAAM,kBAAkB,GAAG;IAAE,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC;IAAC,QAAQ,EAAE,aAAa,CAAC,GAAG,CAAC,CAAA;CAAE,CAAA;AAEnF,MAAM,WAAW,cAAe,SAAQ,UAAU;IAC9C,IAAI,IAAI,IAAI,CAAA;IACZ,IAAI,CAAC,KAAK,EAAE,OAAO,GAAG,IAAI,CAAA;IAC1B,WAAW,CAAC,QAAQ,EAAE,IAAI,GAAG,IAAI,CAAA;IACjC,qBAAqB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAAA;IAC7C,aAAa,IAAI,IAAI,CAAA;IACrB,oBAAoB,IAAI,OAAO,CAAC,OAAO,CAAC,CAAA;IAExC,KAAK,IAAI,IAAI,CAAA;
|
|
1
|
+
{"version":3,"file":"protocols.d.ts","sourceRoot":"","sources":["../src/protocols.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,GAAG,EAAE,QAAQ,EAAE,UAAU,EAAE,IAAI,EAAC,MAAM,kBAAkB,CAAA;AAChE,OAAO,EAAC,SAAS,EAAE,IAAI,EAAC,MAAM,kBAAkB,CAAA;AAChD,OAAO,EAAC,qBAAqB,EAAC,MAAM,qBAAqB,CAAA;AACzD,OAAO,EAAC,UAAU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,OAAO,EAAE,MAAM,GAAG,IAAI,CAAA;IAC1B,KAAK,CAAC,MAAM,EAAE,OAAO,GAAG,IAAI,CAAA;IAC5B,UAAU,CAAC,IAAI,EAAE,IAAI,CAAC,KAAK,GAAG,OAAO,CAAC,SAAS,CAAC,CAAA;IAChD,cAAc,CAAC,IAAI,EAAE,IAAI,CAAC,KAAK,GAAG,OAAO,CAAC,UAAU,CAAC,CAAA;IACrD,YAAY,IAAI,OAAO,CAAC,WAAW,CAAC,CAAA;IACpC,yBAAyB,CAAC,OAAO,EAAE,qBAAqB,GAAG,IAAI,CAAA;IAC/D,iBAAiB,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC,IAAI,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC,GAAG,IAAI,CAAA;IAC3D,KAAK,IAAI,IAAI,CAAA;CAChB"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { AudioUnitBox } from "@opendaw/studio-boxes";
|
|
2
|
+
import { ProjectSkeleton } from "../project/ProjectSkeleton";
|
|
3
|
+
export declare namespace TransferAudioUnits {
|
|
4
|
+
/**
|
|
5
|
+
* Copies audio units and their dependencies to a target project.
|
|
6
|
+
* Preserved resources already present in the target graph are shared, not duplicated.
|
|
7
|
+
* @returns the newly created audio unit boxes in the target graph
|
|
8
|
+
*/
|
|
9
|
+
const transfer: (audioUnitBoxes: ReadonlyArray<AudioUnitBox>, { boxGraph: targetBoxGraph, mandatoryBoxes: { primaryAudioBus, rootBox } }: ProjectSkeleton, options?: {
|
|
10
|
+
includeAux?: boolean;
|
|
11
|
+
includeBus?: boolean;
|
|
12
|
+
excludeTimeline?: boolean;
|
|
13
|
+
}) => ReadonlyArray<AudioUnitBox>;
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=TransferAudioUnits.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TransferAudioUnits.d.ts","sourceRoot":"","sources":["../../src/transfer/TransferAudioUnits.ts"],"names":[],"mappings":"AAEA,OAAO,EAAC,YAAY,EAAC,MAAM,uBAAuB,CAAA;AAClD,OAAO,EAAC,eAAe,EAAC,MAAM,4BAA4B,CAAA;AAG1D,yBAAiB,kBAAkB,CAAC;IAChC;;;;OAIG;IACI,MAAM,QAAQ,GAAI,gBAAgB,aAAa,CAAC,YAAY,CAAC,EAC3C,4EAAwE,eAAe,EACvF,UAAS;QACL,UAAU,CAAC,EAAE,OAAO,CAAC;QACrB,UAAU,CAAC,EAAE,OAAO,CAAC;QACrB,eAAe,CAAC,EAAE,OAAO,CAAC;KACxB,KAAG,aAAa,CAAC,YAAY,CAgB3D,CAAA;CACJ"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { asInstanceOf } from "@opendaw/lib-std";
|
|
2
|
+
import { AudioUnitBox } from "@opendaw/studio-boxes";
|
|
3
|
+
import { TransferUtils } from "./TransferUtils";
|
|
4
|
+
export var TransferAudioUnits;
|
|
5
|
+
(function (TransferAudioUnits) {
|
|
6
|
+
/**
|
|
7
|
+
* Copies audio units and their dependencies to a target project.
|
|
8
|
+
* Preserved resources already present in the target graph are shared, not duplicated.
|
|
9
|
+
* @returns the newly created audio unit boxes in the target graph
|
|
10
|
+
*/
|
|
11
|
+
TransferAudioUnits.transfer = (audioUnitBoxes, { boxGraph: targetBoxGraph, mandatoryBoxes: { primaryAudioBus, rootBox } }, options = {}) => {
|
|
12
|
+
const excludeBox = (box) => TransferUtils.shouldExclude(box)
|
|
13
|
+
|| (options?.excludeTimeline === true && TransferUtils.excludeTimelinePredicate(box));
|
|
14
|
+
const dependencies = Array.from(audioUnitBoxes[0].graph.dependenciesOf(audioUnitBoxes, {
|
|
15
|
+
alwaysFollowMandatory: true,
|
|
16
|
+
stopAtResources: true,
|
|
17
|
+
excludeBox
|
|
18
|
+
}).boxes);
|
|
19
|
+
const uuidMap = TransferUtils.generateMap(audioUnitBoxes, dependencies, rootBox.audioUnits.address.uuid, primaryAudioBus.address.uuid);
|
|
20
|
+
TransferUtils.copyBoxes(uuidMap, targetBoxGraph, audioUnitBoxes, dependencies);
|
|
21
|
+
TransferUtils.reorderAudioUnits(uuidMap, audioUnitBoxes, rootBox);
|
|
22
|
+
return audioUnitBoxes.map(source => asInstanceOf(rootBox.graph
|
|
23
|
+
.findBox(uuidMap.get(source.address.uuid).target)
|
|
24
|
+
.unwrap("Target AudioUnit has not been copied"), AudioUnitBox));
|
|
25
|
+
};
|
|
26
|
+
})(TransferAudioUnits || (TransferAudioUnits = {}));
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ppqn } from "@opendaw/lib-dsp";
|
|
2
|
+
import { TrackBox } from "@opendaw/studio-boxes";
|
|
3
|
+
import { AnyRegionBox } from "../unions";
|
|
4
|
+
export declare namespace TransferRegions {
|
|
5
|
+
/**
|
|
6
|
+
* Copies a region and its dependencies to a target track, works across BoxGraphs.
|
|
7
|
+
* Preserved resources already present in the target graph are shared, not duplicated.
|
|
8
|
+
* @returns the newly created region box in the target graph
|
|
9
|
+
*/
|
|
10
|
+
const transfer: (region: AnyRegionBox, targetTrack: TrackBox, insertPosition: ppqn, deleteSource?: boolean) => AnyRegionBox;
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=TransferRegions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TransferRegions.d.ts","sourceRoot":"","sources":["../../src/transfer/TransferRegions.ts"],"names":[],"mappings":"AAEA,OAAO,EAAC,IAAI,EAAC,MAAM,kBAAkB,CAAA;AAErC,OAAO,EAAQ,QAAQ,EAAC,MAAM,uBAAuB,CAAA;AACrD,OAAO,EAAC,YAAY,EAAgB,MAAM,WAAW,CAAA;AAErD,yBAAiB,eAAe,CAAC;IAC7B;;;;OAIG;IACI,MAAM,QAAQ,GAAI,QAAQ,YAAY,EACpB,aAAa,QAAQ,EACrB,gBAAgB,IAAI,EACpB,eAAc,OAAc,KAAG,YA6DvD,CAAA;CACJ"}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { asDefined, ByteArrayInput, Option, UUID } from "@opendaw/lib-std";
|
|
2
|
+
import { PointerField } from "@opendaw/lib-box";
|
|
3
|
+
import { Pointers } from "@opendaw/studio-enums";
|
|
4
|
+
import { UnionBoxTypes } from "../unions";
|
|
5
|
+
export var TransferRegions;
|
|
6
|
+
(function (TransferRegions) {
|
|
7
|
+
/**
|
|
8
|
+
* Copies a region and its dependencies to a target track, works across BoxGraphs.
|
|
9
|
+
* Preserved resources already present in the target graph are shared, not duplicated.
|
|
10
|
+
* @returns the newly created region box in the target graph
|
|
11
|
+
*/
|
|
12
|
+
TransferRegions.transfer = (region, targetTrack, insertPosition, deleteSource = true) => {
|
|
13
|
+
const targetGraph = targetTrack.graph;
|
|
14
|
+
const uniqueBoxes = UUID.newSet(box => box.address.uuid);
|
|
15
|
+
uniqueBoxes.add(region);
|
|
16
|
+
for (const dependency of region.graph.dependenciesOf(region, {
|
|
17
|
+
alwaysFollowMandatory: true,
|
|
18
|
+
stopAtResources: true,
|
|
19
|
+
excludeBox: (dep) => dep.ephemeral
|
|
20
|
+
}).boxes) {
|
|
21
|
+
uniqueBoxes.add(dependency);
|
|
22
|
+
}
|
|
23
|
+
const skippedPreservedUuids = UUID.newSet(uuid => uuid);
|
|
24
|
+
uniqueBoxes.forEach(box => {
|
|
25
|
+
if (box.resource === "preserved" && targetGraph.findBox(box.address.uuid).nonEmpty()) {
|
|
26
|
+
skippedPreservedUuids.add(box.address.uuid);
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
const shouldSkipBox = (box) => {
|
|
30
|
+
if (box.resource === "preserved" && skippedPreservedUuids.hasKey(box.address.uuid)) {
|
|
31
|
+
return true;
|
|
32
|
+
}
|
|
33
|
+
for (const [, targetAddress] of box.outgoingEdges()) {
|
|
34
|
+
if (skippedPreservedUuids.hasKey(targetAddress.uuid) && !targetAddress.isBox()) {
|
|
35
|
+
return true;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
return false;
|
|
39
|
+
};
|
|
40
|
+
const sourceBoxes = uniqueBoxes.values().filter(box => !shouldSkipBox(box));
|
|
41
|
+
const uuidMap = UUID.newSet(entry => entry.source);
|
|
42
|
+
sourceBoxes.forEach(box => {
|
|
43
|
+
uuidMap.add({
|
|
44
|
+
source: box.address.uuid,
|
|
45
|
+
target: box.resource === "preserved" ? box.address.uuid : UUID.generate()
|
|
46
|
+
});
|
|
47
|
+
});
|
|
48
|
+
skippedPreservedUuids.forEach(uuid => uuidMap.add({ source: uuid, target: uuid }));
|
|
49
|
+
let result = null;
|
|
50
|
+
PointerField.decodeWith({
|
|
51
|
+
map: (pointer, address) => {
|
|
52
|
+
const remapped = address.flatMap(addr => uuidMap.opt(addr.uuid).map(entry => addr.moveTo(entry.target)));
|
|
53
|
+
if (remapped.nonEmpty()) {
|
|
54
|
+
return remapped;
|
|
55
|
+
}
|
|
56
|
+
if (pointer.pointerType === Pointers.RegionCollection) {
|
|
57
|
+
return Option.wrap(targetTrack.regions.address);
|
|
58
|
+
}
|
|
59
|
+
if (pointer.pointerType === Pointers.ClipCollection) {
|
|
60
|
+
return Option.wrap(targetTrack.clips.address);
|
|
61
|
+
}
|
|
62
|
+
return Option.None;
|
|
63
|
+
}
|
|
64
|
+
}, () => sourceBoxes.forEach(sourceBox => {
|
|
65
|
+
const input = new ByteArrayInput(sourceBox.toArrayBuffer());
|
|
66
|
+
const targetUuid = uuidMap.get(sourceBox.address.uuid).target;
|
|
67
|
+
targetGraph.createBox(sourceBox.name, targetUuid, box => {
|
|
68
|
+
box.read(input);
|
|
69
|
+
if (UnionBoxTypes.isRegionBox(box)) {
|
|
70
|
+
const regionBox = UnionBoxTypes.asRegionBox(box);
|
|
71
|
+
regionBox.position.setValue(insertPosition);
|
|
72
|
+
result = regionBox;
|
|
73
|
+
}
|
|
74
|
+
});
|
|
75
|
+
}));
|
|
76
|
+
if (deleteSource) {
|
|
77
|
+
region.delete();
|
|
78
|
+
}
|
|
79
|
+
return asDefined(result, "Failed to create region copy");
|
|
80
|
+
};
|
|
81
|
+
})(TransferRegions || (TransferRegions = {}));
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { ppqn } from "@opendaw/lib-dsp";
|
|
2
|
+
import { SortedSet, UUID } from "@opendaw/lib-std";
|
|
3
|
+
import { AudioUnitBox, RootBox } from "@opendaw/studio-boxes";
|
|
4
|
+
import { Box, BoxGraph } from "@opendaw/lib-box";
|
|
5
|
+
import { ProjectSkeleton } from "../project/ProjectSkeleton";
|
|
6
|
+
import { AnyRegionBox } from "../unions";
|
|
7
|
+
export declare namespace TransferUtils {
|
|
8
|
+
type UUIDMapper = {
|
|
9
|
+
source: UUID.Bytes;
|
|
10
|
+
target: UUID.Bytes;
|
|
11
|
+
};
|
|
12
|
+
const excludeTimelinePredicate: (box: Box) => boolean;
|
|
13
|
+
const shouldExclude: (box: Box) => boolean;
|
|
14
|
+
const generateMap: (audioUnitBoxes: ReadonlyArray<AudioUnitBox>, dependencies: ReadonlyArray<Box>, rootBoxUUID: UUID.Bytes, masterBusBoxUUID: UUID.Bytes) => SortedSet<UUID.Bytes, UUIDMapper>;
|
|
15
|
+
const copyBoxes: (uuidMap: SortedSet<UUID.Bytes, UUIDMapper>, targetBoxGraph: BoxGraph, audioUnitBoxes: ReadonlyArray<AudioUnitBox>, dependencies: ReadonlyArray<Box>) => void;
|
|
16
|
+
const reorderAudioUnits: (uuidMap: SortedSet<UUID.Bytes, UUIDMapper>, audioUnitBoxes: ReadonlyArray<AudioUnitBox>, rootBox: RootBox) => void;
|
|
17
|
+
const extractRegions: (regionBoxes: ReadonlyArray<AnyRegionBox>, { boxGraph, mandatoryBoxes: { primaryAudioBus, rootBox } }: ProjectSkeleton, insertPosition?: ppqn) => void;
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=TransferUtils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TransferUtils.d.ts","sourceRoot":"","sources":["../../src/transfer/TransferUtils.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AAC,YAAY,CAAC,EACxC,4DAAwD,eAAe,EACvE,iBAAgB,IAAU,KAAG,IA8C3D,CAAA;CACJ"}
|
|
@@ -3,85 +3,13 @@ import { AudioUnitBox, AuxSendBox, TrackBox } from "@opendaw/studio-boxes";
|
|
|
3
3
|
import { IndexedBox, PointerField } from "@opendaw/lib-box";
|
|
4
4
|
import { UnionBoxTypes } from "../unions";
|
|
5
5
|
import { AudioUnitOrdering } from "../factories/AudioUnitOrdering";
|
|
6
|
-
export var
|
|
7
|
-
(function (
|
|
6
|
+
export var TransferUtils;
|
|
7
|
+
(function (TransferUtils) {
|
|
8
8
|
const isSameGraph = ({ graph: a }, { graph: b }) => a === b;
|
|
9
9
|
const compareIndex = (a, b) => a.index.getValue() - b.index.getValue();
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
const shouldExclude = (box) => box.ephemeral || box.name === AuxSendBox.ClassName;
|
|
14
|
-
ProjectUtils.extractAudioUnits = (audioUnitBoxes, { boxGraph, mandatoryBoxes: { primaryAudioBus, rootBox } }, options = {}) => {
|
|
15
|
-
assert(Arrays.satisfy(audioUnitBoxes, isSameGraph), "AudioUnits must share the same BoxGraph");
|
|
16
|
-
assert(!options.includeAux && !options.includeBus, "Options are not yet implemented");
|
|
17
|
-
const excludeBox = (box) => shouldExclude(box) || (options?.excludeTimeline === true && excludeTimelinePredicate(box));
|
|
18
|
-
const seen = UUID.newSet(uuid => uuid);
|
|
19
|
-
const dependencies = audioUnitBoxes
|
|
20
|
-
.flatMap(box => Array.from(box.graph.dependenciesOf(box, {
|
|
21
|
-
alwaysFollowMandatory: true,
|
|
22
|
-
stopAtResources: true,
|
|
23
|
-
excludeBox
|
|
24
|
-
}).boxes))
|
|
25
|
-
.filter(box => {
|
|
26
|
-
if (seen.hasKey(box.address.uuid)) {
|
|
27
|
-
return false;
|
|
28
|
-
}
|
|
29
|
-
seen.add(box.address.uuid);
|
|
30
|
-
return true;
|
|
31
|
-
});
|
|
32
|
-
const uuidMap = generateTransferMap(audioUnitBoxes, dependencies, rootBox.audioUnits.address.uuid, primaryAudioBus.address.uuid);
|
|
33
|
-
copy(uuidMap, boxGraph, audioUnitBoxes, dependencies);
|
|
34
|
-
reorderAudioUnits(uuidMap, audioUnitBoxes, rootBox);
|
|
35
|
-
console.debug("inTransaction", boxGraph.inTransaction());
|
|
36
|
-
return audioUnitBoxes.map(source => asInstanceOf(rootBox.graph
|
|
37
|
-
.findBox(uuidMap.get(source.address.uuid).target)
|
|
38
|
-
.unwrap("Target Track has not been copied"), AudioUnitBox));
|
|
39
|
-
};
|
|
40
|
-
ProjectUtils.extractRegions = (regionBoxes, { boxGraph, mandatoryBoxes: { primaryAudioBus, rootBox } }, insertPosition = 0.0) => {
|
|
41
|
-
assert(Arrays.satisfy(regionBoxes, isSameGraph), "Region smust be from the same BoxGraph");
|
|
42
|
-
const regionBoxSet = new Set(regionBoxes);
|
|
43
|
-
const trackBoxSet = new Set();
|
|
44
|
-
const audioUnitBoxSet = new SetMultimap();
|
|
45
|
-
regionBoxes.forEach(regionBox => {
|
|
46
|
-
const trackBox = asInstanceOf(regionBox.regions.targetVertex.unwrap().box, TrackBox);
|
|
47
|
-
trackBoxSet.add(trackBox);
|
|
48
|
-
const audioUnitBox = asInstanceOf(trackBox.tracks.targetVertex.unwrap().box, AudioUnitBox);
|
|
49
|
-
audioUnitBoxSet.add(audioUnitBox, trackBox);
|
|
50
|
-
});
|
|
51
|
-
console.debug(`Found ${audioUnitBoxSet.keyCount()} audioUnits`);
|
|
52
|
-
console.debug(`Found ${trackBoxSet.size} tracks`);
|
|
53
|
-
const audioUnitBoxes = [...audioUnitBoxSet.keys()];
|
|
54
|
-
const excludeBox = (box) => shouldExclude(box)
|
|
55
|
-
|| (isInstanceOf(box, TrackBox) && !trackBoxSet.has(box))
|
|
56
|
-
|| (UnionBoxTypes.isRegionBox(box) && !regionBoxSet.has(box));
|
|
57
|
-
const dependencies = audioUnitBoxes
|
|
58
|
-
.flatMap(box => Array.from(box.graph.dependenciesOf(box, {
|
|
59
|
-
excludeBox,
|
|
60
|
-
alwaysFollowMandatory: true,
|
|
61
|
-
stopAtResources: true
|
|
62
|
-
}).boxes));
|
|
63
|
-
const uuidMap = generateTransferMap(audioUnitBoxes, dependencies, rootBox.audioUnits.address.uuid, primaryAudioBus.address.uuid);
|
|
64
|
-
copy(uuidMap, boxGraph, audioUnitBoxes, dependencies);
|
|
65
|
-
reorderAudioUnits(uuidMap, audioUnitBoxes, rootBox);
|
|
66
|
-
audioUnitBoxSet.forEach((_, trackBoxes) => [...trackBoxes]
|
|
67
|
-
.sort(compareIndex)
|
|
68
|
-
.forEach((source, index) => {
|
|
69
|
-
const box = boxGraph
|
|
70
|
-
.findBox(uuidMap.get(source.address.uuid).target)
|
|
71
|
-
.unwrap("Target Track has not been copied");
|
|
72
|
-
asInstanceOf(box, TrackBox).index.setValue(index);
|
|
73
|
-
}));
|
|
74
|
-
const minPosition = regionBoxes.reduce((min, region) => Math.min(min, region.position.getValue()), Number.MAX_VALUE);
|
|
75
|
-
const delta = insertPosition - minPosition;
|
|
76
|
-
regionBoxes.forEach((source) => {
|
|
77
|
-
const box = boxGraph
|
|
78
|
-
.findBox(uuidMap.get(source.address.uuid).target)
|
|
79
|
-
.unwrap("Target Track has not been copied");
|
|
80
|
-
const { position } = UnionBoxTypes.asRegionBox(box);
|
|
81
|
-
position.setValue(position.getValue() + delta);
|
|
82
|
-
});
|
|
83
|
-
};
|
|
84
|
-
const generateTransferMap = (audioUnitBoxes, dependencies, rootBoxUUID, masterBusBoxUUID) => {
|
|
10
|
+
TransferUtils.excludeTimelinePredicate = (box) => box.accept({ visitTrackBox: () => true }) === true;
|
|
11
|
+
TransferUtils.shouldExclude = (box) => box.ephemeral || box.name === AuxSendBox.ClassName;
|
|
12
|
+
TransferUtils.generateMap = (audioUnitBoxes, dependencies, rootBoxUUID, masterBusBoxUUID) => {
|
|
85
13
|
const uuidMap = UUID.newSet(({ source }) => source);
|
|
86
14
|
uuidMap.addMany([
|
|
87
15
|
...audioUnitBoxes
|
|
@@ -108,17 +36,17 @@ export var ProjectUtils;
|
|
|
108
36
|
]);
|
|
109
37
|
return uuidMap;
|
|
110
38
|
};
|
|
111
|
-
|
|
112
|
-
const
|
|
39
|
+
TransferUtils.copyBoxes = (uuidMap, targetBoxGraph, audioUnitBoxes, dependencies) => {
|
|
40
|
+
const existingPreservedUuids = UUID.newSet(uuid => uuid);
|
|
113
41
|
dependencies.forEach((source) => {
|
|
114
|
-
if (source.resource === "preserved" &&
|
|
115
|
-
|
|
42
|
+
if (source.resource === "preserved" && targetBoxGraph.findBox(source.address.uuid).nonEmpty()) {
|
|
43
|
+
existingPreservedUuids.add(source.address.uuid);
|
|
116
44
|
}
|
|
117
45
|
});
|
|
118
|
-
const
|
|
46
|
+
const isOwnedByExistingPreserved = (box) => {
|
|
119
47
|
for (const [pointer, targetAddress] of box.outgoingEdges()) {
|
|
120
48
|
if (pointer.mandatory && !targetAddress.isBox()) {
|
|
121
|
-
if (
|
|
49
|
+
if (existingPreservedUuids.hasKey(targetAddress.uuid)) {
|
|
122
50
|
return true;
|
|
123
51
|
}
|
|
124
52
|
}
|
|
@@ -126,42 +54,81 @@ export var ProjectUtils;
|
|
|
126
54
|
return false;
|
|
127
55
|
};
|
|
128
56
|
PointerField.decodeWith({
|
|
129
|
-
map: (_pointer,
|
|
130
|
-
none: () =>
|
|
131
|
-
some: ({ target }) =>
|
|
57
|
+
map: (_pointer, address) => address.map(addr => uuidMap.opt(addr.uuid).match({
|
|
58
|
+
none: () => addr,
|
|
59
|
+
some: ({ target }) => addr.moveTo(target)
|
|
132
60
|
}))
|
|
133
61
|
}, () => {
|
|
134
|
-
audioUnitBoxes
|
|
135
|
-
.forEach((source) => {
|
|
62
|
+
audioUnitBoxes.forEach((source) => {
|
|
136
63
|
const input = new ByteArrayInput(source.toArrayBuffer());
|
|
137
|
-
const key = source.name;
|
|
138
64
|
const uuid = uuidMap.get(source.address.uuid).target;
|
|
139
|
-
|
|
65
|
+
targetBoxGraph.createBox(source.name, uuid, box => box.read(input));
|
|
140
66
|
});
|
|
141
|
-
dependencies
|
|
142
|
-
.
|
|
143
|
-
if (existingExternalResourceUUIDs.hasKey(source.address.uuid)) {
|
|
67
|
+
dependencies.forEach((source) => {
|
|
68
|
+
if (existingPreservedUuids.hasKey(source.address.uuid)) {
|
|
144
69
|
return;
|
|
145
70
|
}
|
|
146
|
-
if (
|
|
71
|
+
if (isOwnedByExistingPreserved(source)) {
|
|
147
72
|
return;
|
|
148
73
|
}
|
|
149
74
|
const input = new ByteArrayInput(source.toArrayBuffer());
|
|
150
|
-
const key = source.name;
|
|
151
75
|
const uuid = uuidMap.get(source.address.uuid).target;
|
|
152
|
-
|
|
76
|
+
targetBoxGraph.createBox(source.name, uuid, box => box.read(input));
|
|
153
77
|
});
|
|
154
78
|
});
|
|
155
79
|
};
|
|
156
|
-
|
|
80
|
+
TransferUtils.reorderAudioUnits = (uuidMap, audioUnitBoxes, rootBox) => audioUnitBoxes
|
|
157
81
|
.toSorted(compareIndex)
|
|
158
|
-
.map(source =>
|
|
82
|
+
.map(source => asInstanceOf(rootBox.graph
|
|
159
83
|
.findBox(uuidMap.get(source.address.uuid).target)
|
|
160
|
-
.unwrap("Target
|
|
84
|
+
.unwrap("Target AudioUnit has not been copied"), AudioUnitBox))
|
|
161
85
|
.forEach((target) => IndexedBox.collectIndexedBoxes(rootBox.audioUnits, AudioUnitBox).toSorted((a, b) => {
|
|
162
86
|
const orderA = AudioUnitOrdering[a.type.getValue()];
|
|
163
87
|
const orderB = AudioUnitOrdering[b.type.getValue()];
|
|
164
88
|
const orderDifference = orderA - orderB;
|
|
165
89
|
return orderDifference === 0 ? b === target ? -1 : 1 : orderDifference;
|
|
166
90
|
}).forEach((box, index) => box.index.setValue(index)));
|
|
167
|
-
|
|
91
|
+
TransferUtils.extractRegions = (regionBoxes, { boxGraph, mandatoryBoxes: { primaryAudioBus, rootBox } }, insertPosition = 0.0) => {
|
|
92
|
+
assert(Arrays.satisfy(regionBoxes, isSameGraph), "Region smust be from the same BoxGraph");
|
|
93
|
+
const regionBoxSet = new Set(regionBoxes);
|
|
94
|
+
const trackBoxSet = new Set();
|
|
95
|
+
const audioUnitBoxSet = new SetMultimap();
|
|
96
|
+
regionBoxes.forEach(regionBox => {
|
|
97
|
+
const trackBox = asInstanceOf(regionBox.regions.targetVertex.unwrap().box, TrackBox);
|
|
98
|
+
trackBoxSet.add(trackBox);
|
|
99
|
+
const audioUnitBox = asInstanceOf(trackBox.tracks.targetVertex.unwrap().box, AudioUnitBox);
|
|
100
|
+
audioUnitBoxSet.add(audioUnitBox, trackBox);
|
|
101
|
+
});
|
|
102
|
+
console.debug(`Found ${audioUnitBoxSet.keyCount()} audioUnits`);
|
|
103
|
+
console.debug(`Found ${trackBoxSet.size} tracks`);
|
|
104
|
+
const audioUnitBoxes = [...audioUnitBoxSet.keys()];
|
|
105
|
+
const excludeBox = (box) => TransferUtils.shouldExclude(box)
|
|
106
|
+
|| (isInstanceOf(box, TrackBox) && !trackBoxSet.has(box))
|
|
107
|
+
|| (UnionBoxTypes.isRegionBox(box) && !regionBoxSet.has(box));
|
|
108
|
+
const dependencies = Array.from(audioUnitBoxes[0].graph.dependenciesOf(audioUnitBoxes, {
|
|
109
|
+
alwaysFollowMandatory: true,
|
|
110
|
+
stopAtResources: true,
|
|
111
|
+
excludeBox
|
|
112
|
+
}).boxes);
|
|
113
|
+
const uuidMap = TransferUtils.generateMap(audioUnitBoxes, dependencies, rootBox.audioUnits.address.uuid, primaryAudioBus.address.uuid);
|
|
114
|
+
TransferUtils.copyBoxes(uuidMap, boxGraph, audioUnitBoxes, dependencies);
|
|
115
|
+
TransferUtils.reorderAudioUnits(uuidMap, audioUnitBoxes, rootBox);
|
|
116
|
+
audioUnitBoxSet.forEach((_, trackBoxes) => [...trackBoxes]
|
|
117
|
+
.sort(compareIndex)
|
|
118
|
+
.forEach((source, index) => {
|
|
119
|
+
const box = boxGraph
|
|
120
|
+
.findBox(uuidMap.get(source.address.uuid).target)
|
|
121
|
+
.unwrap("Target Track has not been copied");
|
|
122
|
+
asInstanceOf(box, TrackBox).index.setValue(index);
|
|
123
|
+
}));
|
|
124
|
+
const minPosition = regionBoxes.reduce((min, region) => Math.min(min, region.position.getValue()), Number.MAX_VALUE);
|
|
125
|
+
const delta = insertPosition - minPosition;
|
|
126
|
+
regionBoxes.forEach((source) => {
|
|
127
|
+
const box = boxGraph
|
|
128
|
+
.findBox(uuidMap.get(source.address.uuid).target)
|
|
129
|
+
.unwrap("Target Track has not been copied");
|
|
130
|
+
const { position } = UnionBoxTypes.asRegionBox(box);
|
|
131
|
+
position.setValue(position.getValue() + delta);
|
|
132
|
+
});
|
|
133
|
+
};
|
|
134
|
+
})(TransferUtils || (TransferUtils = {}));
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/transfer/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAA;AACpC,cAAc,mBAAmB,CAAA;AACjC,cAAc,iBAAiB,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@opendaw/studio-adapters",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.85",
|
|
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.74",
|
|
27
|
+
"@opendaw/lib-dsp": "^0.0.72",
|
|
28
|
+
"@opendaw/lib-fusion": "^0.0.79",
|
|
29
|
+
"@opendaw/lib-runtime": "^0.0.70",
|
|
30
|
+
"@opendaw/lib-std": "^0.0.69",
|
|
31
|
+
"@opendaw/studio-boxes": "^0.0.76",
|
|
32
|
+
"@opendaw/studio-enums": "^0.0.64",
|
|
33
33
|
"soundfont2": "^0.5.0"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
36
|
"@opendaw/eslint-config": "^0.0.27",
|
|
37
|
-
"@opendaw/typescript-config": "^0.0.
|
|
37
|
+
"@opendaw/typescript-config": "^0.0.29"
|
|
38
38
|
},
|
|
39
|
-
"gitHead": "
|
|
39
|
+
"gitHead": "e1d65ce1874ad5ac4b14cb0cc80c235e0ed395ae"
|
|
40
40
|
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { ppqn } from "@opendaw/lib-dsp";
|
|
2
|
-
import { AudioUnitBox } from "@opendaw/studio-boxes";
|
|
3
|
-
import { ProjectSkeleton } from "./ProjectSkeleton";
|
|
4
|
-
import { AnyRegionBox } from "../unions";
|
|
5
|
-
export declare namespace ProjectUtils {
|
|
6
|
-
const extractAudioUnits: (audioUnitBoxes: ReadonlyArray<AudioUnitBox>, { boxGraph, mandatoryBoxes: { primaryAudioBus, rootBox } }: ProjectSkeleton, options?: {
|
|
7
|
-
includeAux?: boolean;
|
|
8
|
-
includeBus?: boolean;
|
|
9
|
-
excludeTimeline?: boolean;
|
|
10
|
-
}) => ReadonlyArray<AudioUnitBox>;
|
|
11
|
-
const extractRegions: (regionBoxes: ReadonlyArray<AnyRegionBox>, { boxGraph, mandatoryBoxes: { primaryAudioBus, rootBox } }: ProjectSkeleton, insertPosition?: ppqn) => void;
|
|
12
|
-
}
|
|
13
|
-
//# sourceMappingURL=ProjectUtils.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ProjectUtils.d.ts","sourceRoot":"","sources":["../../src/project/ProjectUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,IAAI,EAAC,MAAM,kBAAkB,CAAA;AAarC,OAAO,EAAC,YAAY,EAAmD,MAAM,uBAAuB,CAAA;AAEpG,OAAO,EAAC,eAAe,EAAC,MAAM,mBAAmB,CAAA;AACjD,OAAO,EAAC,YAAY,EAAgB,MAAM,WAAW,CAAA;AAGrD,yBAAiB,YAAY,CAAC;IAUnB,MAAM,iBAAiB,GAAI,gBAAgB,aAAa,CAAC,YAAY,CAAC,EAC3C,4DAAwD,eAAe,EACvE,UAAS;QACL,UAAU,CAAC,EAAE,OAAO,CAAC;QACrB,UAAU,CAAC,EAAE,OAAO,CAAC;QACrB,eAAe,CAAC,EAAE,OAAO,CAAC;KACxB,KAClC,aAAa,CAAC,YAAY,CAyB/B,CAAA;IAEM,MAAM,cAAc,GAAI,aAAa,aAAa,CAAC,YAAY,CAAC,EACxC,4DAAwD,eAAe,EACvE,iBAAgB,IAAU,KAAG,IA+C3D,CAAA;CA6FJ"}
|