@opendaw/studio-core 0.0.81 → 0.0.82
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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RecordMidi.d.ts","sourceRoot":"","sources":["../../src/capture/RecordMidi.ts"],"names":[],"mappings":"AAAA,OAAO,EAAO,QAAQ,EAAuC,UAAU,EAAmB,MAAM,kBAAkB,CAAA;AAGlH,OAAO,EAAa,UAAU,EAAY,MAAM,0BAA0B,CAAA;AAC1E,OAAO,EAAC,OAAO,EAAC,MAAM,YAAY,CAAA;AAClC,OAAO,EAAC,OAAO,EAAC,MAAM,WAAW,CAAA;AAGjC,yBAAiB,UAAU,CAAC;IACxB,KAAK,iBAAiB,GAAG;QACrB,QAAQ,EAAE,QAAQ,CAAC,UAAU,CAAC,CAAC;QAC/B,OAAO,EAAE,OAAO,CAAC;QACjB,OAAO,EAAE,OAAO,CAAA;KACnB,CAAA;IAID,MAAM,CAAC,MAAM,KAAK,GAAI,gCAA8B,iBAAiB,KAAG,
|
|
1
|
+
{"version":3,"file":"RecordMidi.d.ts","sourceRoot":"","sources":["../../src/capture/RecordMidi.ts"],"names":[],"mappings":"AAAA,OAAO,EAAO,QAAQ,EAAuC,UAAU,EAAmB,MAAM,kBAAkB,CAAA;AAGlH,OAAO,EAAa,UAAU,EAAY,MAAM,0BAA0B,CAAA;AAC1E,OAAO,EAAC,OAAO,EAAC,MAAM,YAAY,CAAA;AAClC,OAAO,EAAC,OAAO,EAAC,MAAM,WAAW,CAAA;AAGjC,yBAAiB,UAAU,CAAC;IACxB,KAAK,iBAAiB,GAAG;QACrB,QAAQ,EAAE,QAAQ,CAAC,UAAU,CAAC,CAAC;QAC/B,OAAO,EAAE,OAAO,CAAC;QACjB,OAAO,EAAE,OAAO,CAAA;KACnB,CAAA;IAID,MAAM,CAAC,MAAM,KAAK,GAAI,gCAA8B,iBAAiB,KAAG,UAuEvE,CAAA;;CACJ"}
|
|
@@ -9,15 +9,34 @@ export var RecordMidi;
|
|
|
9
9
|
RecordMidi.start = ({ notifier, project, capture }) => {
|
|
10
10
|
const beats = PPQN.fromSignature(1, project.timelineBox.signature.denominator.getValue());
|
|
11
11
|
const { editing, boxGraph, engine, env: { audioContext }, timelineBox: { bpm } } = project;
|
|
12
|
-
const { position } = engine;
|
|
12
|
+
const { position, isRecording } = engine;
|
|
13
13
|
const trackBox = RecordTrack.findOrCreate(editing, capture.audioUnitBox, TrackType.Notes);
|
|
14
14
|
const terminator = new Terminator();
|
|
15
15
|
const activeNotes = new Map();
|
|
16
16
|
const latency = PPQN.secondsToPulses(audioContext.outputLatency ?? 10.0, bpm.getValue());
|
|
17
17
|
let writing = Option.None;
|
|
18
|
+
const createRegion = () => {
|
|
19
|
+
const writePosition = position.getValue() + latency;
|
|
20
|
+
editing.modify(() => {
|
|
21
|
+
const collection = NoteEventCollectionBox.create(boxGraph, UUID.generate());
|
|
22
|
+
const region = NoteRegionBox.create(boxGraph, UUID.generate(), box => {
|
|
23
|
+
box.regions.refer(trackBox.regions);
|
|
24
|
+
box.events.refer(collection.owners);
|
|
25
|
+
box.position.setValue(Math.max(quantizeRound(writePosition, beats), 0));
|
|
26
|
+
box.hue.setValue(ColorCodes.forTrackType(TrackType.Notes));
|
|
27
|
+
});
|
|
28
|
+
engine.ignoreNoteRegion(region.address.uuid);
|
|
29
|
+
writing = Option.wrap({ region, collection });
|
|
30
|
+
}, false);
|
|
31
|
+
};
|
|
18
32
|
terminator.own(position.catchupAndSubscribe(owner => {
|
|
19
33
|
if (writing.isEmpty()) {
|
|
20
|
-
|
|
34
|
+
if (isRecording.getValue()) {
|
|
35
|
+
createRegion();
|
|
36
|
+
}
|
|
37
|
+
else {
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
21
40
|
}
|
|
22
41
|
const writePosition = owner.getValue() + latency;
|
|
23
42
|
const { region, collection } = writing.unwrap();
|
|
@@ -47,17 +66,7 @@ export var RecordMidi;
|
|
|
47
66
|
if (NoteSignal.isOn(signal)) {
|
|
48
67
|
const { pitch, velocity } = signal;
|
|
49
68
|
if (writing.isEmpty()) {
|
|
50
|
-
|
|
51
|
-
const collection = NoteEventCollectionBox.create(boxGraph, UUID.generate());
|
|
52
|
-
const region = NoteRegionBox.create(boxGraph, UUID.generate(), box => {
|
|
53
|
-
box.regions.refer(trackBox.regions);
|
|
54
|
-
box.events.refer(collection.owners);
|
|
55
|
-
box.position.setValue(Math.max(quantizeRound(writePosition, beats), 0));
|
|
56
|
-
box.hue.setValue(ColorCodes.forTrackType(TrackType.Notes));
|
|
57
|
-
});
|
|
58
|
-
engine.ignoreNoteRegion(region.address.uuid);
|
|
59
|
-
writing = Option.wrap({ region, collection });
|
|
60
|
-
}, false);
|
|
69
|
+
createRegion();
|
|
61
70
|
}
|
|
62
71
|
const { region, collection } = writing.unwrap();
|
|
63
72
|
editing.modify(() => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@opendaw/studio-core",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.82",
|
|
4
4
|
"license": "LGPL-3.0-or-later",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -59,5 +59,5 @@
|
|
|
59
59
|
"@opendaw/studio-forge-boxes": "^0.0.62",
|
|
60
60
|
"@opendaw/typescript-config": "^0.0.27"
|
|
61
61
|
},
|
|
62
|
-
"gitHead": "
|
|
62
|
+
"gitHead": "860689883ddbcc09e468001ba65ca71c00fa3081"
|
|
63
63
|
}
|