@opendaw/studio-core 0.0.115 → 0.0.117
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":"RecordAudio.d.ts","sourceRoot":"","sources":["../../src/capture/RecordAudio.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"RecordAudio.d.ts","sourceRoot":"","sources":["../../src/capture/RecordAudio.ts"],"names":[],"mappings":"AAAA,OAAO,EAMH,UAAU,EAIb,MAAM,kBAAkB,CAAA;AAGzB,OAAO,EAAa,mBAAmB,EAA2B,MAAM,0BAA0B,CAAA;AAClG,OAAO,EAAC,OAAO,EAAC,MAAM,YAAY,CAAA;AAClC,OAAO,EAAC,gBAAgB,EAAC,MAAM,qBAAqB,CAAA;AACpD,OAAO,EAAC,OAAO,EAAC,MAAM,WAAW,CAAA;AAIjC,yBAAiB,WAAW,CAAC;IACzB,KAAK,kBAAkB,GAAG;QACtB,gBAAgB,EAAE,gBAAgB,CAAA;QAClC,UAAU,EAAE,SAAS,CAAA;QACrB,aAAa,EAAE,mBAAmB,CAAA;QAClC,OAAO,EAAE,OAAO,CAAA;QAChB,OAAO,EAAE,OAAO,CAAA;QAChB,aAAa,EAAE,MAAM,CAAA;KACxB,CAAA;IAOD,MAAM,CAAC,MAAM,KAAK,GACd,kFAAgF,kBAAkB,KAChG,UA+JL,CAAA;;CACJ"}
|
|
@@ -2,6 +2,7 @@ import { asInstanceOf, Option, quantizeFloor, Terminable, Terminator, tryCatch,
|
|
|
2
2
|
import { PPQN, TimeBase } from "@opendaw/lib-dsp";
|
|
3
3
|
import { AudioFileBox, AudioRegionBox, TrackBox, ValueEventCollectionBox } from "@opendaw/studio-boxes";
|
|
4
4
|
import { ColorCodes, TrackType, UnionBoxTypes } from "@opendaw/studio-adapters";
|
|
5
|
+
import { Recording } from "./Recording";
|
|
5
6
|
import { RecordTrack } from "./RecordTrack";
|
|
6
7
|
export var RecordAudio;
|
|
7
8
|
(function (RecordAudio) {
|
|
@@ -16,7 +17,6 @@ export var RecordAudio;
|
|
|
16
17
|
let lastPosition = 0;
|
|
17
18
|
let currentWaveformOffset = outputLatency;
|
|
18
19
|
let takeNumber = 0;
|
|
19
|
-
let hadCountIn = false;
|
|
20
20
|
const { env: { audioContext: { sampleRate } }, engine: { preferences: { settings: { recording } } } } = project;
|
|
21
21
|
const { loopArea } = timelineBox;
|
|
22
22
|
const createFileBox = () => {
|
|
@@ -117,9 +117,7 @@ export var RecordAudio;
|
|
|
117
117
|
return;
|
|
118
118
|
}
|
|
119
119
|
const currentPosition = owner.getValue();
|
|
120
|
-
// During count-in, just track that we had one
|
|
121
120
|
if (isCountingIn) {
|
|
122
|
-
hadCountIn = true;
|
|
123
121
|
return;
|
|
124
122
|
}
|
|
125
123
|
// From here on, isRecording is true
|
|
@@ -143,10 +141,11 @@ export var RecordAudio;
|
|
|
143
141
|
const preRecordingFrames = recordingWorklet.numberOfFrames;
|
|
144
142
|
const preRecordingSeconds = preRecordingFrames / sampleRate;
|
|
145
143
|
// If there was count-in, use pre-recording frames as offset; otherwise use outputLatency
|
|
146
|
-
const
|
|
144
|
+
const countedIn = Recording.wasCountingIn();
|
|
145
|
+
const waveformOffset = countedIn ? preRecordingSeconds : outputLatency;
|
|
147
146
|
editing.modify(() => {
|
|
148
147
|
fileBox = Option.wrap(createFileBox());
|
|
149
|
-
const position = quantizeFloor(currentPosition, beats);
|
|
148
|
+
const position = countedIn ? quantizeFloor(currentPosition, beats) : currentPosition;
|
|
150
149
|
currentTake = Option.wrap(createTakeRegion(position, waveformOffset, null));
|
|
151
150
|
}, false);
|
|
152
151
|
currentWaveformOffset = waveformOffset;
|
|
@@ -39,7 +39,7 @@ export class Recording {
|
|
|
39
39
|
this.#isRecording = false;
|
|
40
40
|
};
|
|
41
41
|
terminator.ownAll(engine.isRecording.subscribe(stop), engine.isCountingIn.subscribe(stop), Terminable.create(() => Recording.#instance = Option.None));
|
|
42
|
-
this.#instance = Option.wrap(new Recording(countIn, engine.position.getValue()));
|
|
42
|
+
this.#instance = Option.wrap(new Recording(countIn && !engine.isPlaying.getValue(), engine.position.getValue()));
|
|
43
43
|
return terminator;
|
|
44
44
|
}
|
|
45
45
|
static #isRecording = false;
|