@opendaw/studio-core 0.0.106 → 0.0.107
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/processors.js +8 -8
- package/dist/processors.js.map +4 -4
- package/dist/ui/index.d.ts +0 -1
- package/dist/ui/index.d.ts.map +1 -1
- package/dist/ui/index.js +0 -1
- package/package.json +9 -9
- package/dist/ui/transfer/TransferRegions.d.ts +0 -12
- package/dist/ui/transfer/TransferRegions.d.ts.map +0 -1
- package/dist/ui/transfer/TransferRegions.js +0 -81
- package/dist/ui/transfer/TransferRegions.test.d.ts +0 -2
- package/dist/ui/transfer/TransferRegions.test.d.ts.map +0 -1
- package/dist/ui/transfer/TransferRegions.test.js +0 -242
- package/dist/ui/transfer/index.d.ts +0 -2
- package/dist/ui/transfer/index.d.ts.map +0 -1
- package/dist/ui/transfer/index.js +0 -1
package/dist/ui/index.d.ts
CHANGED
package/dist/ui/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/ui/index.ts"],"names":[],"mappings":"AAAA,cAAc,8BAA8B,CAAA;AAC5C,cAAc,4BAA4B,CAAA;AAC1C,cAAc,yBAAyB,CAAA;AACvC,cAAc,8CAA8C,CAAA;AAC5D,cAAc,2CAA2C,CAAA;AACzD,cAAc,yCAAyC,CAAA;AACvD,cAAc,2CAA2C,CAAA;AACzD,cAAc,0CAA0C,CAAA;AACxD,cAAc,kBAAkB,CAAA;AAChC,cAAc,+BAA+B,CAAA;AAC7C,cAAc,uCAAuC,CAAA;AACrD,cAAc,mCAAmC,CAAA;AACjD,cAAc,kCAAkC,CAAA;AAChD,cAAc,uCAAuC,CAAA;AACrD,cAAc,0BAA0B,CAAA;AACxC,cAAc,qBAAqB,CAAA;AACnC,cAAc,0BAA0B,CAAA;AACxC,cAAc,0BAA0B,CAAA
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/ui/index.ts"],"names":[],"mappings":"AAAA,cAAc,8BAA8B,CAAA;AAC5C,cAAc,4BAA4B,CAAA;AAC1C,cAAc,yBAAyB,CAAA;AACvC,cAAc,8CAA8C,CAAA;AAC5D,cAAc,2CAA2C,CAAA;AACzD,cAAc,yCAAyC,CAAA;AACvD,cAAc,2CAA2C,CAAA;AACzD,cAAc,0CAA0C,CAAA;AACxD,cAAc,kBAAkB,CAAA;AAChC,cAAc,+BAA+B,CAAA;AAC7C,cAAc,uCAAuC,CAAA;AACrD,cAAc,mCAAmC,CAAA;AACjD,cAAc,kCAAkC,CAAA;AAChD,cAAc,uCAAuC,CAAA;AACrD,cAAc,0BAA0B,CAAA;AACxC,cAAc,qBAAqB,CAAA;AACnC,cAAc,0BAA0B,CAAA;AACxC,cAAc,0BAA0B,CAAA"}
|
package/dist/ui/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@opendaw/studio-core",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.107",
|
|
4
4
|
"license": "LGPL-3.0-or-later",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -33,16 +33,16 @@
|
|
|
33
33
|
"test": "vitest run --config vitest.config.ts"
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@opendaw/lib-box": "^0.0.
|
|
36
|
+
"@opendaw/lib-box": "^0.0.74",
|
|
37
37
|
"@opendaw/lib-dawproject": "^0.0.58",
|
|
38
38
|
"@opendaw/lib-dom": "^0.0.74",
|
|
39
39
|
"@opendaw/lib-dsp": "^0.0.72",
|
|
40
|
-
"@opendaw/lib-fusion": "^0.0.
|
|
40
|
+
"@opendaw/lib-fusion": "^0.0.79",
|
|
41
41
|
"@opendaw/lib-runtime": "^0.0.70",
|
|
42
42
|
"@opendaw/lib-std": "^0.0.69",
|
|
43
43
|
"@opendaw/nam-wasm": "^1.0.3",
|
|
44
|
-
"@opendaw/studio-adapters": "^0.0.
|
|
45
|
-
"@opendaw/studio-boxes": "^0.0.
|
|
44
|
+
"@opendaw/studio-adapters": "^0.0.85",
|
|
45
|
+
"@opendaw/studio-boxes": "^0.0.76",
|
|
46
46
|
"@opendaw/studio-enums": "^0.0.64",
|
|
47
47
|
"dropbox": "^10.34.0",
|
|
48
48
|
"y-websocket": "^1.4.5",
|
|
@@ -57,10 +57,10 @@
|
|
|
57
57
|
"@ffmpeg/ffmpeg": "^0.12.15",
|
|
58
58
|
"@ffmpeg/util": "^0.12.2",
|
|
59
59
|
"@opendaw/eslint-config": "^0.0.27",
|
|
60
|
-
"@opendaw/studio-core-processors": "^0.0.
|
|
61
|
-
"@opendaw/studio-core-workers": "^0.0.
|
|
62
|
-
"@opendaw/studio-forge-boxes": "^0.0.
|
|
60
|
+
"@opendaw/studio-core-processors": "^0.0.88",
|
|
61
|
+
"@opendaw/studio-core-workers": "^0.0.80",
|
|
62
|
+
"@opendaw/studio-forge-boxes": "^0.0.76",
|
|
63
63
|
"@opendaw/typescript-config": "^0.0.29"
|
|
64
64
|
},
|
|
65
|
-
"gitHead": "
|
|
65
|
+
"gitHead": "e1d65ce1874ad5ac4b14cb0cc80c235e0ed395ae"
|
|
66
66
|
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { ppqn } from "@opendaw/lib-dsp";
|
|
2
|
-
import { TrackBox } from "@opendaw/studio-boxes";
|
|
3
|
-
import { AnyRegionBox } from "@opendaw/studio-adapters";
|
|
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
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"TransferRegions.d.ts","sourceRoot":"","sources":["../../../src/ui/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,0BAA0B,CAAA;AAEpE,yBAAiB,eAAe,CAAC;IAC7B;;;;OAIG;IACI,MAAM,QAAQ,GAAI,QAAQ,YAAY,EACpB,aAAa,QAAQ,EACrB,gBAAgB,IAAI,EACpB,eAAc,OAAc,KAAG,YA6DvD,CAAA;CACJ"}
|
|
@@ -1,81 +0,0 @@
|
|
|
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 "@opendaw/studio-adapters";
|
|
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 = {}));
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"TransferRegions.test.d.ts","sourceRoot":"","sources":["../../../src/ui/transfer/TransferRegions.test.ts"],"names":[],"mappings":"AAAA,OAAO,gBAAgB,CAAA"}
|
|
@@ -1,242 +0,0 @@
|
|
|
1
|
-
import "../../polyfill";
|
|
2
|
-
import { afterEach, beforeEach, describe, expect, it } from "vitest";
|
|
3
|
-
import { Terminable, UUID } from "@opendaw/lib-std";
|
|
4
|
-
import { AudioUnitBox, CaptureAudioBox, TrackBox, ValueEventCollectionBox, ValueRegionBox } from "@opendaw/studio-boxes";
|
|
5
|
-
import { AudioUnitType } from "@opendaw/studio-enums";
|
|
6
|
-
import { ProjectSkeleton, TrackType } from "@opendaw/studio-adapters";
|
|
7
|
-
import { Project } from "../../project";
|
|
8
|
-
import { TransferRegions } from "./TransferRegions";
|
|
9
|
-
const createEnv = () => ({
|
|
10
|
-
audioContext: {},
|
|
11
|
-
audioWorklets: {},
|
|
12
|
-
sampleManager: {
|
|
13
|
-
getOrCreate: () => ({}),
|
|
14
|
-
record: () => { },
|
|
15
|
-
remove: () => { },
|
|
16
|
-
invalidate: () => { },
|
|
17
|
-
register: () => Terminable.Empty
|
|
18
|
-
},
|
|
19
|
-
soundfontManager: {
|
|
20
|
-
getOrCreate: () => ({}),
|
|
21
|
-
remove: () => { },
|
|
22
|
-
invalidate: () => { }
|
|
23
|
-
}
|
|
24
|
-
});
|
|
25
|
-
const createProject = () => {
|
|
26
|
-
const skeleton = ProjectSkeleton.empty({ createDefaultUser: true, createOutputCompressor: false });
|
|
27
|
-
return Project.fromSkeleton(createEnv(), skeleton, false);
|
|
28
|
-
};
|
|
29
|
-
const createTrackWithRegion = (project, position = 100, duration = 200) => {
|
|
30
|
-
const { boxGraph } = project;
|
|
31
|
-
const captureBox = CaptureAudioBox.create(boxGraph, UUID.generate());
|
|
32
|
-
const audioUnitBox = AudioUnitBox.create(boxGraph, UUID.generate(), box => {
|
|
33
|
-
box.type.setValue(AudioUnitType.Instrument);
|
|
34
|
-
box.collection.refer(project.rootBox.audioUnits);
|
|
35
|
-
box.output.refer(project.masterBusBox.input);
|
|
36
|
-
box.capture.refer(captureBox);
|
|
37
|
-
box.index.setValue(1);
|
|
38
|
-
});
|
|
39
|
-
const trackBox = TrackBox.create(boxGraph, UUID.generate(), box => {
|
|
40
|
-
box.type.setValue(TrackType.Value);
|
|
41
|
-
box.tracks.refer(audioUnitBox.tracks);
|
|
42
|
-
box.target.refer(audioUnitBox);
|
|
43
|
-
box.index.setValue(0);
|
|
44
|
-
});
|
|
45
|
-
const collectionBox = ValueEventCollectionBox.create(boxGraph, UUID.generate());
|
|
46
|
-
const regionBox = ValueRegionBox.create(boxGraph, UUID.generate(), box => {
|
|
47
|
-
box.position.setValue(position);
|
|
48
|
-
box.duration.setValue(duration);
|
|
49
|
-
box.loopDuration.setValue(duration);
|
|
50
|
-
box.hue.setValue(42);
|
|
51
|
-
box.events.refer(collectionBox.owners);
|
|
52
|
-
box.regions.refer(trackBox.regions);
|
|
53
|
-
});
|
|
54
|
-
return { audioUnitBox, trackBox, regionBox, collectionBox };
|
|
55
|
-
};
|
|
56
|
-
describe("TransferRegions.transfer", () => {
|
|
57
|
-
let project;
|
|
58
|
-
beforeEach(() => { project = createProject(); });
|
|
59
|
-
afterEach(() => project.terminate());
|
|
60
|
-
describe("same graph", () => {
|
|
61
|
-
it("copies region to same track at new position", () => {
|
|
62
|
-
const { boxGraph } = project;
|
|
63
|
-
boxGraph.beginTransaction();
|
|
64
|
-
const { trackBox, regionBox } = createTrackWithRegion(project);
|
|
65
|
-
boxGraph.endTransaction();
|
|
66
|
-
boxGraph.beginTransaction();
|
|
67
|
-
const copied = TransferRegions.transfer(regionBox, trackBox, 500, false);
|
|
68
|
-
boxGraph.endTransaction();
|
|
69
|
-
expect(copied.position.getValue()).toBe(500);
|
|
70
|
-
expect(copied.graph).toBe(boxGraph);
|
|
71
|
-
expect(trackBox.regions.pointerHub.incoming().length).toBe(2);
|
|
72
|
-
boxGraph.verifyPointers();
|
|
73
|
-
});
|
|
74
|
-
it("copies region to different track", () => {
|
|
75
|
-
const { boxGraph } = project;
|
|
76
|
-
boxGraph.beginTransaction();
|
|
77
|
-
const { trackBox: trackA, regionBox, audioUnitBox } = createTrackWithRegion(project);
|
|
78
|
-
const trackB = TrackBox.create(boxGraph, UUID.generate(), box => {
|
|
79
|
-
box.type.setValue(TrackType.Value);
|
|
80
|
-
box.tracks.refer(audioUnitBox.tracks);
|
|
81
|
-
box.target.refer(audioUnitBox);
|
|
82
|
-
box.index.setValue(1);
|
|
83
|
-
});
|
|
84
|
-
boxGraph.endTransaction();
|
|
85
|
-
boxGraph.beginTransaction();
|
|
86
|
-
const copied = TransferRegions.transfer(regionBox, trackB, 300, false);
|
|
87
|
-
boxGraph.endTransaction();
|
|
88
|
-
expect(copied.position.getValue()).toBe(300);
|
|
89
|
-
const targetUuid = copied.regions.targetVertex.unwrap().box.address.uuid;
|
|
90
|
-
expect(UUID.equals(targetUuid, trackB.address.uuid)).toBe(true);
|
|
91
|
-
expect(trackB.regions.pointerHub.incoming().length).toBe(1);
|
|
92
|
-
expect(trackA.regions.pointerHub.incoming().length).toBe(1);
|
|
93
|
-
boxGraph.verifyPointers();
|
|
94
|
-
});
|
|
95
|
-
it("creates new UUID for copied region", () => {
|
|
96
|
-
const { boxGraph } = project;
|
|
97
|
-
boxGraph.beginTransaction();
|
|
98
|
-
const { trackBox, regionBox } = createTrackWithRegion(project);
|
|
99
|
-
boxGraph.endTransaction();
|
|
100
|
-
boxGraph.beginTransaction();
|
|
101
|
-
const copied = TransferRegions.transfer(regionBox, trackBox, 500, false);
|
|
102
|
-
boxGraph.endTransaction();
|
|
103
|
-
expect(UUID.equals(copied.address.uuid, regionBox.address.uuid)).toBe(false);
|
|
104
|
-
});
|
|
105
|
-
it("preserves region properties", () => {
|
|
106
|
-
const { boxGraph } = project;
|
|
107
|
-
boxGraph.beginTransaction();
|
|
108
|
-
const { trackBox, regionBox } = createTrackWithRegion(project);
|
|
109
|
-
boxGraph.endTransaction();
|
|
110
|
-
boxGraph.beginTransaction();
|
|
111
|
-
const copied = TransferRegions.transfer(regionBox, trackBox, 500, false);
|
|
112
|
-
boxGraph.endTransaction();
|
|
113
|
-
expect(copied.duration.getValue()).toBe(200);
|
|
114
|
-
expect(copied.loopDuration.getValue()).toBe(200);
|
|
115
|
-
expect(copied.hue.getValue()).toBe(42);
|
|
116
|
-
});
|
|
117
|
-
it("deletes source when deleteSource is true", () => {
|
|
118
|
-
const { boxGraph } = project;
|
|
119
|
-
boxGraph.beginTransaction();
|
|
120
|
-
const { trackBox, regionBox } = createTrackWithRegion(project);
|
|
121
|
-
boxGraph.endTransaction();
|
|
122
|
-
boxGraph.beginTransaction();
|
|
123
|
-
TransferRegions.transfer(regionBox, trackBox, 500);
|
|
124
|
-
boxGraph.endTransaction();
|
|
125
|
-
expect(regionBox.isAttached()).toBe(false);
|
|
126
|
-
expect(trackBox.regions.pointerHub.incoming().length).toBe(1);
|
|
127
|
-
boxGraph.verifyPointers();
|
|
128
|
-
});
|
|
129
|
-
it("keeps source when deleteSource is false", () => {
|
|
130
|
-
const { boxGraph } = project;
|
|
131
|
-
boxGraph.beginTransaction();
|
|
132
|
-
const { trackBox, regionBox } = createTrackWithRegion(project);
|
|
133
|
-
boxGraph.endTransaction();
|
|
134
|
-
boxGraph.beginTransaction();
|
|
135
|
-
TransferRegions.transfer(regionBox, trackBox, 500, false);
|
|
136
|
-
boxGraph.endTransaction();
|
|
137
|
-
expect(regionBox.isAttached()).toBe(true);
|
|
138
|
-
expect(trackBox.regions.pointerHub.incoming().length).toBe(2);
|
|
139
|
-
});
|
|
140
|
-
it("copies event collection dependency with new UUID", () => {
|
|
141
|
-
const { boxGraph } = project;
|
|
142
|
-
boxGraph.beginTransaction();
|
|
143
|
-
const { trackBox, regionBox, collectionBox } = createTrackWithRegion(project);
|
|
144
|
-
boxGraph.endTransaction();
|
|
145
|
-
boxGraph.beginTransaction();
|
|
146
|
-
const copied = TransferRegions.transfer(regionBox, trackBox, 500, false);
|
|
147
|
-
boxGraph.endTransaction();
|
|
148
|
-
const copiedEventsVertex = copied.events.targetVertex.unwrap();
|
|
149
|
-
const copiedCollectionUuid = copiedEventsVertex.box.address.uuid;
|
|
150
|
-
expect(UUID.equals(copiedCollectionUuid, collectionBox.address.uuid)).toBe(false);
|
|
151
|
-
boxGraph.verifyPointers();
|
|
152
|
-
});
|
|
153
|
-
});
|
|
154
|
-
describe("cross graph", () => {
|
|
155
|
-
let sourceProject;
|
|
156
|
-
beforeEach(() => { sourceProject = createProject(); });
|
|
157
|
-
afterEach(() => sourceProject.terminate());
|
|
158
|
-
it("copies region to target graph at given position", () => {
|
|
159
|
-
const sourceGraph = sourceProject.boxGraph;
|
|
160
|
-
sourceGraph.beginTransaction();
|
|
161
|
-
const { regionBox: sourceRegion } = createTrackWithRegion(sourceProject);
|
|
162
|
-
sourceGraph.endTransaction();
|
|
163
|
-
const { boxGraph } = project;
|
|
164
|
-
boxGraph.beginTransaction();
|
|
165
|
-
const { trackBox: targetTrack } = createTrackWithRegion(project);
|
|
166
|
-
boxGraph.endTransaction();
|
|
167
|
-
const regionsBefore = targetTrack.regions.pointerHub.incoming().length;
|
|
168
|
-
boxGraph.beginTransaction();
|
|
169
|
-
const copied = TransferRegions.transfer(sourceRegion, targetTrack, 500, false);
|
|
170
|
-
boxGraph.endTransaction();
|
|
171
|
-
expect(copied.position.getValue()).toBe(500);
|
|
172
|
-
expect(copied.graph).toBe(boxGraph);
|
|
173
|
-
expect(copied.graph).not.toBe(sourceGraph);
|
|
174
|
-
expect(targetTrack.regions.pointerHub.incoming().length).toBe(regionsBefore + 1);
|
|
175
|
-
boxGraph.verifyPointers();
|
|
176
|
-
sourceGraph.verifyPointers();
|
|
177
|
-
});
|
|
178
|
-
it("creates new UUID for copied region", () => {
|
|
179
|
-
const sourceGraph = sourceProject.boxGraph;
|
|
180
|
-
sourceGraph.beginTransaction();
|
|
181
|
-
const { regionBox: sourceRegion } = createTrackWithRegion(sourceProject);
|
|
182
|
-
sourceGraph.endTransaction();
|
|
183
|
-
const { boxGraph } = project;
|
|
184
|
-
boxGraph.beginTransaction();
|
|
185
|
-
const { trackBox: targetTrack } = createTrackWithRegion(project);
|
|
186
|
-
boxGraph.endTransaction();
|
|
187
|
-
boxGraph.beginTransaction();
|
|
188
|
-
const copied = TransferRegions.transfer(sourceRegion, targetTrack, 500, false);
|
|
189
|
-
boxGraph.endTransaction();
|
|
190
|
-
expect(UUID.equals(copied.address.uuid, sourceRegion.address.uuid)).toBe(false);
|
|
191
|
-
});
|
|
192
|
-
it("preserves region properties", () => {
|
|
193
|
-
const sourceGraph = sourceProject.boxGraph;
|
|
194
|
-
sourceGraph.beginTransaction();
|
|
195
|
-
const { regionBox: sourceRegion } = createTrackWithRegion(sourceProject, 100, 300);
|
|
196
|
-
sourceGraph.endTransaction();
|
|
197
|
-
const { boxGraph } = project;
|
|
198
|
-
boxGraph.beginTransaction();
|
|
199
|
-
const { trackBox: targetTrack } = createTrackWithRegion(project);
|
|
200
|
-
boxGraph.endTransaction();
|
|
201
|
-
boxGraph.beginTransaction();
|
|
202
|
-
const copied = TransferRegions.transfer(sourceRegion, targetTrack, 500, false);
|
|
203
|
-
boxGraph.endTransaction();
|
|
204
|
-
expect(copied.duration.getValue()).toBe(300);
|
|
205
|
-
expect(copied.loopDuration.getValue()).toBe(300);
|
|
206
|
-
expect(copied.hue.getValue()).toBe(42);
|
|
207
|
-
});
|
|
208
|
-
it("keeps source in source graph when deleteSource is false", () => {
|
|
209
|
-
const sourceGraph = sourceProject.boxGraph;
|
|
210
|
-
sourceGraph.beginTransaction();
|
|
211
|
-
const { regionBox: sourceRegion } = createTrackWithRegion(sourceProject);
|
|
212
|
-
sourceGraph.endTransaction();
|
|
213
|
-
const { boxGraph } = project;
|
|
214
|
-
boxGraph.beginTransaction();
|
|
215
|
-
const { trackBox: targetTrack } = createTrackWithRegion(project);
|
|
216
|
-
boxGraph.endTransaction();
|
|
217
|
-
boxGraph.beginTransaction();
|
|
218
|
-
TransferRegions.transfer(sourceRegion, targetTrack, 500, false);
|
|
219
|
-
boxGraph.endTransaction();
|
|
220
|
-
expect(sourceRegion.isAttached()).toBe(true);
|
|
221
|
-
sourceGraph.verifyPointers();
|
|
222
|
-
});
|
|
223
|
-
it("deletes source when deleteSource is true", () => {
|
|
224
|
-
const sourceGraph = sourceProject.boxGraph;
|
|
225
|
-
sourceGraph.beginTransaction();
|
|
226
|
-
const { regionBox: sourceRegion } = createTrackWithRegion(sourceProject);
|
|
227
|
-
sourceGraph.endTransaction();
|
|
228
|
-
const { boxGraph } = project;
|
|
229
|
-
boxGraph.beginTransaction();
|
|
230
|
-
const { trackBox: targetTrack } = createTrackWithRegion(project);
|
|
231
|
-
boxGraph.endTransaction();
|
|
232
|
-
sourceGraph.beginTransaction();
|
|
233
|
-
boxGraph.beginTransaction();
|
|
234
|
-
TransferRegions.transfer(sourceRegion, targetTrack, 500);
|
|
235
|
-
boxGraph.endTransaction();
|
|
236
|
-
sourceGraph.endTransaction();
|
|
237
|
-
expect(sourceRegion.isAttached()).toBe(false);
|
|
238
|
-
boxGraph.verifyPointers();
|
|
239
|
-
sourceGraph.verifyPointers();
|
|
240
|
-
});
|
|
241
|
-
});
|
|
242
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/ui/transfer/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./TransferRegions";
|