@opendaw/studio-adapters 0.0.111 → 0.0.112
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.
|
@@ -2,9 +2,11 @@ import { bpm, ppqn, seconds, TempoMap, ValueEvent } from "@opendaw/lib-dsp";
|
|
|
2
2
|
import { Observer, Subscription, Terminable } from "@opendaw/lib-std";
|
|
3
3
|
import { TimelineBoxAdapter } from "./timeline/TimelineBoxAdapter";
|
|
4
4
|
/**
|
|
5
|
-
* Allocation-free cursor that
|
|
6
|
-
*
|
|
7
|
-
*
|
|
5
|
+
* Allocation-free cursor that walks the TempoChangeGrid as a step function: tempo is constant within
|
|
6
|
+
* each grid cell and sampled at the cell's grid-aligned start (matching BlockRenderer). Tracks the
|
|
7
|
+
* current segment and the recurrence coefficients m, q so a step of exactly TempoChangeGrid within the
|
|
8
|
+
* same zone resolves as v = m * v + q. Because every cell is sampled at its grid origin, the walk is
|
|
9
|
+
* additive: integrate(a, c) === integrate(a, b) + integrate(b, c) for any b.
|
|
8
10
|
*/
|
|
9
11
|
export declare class TempoGridCursor {
|
|
10
12
|
#private;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"VaryingTempoMap.d.ts","sourceRoot":"","sources":["../src/VaryingTempoMap.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,GAAG,EAAE,IAAI,EAAQ,OAAO,EAAmB,QAAQ,EAAE,UAAU,EAAC,MAAM,kBAAkB,CAAA;AAChG,OAAO,EAKH,QAAQ,
|
|
1
|
+
{"version":3,"file":"VaryingTempoMap.d.ts","sourceRoot":"","sources":["../src/VaryingTempoMap.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,GAAG,EAAE,IAAI,EAAQ,OAAO,EAAmB,QAAQ,EAAE,UAAU,EAAC,MAAM,kBAAkB,CAAA;AAChG,OAAO,EAKH,QAAQ,EAGR,YAAY,EACZ,UAAU,EAEb,MAAM,kBAAkB,CAAA;AACzB,OAAO,EAAC,kBAAkB,EAAC,MAAM,+BAA+B,CAAA;AAIhE;;;;;;GAMG;AACH,qBAAa,eAAe;;IASxB;;OAEG;IACH,SAAS,CAAC,MAAM,EAAE,aAAa,CAAC,UAAU,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,UAAU,EAAE,GAAG,GAAG,OAAO;IAepG;;;OAGG;IACH,OAAO,CAAC,MAAM,EAAE,aAAa,CAAC,UAAU,CAAC,EACjC,QAAQ,EAAE,IAAI,EACd,WAAW,EAAE,OAAO,EACpB,aAAa,EAAE,OAAO,EACtB,UAAU,EAAE,GAAG,GAAG,IAAI;CAuFjC;AAED;;;GAGG;AACH,qBAAa,eAAgB,YAAW,QAAQ,EAAE,UAAU;;gBAW5C,OAAO,EAAE,kBAAkB;IAQvC,SAAS,IAAI,IAAI;IA6BjB,UAAU,CAAC,QAAQ,EAAE,IAAI,GAAG,GAAG;IAQ/B,aAAa,CAAC,QAAQ,EAAE,IAAI,GAAG,OAAO;IA+BtC,aAAa,CAAC,IAAI,EAAE,OAAO,GAAG,IAAI;IA8BlC,iBAAiB,CAAC,QAAQ,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,GAAG,OAAO;IAqBxD,cAAc,CAAC,WAAW,EAAE,OAAO,EAAE,SAAS,EAAE,OAAO,GAAG,IAAI;IAO9D,SAAS,CAAC,QAAQ,EAAE,QAAQ,CAAC,QAAQ,CAAC,GAAG,YAAY;CAQxD"}
|
package/dist/VaryingTempoMap.js
CHANGED
|
@@ -9,13 +9,15 @@ var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (
|
|
|
9
9
|
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
10
10
|
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
11
11
|
};
|
|
12
|
-
var _TempoGridCursor_instances, _TempoGridCursor_events, _TempoGridCursor_storageBpm, _TempoGridCursor_segmentIndex, _TempoGridCursor_lastPPQN, _TempoGridCursor_lastBpm, _TempoGridCursor_m, _TempoGridCursor_q, _TempoGridCursor_reset, _TempoGridCursor_bpmAt, _TempoGridCursor_zoneAt, _VaryingTempoMap_instances, _VaryingTempoMap_terminator, _VaryingTempoMap_adapter, _VaryingTempoMap_ppqnCache, _VaryingTempoMap_secondsCache, _VaryingTempoMap_cursor, _VaryingTempoMap_rebuildCache, _VaryingTempoMap_ppqnToSecondsPositive, _VaryingTempoMap_absoluteSecondsToPPQN;
|
|
12
|
+
var _TempoGridCursor_instances, _TempoGridCursor_events, _TempoGridCursor_storageBpm, _TempoGridCursor_segmentIndex, _TempoGridCursor_lastPPQN, _TempoGridCursor_lastBpm, _TempoGridCursor_m, _TempoGridCursor_q, _TempoGridCursor_reset, _TempoGridCursor_bpmAt, _TempoGridCursor_zoneAt, _VaryingTempoMap_instances, _VaryingTempoMap_terminator, _VaryingTempoMap_adapter, _VaryingTempoMap_ppqnCache, _VaryingTempoMap_secondsCache, _VaryingTempoMap_cursor, _VaryingTempoMap_ivFrom, _VaryingTempoMap_ivTo, _VaryingTempoMap_ivSeconds, _VaryingTempoMap_rebuildCache, _VaryingTempoMap_ppqnToSecondsPositive, _VaryingTempoMap_absoluteSecondsToPPQN;
|
|
13
13
|
import { PPQN, TempoChangeGrid } from "@opendaw/lib-dsp";
|
|
14
|
-
import { BinarySearch, Curve, NumberComparator, quantizeCeil, Terminator } from "@opendaw/lib-std";
|
|
14
|
+
import { BinarySearch, Curve, NumberComparator, quantizeCeil, quantizeFloor, Terminator } from "@opendaw/lib-std";
|
|
15
15
|
/**
|
|
16
|
-
* Allocation-free cursor that
|
|
17
|
-
*
|
|
18
|
-
*
|
|
16
|
+
* Allocation-free cursor that walks the TempoChangeGrid as a step function: tempo is constant within
|
|
17
|
+
* each grid cell and sampled at the cell's grid-aligned start (matching BlockRenderer). Tracks the
|
|
18
|
+
* current segment and the recurrence coefficients m, q so a step of exactly TempoChangeGrid within the
|
|
19
|
+
* same zone resolves as v = m * v + q. Because every cell is sampled at its grid origin, the walk is
|
|
20
|
+
* additive: integrate(a, c) === integrate(a, b) + integrate(b, c) for any b.
|
|
19
21
|
*/
|
|
20
22
|
export class TempoGridCursor {
|
|
21
23
|
constructor() {
|
|
@@ -40,7 +42,7 @@ export class TempoGridCursor {
|
|
|
40
42
|
let acc = 0.0;
|
|
41
43
|
let current = fromPPQN;
|
|
42
44
|
while (current < toPPQN) {
|
|
43
|
-
const currentBpm = __classPrivateFieldGet(this, _TempoGridCursor_instances, "m", _TempoGridCursor_bpmAt).call(this, current);
|
|
45
|
+
const currentBpm = __classPrivateFieldGet(this, _TempoGridCursor_instances, "m", _TempoGridCursor_bpmAt).call(this, quantizeFloor(current, TempoChangeGrid));
|
|
44
46
|
const nextGrid = quantizeCeil(current, TempoChangeGrid);
|
|
45
47
|
const segmentEnd = nextGrid <= current ? nextGrid + TempoChangeGrid : nextGrid;
|
|
46
48
|
const actualEnd = Math.min(segmentEnd, toPPQN);
|
|
@@ -58,7 +60,7 @@ export class TempoGridCursor {
|
|
|
58
60
|
let accumulatedSeconds = fromSeconds;
|
|
59
61
|
let accumulatedPPQN = fromPPQN;
|
|
60
62
|
while (accumulatedSeconds < targetSeconds) {
|
|
61
|
-
const currentBpm = __classPrivateFieldGet(this, _TempoGridCursor_instances, "m", _TempoGridCursor_bpmAt).call(this, accumulatedPPQN);
|
|
63
|
+
const currentBpm = __classPrivateFieldGet(this, _TempoGridCursor_instances, "m", _TempoGridCursor_bpmAt).call(this, quantizeFloor(accumulatedPPQN, TempoChangeGrid));
|
|
62
64
|
const nextGrid = quantizeCeil(accumulatedPPQN, TempoChangeGrid);
|
|
63
65
|
const segmentEnd = nextGrid <= accumulatedPPQN ? nextGrid + TempoChangeGrid : nextGrid;
|
|
64
66
|
const segmentPPQN = segmentEnd - accumulatedPPQN;
|
|
@@ -161,6 +163,9 @@ export class VaryingTempoMap {
|
|
|
161
163
|
_VaryingTempoMap_ppqnCache.set(this, []);
|
|
162
164
|
_VaryingTempoMap_secondsCache.set(this, []);
|
|
163
165
|
_VaryingTempoMap_cursor.set(this, new TempoGridCursor());
|
|
166
|
+
_VaryingTempoMap_ivFrom.set(this, Number.NaN);
|
|
167
|
+
_VaryingTempoMap_ivTo.set(this, 0.0);
|
|
168
|
+
_VaryingTempoMap_ivSeconds.set(this, 0.0);
|
|
164
169
|
__classPrivateFieldSet(this, _VaryingTempoMap_adapter, adapter, "f");
|
|
165
170
|
__classPrivateFieldGet(this, _VaryingTempoMap_terminator, "f").ownAll(adapter.box.bpm.subscribe(() => __classPrivateFieldGet(this, _VaryingTempoMap_instances, "m", _VaryingTempoMap_rebuildCache).call(this)), adapter.catchupAndSubscribeTempoAutomation(() => __classPrivateFieldGet(this, _VaryingTempoMap_instances, "m", _VaryingTempoMap_rebuildCache).call(this)));
|
|
166
171
|
}
|
|
@@ -181,7 +186,28 @@ export class VaryingTempoMap {
|
|
|
181
186
|
return __classPrivateFieldGet(this, _VaryingTempoMap_instances, "m", _VaryingTempoMap_absoluteSecondsToPPQN).call(this, time);
|
|
182
187
|
}
|
|
183
188
|
intervalToSeconds(fromPPQN, toPPQN) {
|
|
184
|
-
|
|
189
|
+
if (fromPPQN < 0 || toPPQN < fromPPQN) {
|
|
190
|
+
return this.ppqnToSeconds(toPPQN) - this.ppqnToSeconds(fromPPQN);
|
|
191
|
+
}
|
|
192
|
+
const storageBpm = __classPrivateFieldGet(this, _VaryingTempoMap_adapter, "f").box.bpm.getValue();
|
|
193
|
+
const tempoEvents = __classPrivateFieldGet(this, _VaryingTempoMap_adapter, "f").tempoTrackEvents;
|
|
194
|
+
if (tempoEvents.isEmpty()) {
|
|
195
|
+
return PPQN.pulsesToSeconds(toPPQN - fromPPQN, storageBpm);
|
|
196
|
+
}
|
|
197
|
+
const collection = tempoEvents.unwrap();
|
|
198
|
+
if (collection.events.isEmpty()) {
|
|
199
|
+
return PPQN.pulsesToSeconds(toPPQN - fromPPQN, storageBpm);
|
|
200
|
+
}
|
|
201
|
+
const events = collection.events.asArray();
|
|
202
|
+
if (fromPPQN === __classPrivateFieldGet(this, _VaryingTempoMap_ivFrom, "f") && toPPQN >= __classPrivateFieldGet(this, _VaryingTempoMap_ivTo, "f")) {
|
|
203
|
+
__classPrivateFieldSet(this, _VaryingTempoMap_ivSeconds, __classPrivateFieldGet(this, _VaryingTempoMap_ivSeconds, "f") + __classPrivateFieldGet(this, _VaryingTempoMap_cursor, "f").integrate(events, __classPrivateFieldGet(this, _VaryingTempoMap_ivTo, "f"), toPPQN, storageBpm), "f");
|
|
204
|
+
__classPrivateFieldSet(this, _VaryingTempoMap_ivTo, toPPQN, "f");
|
|
205
|
+
return __classPrivateFieldGet(this, _VaryingTempoMap_ivSeconds, "f");
|
|
206
|
+
}
|
|
207
|
+
__classPrivateFieldSet(this, _VaryingTempoMap_ivFrom, fromPPQN, "f");
|
|
208
|
+
__classPrivateFieldSet(this, _VaryingTempoMap_ivTo, toPPQN, "f");
|
|
209
|
+
__classPrivateFieldSet(this, _VaryingTempoMap_ivSeconds, __classPrivateFieldGet(this, _VaryingTempoMap_cursor, "f").integrate(events, fromPPQN, toPPQN, storageBpm), "f");
|
|
210
|
+
return __classPrivateFieldGet(this, _VaryingTempoMap_ivSeconds, "f");
|
|
185
211
|
}
|
|
186
212
|
intervalToPPQN(fromSeconds, toSeconds) {
|
|
187
213
|
if (fromSeconds >= toSeconds) {
|
|
@@ -197,9 +223,10 @@ export class VaryingTempoMap {
|
|
|
197
223
|
return terminator;
|
|
198
224
|
}
|
|
199
225
|
}
|
|
200
|
-
_VaryingTempoMap_terminator = new WeakMap(), _VaryingTempoMap_adapter = new WeakMap(), _VaryingTempoMap_ppqnCache = new WeakMap(), _VaryingTempoMap_secondsCache = new WeakMap(), _VaryingTempoMap_cursor = new WeakMap(), _VaryingTempoMap_instances = new WeakSet(), _VaryingTempoMap_rebuildCache = function _VaryingTempoMap_rebuildCache() {
|
|
226
|
+
_VaryingTempoMap_terminator = new WeakMap(), _VaryingTempoMap_adapter = new WeakMap(), _VaryingTempoMap_ppqnCache = new WeakMap(), _VaryingTempoMap_secondsCache = new WeakMap(), _VaryingTempoMap_cursor = new WeakMap(), _VaryingTempoMap_ivFrom = new WeakMap(), _VaryingTempoMap_ivTo = new WeakMap(), _VaryingTempoMap_ivSeconds = new WeakMap(), _VaryingTempoMap_instances = new WeakSet(), _VaryingTempoMap_rebuildCache = function _VaryingTempoMap_rebuildCache() {
|
|
201
227
|
__classPrivateFieldGet(this, _VaryingTempoMap_ppqnCache, "f").length = 0;
|
|
202
228
|
__classPrivateFieldGet(this, _VaryingTempoMap_secondsCache, "f").length = 0;
|
|
229
|
+
__classPrivateFieldSet(this, _VaryingTempoMap_ivFrom, Number.NaN, "f");
|
|
203
230
|
const tempoEvents = __classPrivateFieldGet(this, _VaryingTempoMap_adapter, "f").tempoTrackEvents;
|
|
204
231
|
if (tempoEvents.isEmpty()) {
|
|
205
232
|
return;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AudioRegionBoxAdapter.d.ts","sourceRoot":"","sources":["../../../src/timeline/region/AudioRegionBoxAdapter.ts"],"names":[],"mappings":"AAAA,OAAO,EAGH,GAAG,EAEH,KAAK,EAGL,sBAAsB,EAEtB,gBAAgB,EAChB,QAAQ,EACR,MAAM,EAEN,YAAY,EAGZ,IAAI,EACP,MAAM,kBAAkB,CAAA;AACzB,OAAO,EAAC,eAAe,EAAE,IAAI,EAAE,QAAQ,EAAoB,MAAM,kBAAkB,CAAA;AACnF,OAAO,EAAC,OAAO,EAAE,KAAK,EAAoC,MAAM,kBAAkB,CAAA;AAClF,OAAO,EAAC,QAAQ,EAAC,MAAM,uBAAuB,CAAA;AAC9C,OAAO,EAAC,cAAc,EAAC,MAAM,uBAAuB,CAAA;AACpD,OAAO,EAAC,wBAAwB,EAAE,gBAAgB,EAAE,uBAAuB,EAAC,MAAM,qBAAqB,CAAA;AACvG,OAAO,EAAC,eAAe,EAAC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AW,IAAI,IAAI;IACnB,UAAU,CAAC,OAAO,EAAE,aAAa,CAAC,gBAAgB,CAAC,OAAO,CAAC,CAAC,GAAG,OAAO;IAKtE,OAAO,CAAC,QAAQ,EAAE,aAAa,CAAC,gBAAgB,CAAC,OAAO,CAAC,CAAC,GAAG,MAAM,CAAC,cAAc,CAAC;IAKnF,SAAS,IAAI,IAAI;IAYjB,QAAQ,IAAI,MAAM;CASrB"}
|
|
@@ -9,7 +9,7 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
9
9
|
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
10
10
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
11
11
|
};
|
|
12
|
-
var _AudioRegionBoxAdapter_instances, _AudioRegionBoxAdapter_terminator, _AudioRegionBoxAdapter_context, _AudioRegionBoxAdapter_box, _AudioRegionBoxAdapter_durationConverter, _AudioRegionBoxAdapter_loopDurationConverter, _AudioRegionBoxAdapter_playMode, _AudioRegionBoxAdapter_changeNotifier, _AudioRegionBoxAdapter_fadingAdapter, _AudioRegionBoxAdapter_constructing, _AudioRegionBoxAdapter_fileAdapter, _AudioRegionBoxAdapter_fileSubscription, _AudioRegionBoxAdapter_playModeSubscription, _AudioRegionBoxAdapter_tempoSubscription, _AudioRegionBoxAdapter_eventCollectionSubscription, _AudioRegionBoxAdapter_isSelected, _AudioRegionBoxAdapter_dispatchChange;
|
|
12
|
+
var _AudioRegionBoxAdapter_instances, _AudioRegionBoxAdapter_terminator, _AudioRegionBoxAdapter_context, _AudioRegionBoxAdapter_box, _AudioRegionBoxAdapter_durationConverter, _AudioRegionBoxAdapter_loopDurationConverter, _AudioRegionBoxAdapter_playMode, _AudioRegionBoxAdapter_changeNotifier, _AudioRegionBoxAdapter_fadingAdapter, _AudioRegionBoxAdapter_constructing, _AudioRegionBoxAdapter_fileAdapter, _AudioRegionBoxAdapter_fileSubscription, _AudioRegionBoxAdapter_playModeSubscription, _AudioRegionBoxAdapter_tempoSubscription, _AudioRegionBoxAdapter_eventCollectionSubscription, _AudioRegionBoxAdapter_isSelected, _AudioRegionBoxAdapter_cachedDuration, _AudioRegionBoxAdapter_cachedLoopDuration, _AudioRegionBoxAdapter_dispatchChange;
|
|
13
13
|
import { Arrays, asEnumValue, isInstanceOf, mod, MutableObservableOption, Notifier, Option, safeExecute, Terminable, Terminator, UUID } from "@opendaw/lib-std";
|
|
14
14
|
import { TimeBase, TimeBaseConverter } from "@opendaw/lib-dsp";
|
|
15
15
|
import { Propagation } from "@opendaw/lib-box";
|
|
@@ -40,6 +40,8 @@ export class AudioRegionBoxAdapter {
|
|
|
40
40
|
_AudioRegionBoxAdapter_tempoSubscription.set(this, Terminable.Empty);
|
|
41
41
|
_AudioRegionBoxAdapter_eventCollectionSubscription.set(this, Terminable.Empty);
|
|
42
42
|
_AudioRegionBoxAdapter_isSelected.set(this, void 0);
|
|
43
|
+
_AudioRegionBoxAdapter_cachedDuration.set(this, Number.NaN);
|
|
44
|
+
_AudioRegionBoxAdapter_cachedLoopDuration.set(this, Number.NaN);
|
|
43
45
|
__classPrivateFieldSet(this, _AudioRegionBoxAdapter_context, context, "f");
|
|
44
46
|
__classPrivateFieldSet(this, _AudioRegionBoxAdapter_box, box, "f");
|
|
45
47
|
__classPrivateFieldSet(this, _AudioRegionBoxAdapter_terminator, new Terminator(), "f");
|
|
@@ -116,10 +118,20 @@ export class AudioRegionBoxAdapter {
|
|
|
116
118
|
get uuid() { return __classPrivateFieldGet(this, _AudioRegionBoxAdapter_box, "f").address.uuid; }
|
|
117
119
|
get address() { return __classPrivateFieldGet(this, _AudioRegionBoxAdapter_box, "f").address; }
|
|
118
120
|
get position() { return __classPrivateFieldGet(this, _AudioRegionBoxAdapter_box, "f").position.getValue(); }
|
|
119
|
-
get duration() {
|
|
121
|
+
get duration() {
|
|
122
|
+
if (Number.isNaN(__classPrivateFieldGet(this, _AudioRegionBoxAdapter_cachedDuration, "f"))) {
|
|
123
|
+
__classPrivateFieldSet(this, _AudioRegionBoxAdapter_cachedDuration, __classPrivateFieldGet(this, _AudioRegionBoxAdapter_durationConverter, "f").toPPQN(this.position), "f");
|
|
124
|
+
}
|
|
125
|
+
return __classPrivateFieldGet(this, _AudioRegionBoxAdapter_cachedDuration, "f");
|
|
126
|
+
}
|
|
120
127
|
get complete() { return this.position + this.duration; }
|
|
121
128
|
get loopOffset() { return __classPrivateFieldGet(this, _AudioRegionBoxAdapter_box, "f").loopOffset.getValue(); }
|
|
122
|
-
get loopDuration() {
|
|
129
|
+
get loopDuration() {
|
|
130
|
+
if (Number.isNaN(__classPrivateFieldGet(this, _AudioRegionBoxAdapter_cachedLoopDuration, "f"))) {
|
|
131
|
+
__classPrivateFieldSet(this, _AudioRegionBoxAdapter_cachedLoopDuration, __classPrivateFieldGet(this, _AudioRegionBoxAdapter_loopDurationConverter, "f").toPPQN(this.position), "f");
|
|
132
|
+
}
|
|
133
|
+
return __classPrivateFieldGet(this, _AudioRegionBoxAdapter_cachedLoopDuration, "f");
|
|
134
|
+
}
|
|
123
135
|
isNoteRegion() { return false; }
|
|
124
136
|
isAudioRegion() { return true; }
|
|
125
137
|
isValueRegion() { return false; }
|
|
@@ -248,7 +260,9 @@ export class AudioRegionBoxAdapter {
|
|
|
248
260
|
}
|
|
249
261
|
toString() { return `{AudioRegionBoxAdapter ${UUID.toString(__classPrivateFieldGet(this, _AudioRegionBoxAdapter_box, "f").address.uuid)}}`; }
|
|
250
262
|
}
|
|
251
|
-
_AudioRegionBoxAdapter_terminator = new WeakMap(), _AudioRegionBoxAdapter_context = new WeakMap(), _AudioRegionBoxAdapter_box = new WeakMap(), _AudioRegionBoxAdapter_durationConverter = new WeakMap(), _AudioRegionBoxAdapter_loopDurationConverter = new WeakMap(), _AudioRegionBoxAdapter_playMode = new WeakMap(), _AudioRegionBoxAdapter_changeNotifier = new WeakMap(), _AudioRegionBoxAdapter_fadingAdapter = new WeakMap(), _AudioRegionBoxAdapter_constructing = new WeakMap(), _AudioRegionBoxAdapter_fileAdapter = new WeakMap(), _AudioRegionBoxAdapter_fileSubscription = new WeakMap(), _AudioRegionBoxAdapter_playModeSubscription = new WeakMap(), _AudioRegionBoxAdapter_tempoSubscription = new WeakMap(), _AudioRegionBoxAdapter_eventCollectionSubscription = new WeakMap(), _AudioRegionBoxAdapter_isSelected = new WeakMap(), _AudioRegionBoxAdapter_instances = new WeakSet(), _AudioRegionBoxAdapter_dispatchChange = function _AudioRegionBoxAdapter_dispatchChange() {
|
|
263
|
+
_AudioRegionBoxAdapter_terminator = new WeakMap(), _AudioRegionBoxAdapter_context = new WeakMap(), _AudioRegionBoxAdapter_box = new WeakMap(), _AudioRegionBoxAdapter_durationConverter = new WeakMap(), _AudioRegionBoxAdapter_loopDurationConverter = new WeakMap(), _AudioRegionBoxAdapter_playMode = new WeakMap(), _AudioRegionBoxAdapter_changeNotifier = new WeakMap(), _AudioRegionBoxAdapter_fadingAdapter = new WeakMap(), _AudioRegionBoxAdapter_constructing = new WeakMap(), _AudioRegionBoxAdapter_fileAdapter = new WeakMap(), _AudioRegionBoxAdapter_fileSubscription = new WeakMap(), _AudioRegionBoxAdapter_playModeSubscription = new WeakMap(), _AudioRegionBoxAdapter_tempoSubscription = new WeakMap(), _AudioRegionBoxAdapter_eventCollectionSubscription = new WeakMap(), _AudioRegionBoxAdapter_isSelected = new WeakMap(), _AudioRegionBoxAdapter_cachedDuration = new WeakMap(), _AudioRegionBoxAdapter_cachedLoopDuration = new WeakMap(), _AudioRegionBoxAdapter_instances = new WeakSet(), _AudioRegionBoxAdapter_dispatchChange = function _AudioRegionBoxAdapter_dispatchChange() {
|
|
264
|
+
__classPrivateFieldSet(this, _AudioRegionBoxAdapter_cachedDuration, Number.NaN, "f");
|
|
265
|
+
__classPrivateFieldSet(this, _AudioRegionBoxAdapter_cachedLoopDuration, Number.NaN, "f");
|
|
252
266
|
if (__classPrivateFieldGet(this, _AudioRegionBoxAdapter_constructing, "f")) {
|
|
253
267
|
return;
|
|
254
268
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@opendaw/studio-adapters",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.112",
|
|
4
4
|
"license": "LGPL-3.0-or-later",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -36,5 +36,5 @@
|
|
|
36
36
|
"@opendaw/eslint-config": "^0.0.28",
|
|
37
37
|
"@opendaw/typescript-config": "^0.0.32"
|
|
38
38
|
},
|
|
39
|
-
"gitHead": "
|
|
39
|
+
"gitHead": "ebbc65ad5e1e4553b662913c895afb35210c2ea1"
|
|
40
40
|
}
|