@opendaw/studio-adapters 0.0.109 → 0.0.111
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/VaryingTempoMap.d.ts +18 -1
- package/dist/VaryingTempoMap.d.ts.map +1 -1
- package/dist/VaryingTempoMap.js +152 -44
- package/dist/engine/EnginePreferencesSchema.d.ts +2 -2
- package/dist/engine/EnginePreferencesSchema.d.ts.map +1 -1
- package/dist/engine/EnginePreferencesSchema.js +1 -1
- package/package.json +10 -10
|
@@ -1,6 +1,23 @@
|
|
|
1
|
-
import { bpm, ppqn, seconds, TempoMap } from "@opendaw/lib-dsp";
|
|
1
|
+
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
|
+
/**
|
|
5
|
+
* Allocation-free cursor that reproduces {@link ValueEvent.valueAt} for monotonically non-decreasing ppqn.
|
|
6
|
+
* Tracks the current segment and the recurrence coefficients m, q so that a step of exactly
|
|
7
|
+
* TempoChangeGrid within the same zone can be resolved as v = m * v + q.
|
|
8
|
+
*/
|
|
9
|
+
export declare class TempoGridCursor {
|
|
10
|
+
#private;
|
|
11
|
+
/**
|
|
12
|
+
* Integrates the seconds elapsed across [fromPPQN, toPPQN] by stepping the TempoChangeGrid.
|
|
13
|
+
*/
|
|
14
|
+
integrate(events: ReadonlyArray<ValueEvent>, fromPPQN: ppqn, toPPQN: ppqn, storageBpm: bpm): seconds;
|
|
15
|
+
/**
|
|
16
|
+
* Walks the TempoChangeGrid forward from fromPPQN, accumulating seconds starting at fromSeconds,
|
|
17
|
+
* until targetSeconds is reached.
|
|
18
|
+
*/
|
|
19
|
+
advance(events: ReadonlyArray<ValueEvent>, fromPPQN: ppqn, fromSeconds: seconds, targetSeconds: seconds, storageBpm: bpm): ppqn;
|
|
20
|
+
}
|
|
4
21
|
/**
|
|
5
22
|
* TempoMap implementation that handles varying tempo (tempo automation).
|
|
6
23
|
* Steps through at TempoChangeGrid intervals to match BlockRenderer behavior.
|
|
@@ -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,EAAC,MAAM,kBAAkB,CAAA;
|
|
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,EAER,YAAY,EACZ,UAAU,EAEb,MAAM,kBAAkB,CAAA;AACzB,OAAO,EAAC,kBAAkB,EAAC,MAAM,+BAA+B,CAAA;AAIhE;;;;GAIG;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;;gBAO5C,OAAO,EAAE,kBAAkB;IAQvC,SAAS,IAAI,IAAI;IA4BjB,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;IAIxD,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
|
@@ -1,17 +1,154 @@
|
|
|
1
|
+
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
2
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
3
|
+
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");
|
|
4
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
5
|
+
};
|
|
1
6
|
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
2
7
|
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
3
8
|
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
4
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");
|
|
5
10
|
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
6
11
|
};
|
|
7
|
-
var
|
|
8
|
-
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
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
|
-
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
11
|
-
};
|
|
12
|
-
var _VaryingTempoMap_instances, _VaryingTempoMap_terminator, _VaryingTempoMap_adapter, _VaryingTempoMap_ppqnCache, _VaryingTempoMap_secondsCache, _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_rebuildCache, _VaryingTempoMap_ppqnToSecondsPositive, _VaryingTempoMap_absoluteSecondsToPPQN;
|
|
13
13
|
import { PPQN, TempoChangeGrid } from "@opendaw/lib-dsp";
|
|
14
|
-
import { BinarySearch, NumberComparator, quantizeCeil, Terminator } from "@opendaw/lib-std";
|
|
14
|
+
import { BinarySearch, Curve, NumberComparator, quantizeCeil, Terminator } from "@opendaw/lib-std";
|
|
15
|
+
/**
|
|
16
|
+
* Allocation-free cursor that reproduces {@link ValueEvent.valueAt} for monotonically non-decreasing ppqn.
|
|
17
|
+
* Tracks the current segment and the recurrence coefficients m, q so that a step of exactly
|
|
18
|
+
* TempoChangeGrid within the same zone can be resolved as v = m * v + q.
|
|
19
|
+
*/
|
|
20
|
+
export class TempoGridCursor {
|
|
21
|
+
constructor() {
|
|
22
|
+
_TempoGridCursor_instances.add(this);
|
|
23
|
+
_TempoGridCursor_events.set(this, []);
|
|
24
|
+
_TempoGridCursor_storageBpm.set(this, 0.0);
|
|
25
|
+
_TempoGridCursor_segmentIndex.set(this, -2);
|
|
26
|
+
_TempoGridCursor_lastPPQN.set(this, Number.NEGATIVE_INFINITY);
|
|
27
|
+
_TempoGridCursor_lastBpm.set(this, 0.0);
|
|
28
|
+
_TempoGridCursor_m.set(this, 1.0);
|
|
29
|
+
_TempoGridCursor_q.set(this, 0.0
|
|
30
|
+
/**
|
|
31
|
+
* Integrates the seconds elapsed across [fromPPQN, toPPQN] by stepping the TempoChangeGrid.
|
|
32
|
+
*/
|
|
33
|
+
);
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Integrates the seconds elapsed across [fromPPQN, toPPQN] by stepping the TempoChangeGrid.
|
|
37
|
+
*/
|
|
38
|
+
integrate(events, fromPPQN, toPPQN, storageBpm) {
|
|
39
|
+
__classPrivateFieldGet(this, _TempoGridCursor_instances, "m", _TempoGridCursor_reset).call(this, events, storageBpm);
|
|
40
|
+
let acc = 0.0;
|
|
41
|
+
let current = fromPPQN;
|
|
42
|
+
while (current < toPPQN) {
|
|
43
|
+
const currentBpm = __classPrivateFieldGet(this, _TempoGridCursor_instances, "m", _TempoGridCursor_bpmAt).call(this, current);
|
|
44
|
+
const nextGrid = quantizeCeil(current, TempoChangeGrid);
|
|
45
|
+
const segmentEnd = nextGrid <= current ? nextGrid + TempoChangeGrid : nextGrid;
|
|
46
|
+
const actualEnd = Math.min(segmentEnd, toPPQN);
|
|
47
|
+
acc += PPQN.pulsesToSeconds(actualEnd - current, currentBpm);
|
|
48
|
+
current = actualEnd;
|
|
49
|
+
}
|
|
50
|
+
return acc;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Walks the TempoChangeGrid forward from fromPPQN, accumulating seconds starting at fromSeconds,
|
|
54
|
+
* until targetSeconds is reached.
|
|
55
|
+
*/
|
|
56
|
+
advance(events, fromPPQN, fromSeconds, targetSeconds, storageBpm) {
|
|
57
|
+
__classPrivateFieldGet(this, _TempoGridCursor_instances, "m", _TempoGridCursor_reset).call(this, events, storageBpm);
|
|
58
|
+
let accumulatedSeconds = fromSeconds;
|
|
59
|
+
let accumulatedPPQN = fromPPQN;
|
|
60
|
+
while (accumulatedSeconds < targetSeconds) {
|
|
61
|
+
const currentBpm = __classPrivateFieldGet(this, _TempoGridCursor_instances, "m", _TempoGridCursor_bpmAt).call(this, accumulatedPPQN);
|
|
62
|
+
const nextGrid = quantizeCeil(accumulatedPPQN, TempoChangeGrid);
|
|
63
|
+
const segmentEnd = nextGrid <= accumulatedPPQN ? nextGrid + TempoChangeGrid : nextGrid;
|
|
64
|
+
const segmentPPQN = segmentEnd - accumulatedPPQN;
|
|
65
|
+
const segmentSeconds = PPQN.pulsesToSeconds(segmentPPQN, currentBpm);
|
|
66
|
+
if (accumulatedSeconds + segmentSeconds >= targetSeconds) {
|
|
67
|
+
accumulatedPPQN += PPQN.secondsToPulses(targetSeconds - accumulatedSeconds, currentBpm);
|
|
68
|
+
break;
|
|
69
|
+
}
|
|
70
|
+
accumulatedSeconds += segmentSeconds;
|
|
71
|
+
accumulatedPPQN = segmentEnd;
|
|
72
|
+
}
|
|
73
|
+
return accumulatedPPQN;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
_TempoGridCursor_events = new WeakMap(), _TempoGridCursor_storageBpm = new WeakMap(), _TempoGridCursor_segmentIndex = new WeakMap(), _TempoGridCursor_lastPPQN = new WeakMap(), _TempoGridCursor_lastBpm = new WeakMap(), _TempoGridCursor_m = new WeakMap(), _TempoGridCursor_q = new WeakMap(), _TempoGridCursor_instances = new WeakSet(), _TempoGridCursor_reset = function _TempoGridCursor_reset(events, storageBpm) {
|
|
77
|
+
__classPrivateFieldSet(this, _TempoGridCursor_events, events, "f");
|
|
78
|
+
__classPrivateFieldSet(this, _TempoGridCursor_storageBpm, storageBpm, "f");
|
|
79
|
+
__classPrivateFieldSet(this, _TempoGridCursor_segmentIndex, -2, "f");
|
|
80
|
+
__classPrivateFieldSet(this, _TempoGridCursor_lastPPQN, Number.NEGATIVE_INFINITY, "f");
|
|
81
|
+
__classPrivateFieldSet(this, _TempoGridCursor_lastBpm, 0.0, "f");
|
|
82
|
+
__classPrivateFieldSet(this, _TempoGridCursor_m, 1.0, "f");
|
|
83
|
+
__classPrivateFieldSet(this, _TempoGridCursor_q, 0.0, "f");
|
|
84
|
+
}, _TempoGridCursor_bpmAt = function _TempoGridCursor_bpmAt(position) {
|
|
85
|
+
const events = __classPrivateFieldGet(this, _TempoGridCursor_events, "f");
|
|
86
|
+
if (events.length === 0) {
|
|
87
|
+
return __classPrivateFieldGet(this, _TempoGridCursor_storageBpm, "f");
|
|
88
|
+
}
|
|
89
|
+
const zone = __classPrivateFieldGet(this, _TempoGridCursor_instances, "m", _TempoGridCursor_zoneAt).call(this, position);
|
|
90
|
+
if (zone === __classPrivateFieldGet(this, _TempoGridCursor_segmentIndex, "f") && position === __classPrivateFieldGet(this, _TempoGridCursor_lastPPQN, "f") + TempoChangeGrid) {
|
|
91
|
+
__classPrivateFieldSet(this, _TempoGridCursor_lastPPQN, position, "f");
|
|
92
|
+
return __classPrivateFieldSet(this, _TempoGridCursor_lastBpm, __classPrivateFieldGet(this, _TempoGridCursor_m, "f") * __classPrivateFieldGet(this, _TempoGridCursor_lastBpm, "f") + __classPrivateFieldGet(this, _TempoGridCursor_q, "f"), "f");
|
|
93
|
+
}
|
|
94
|
+
__classPrivateFieldSet(this, _TempoGridCursor_segmentIndex, zone, "f");
|
|
95
|
+
__classPrivateFieldSet(this, _TempoGridCursor_lastPPQN, position, "f");
|
|
96
|
+
if (zone < 0) {
|
|
97
|
+
__classPrivateFieldSet(this, _TempoGridCursor_m, 1.0, "f");
|
|
98
|
+
__classPrivateFieldSet(this, _TempoGridCursor_q, 0.0, "f");
|
|
99
|
+
return __classPrivateFieldSet(this, _TempoGridCursor_lastBpm, zone === -1 ? events[0].value : events[events.length - 1].value, "f");
|
|
100
|
+
}
|
|
101
|
+
const a = events[zone];
|
|
102
|
+
const b = events[zone + 1];
|
|
103
|
+
const interpolation = a.interpolation;
|
|
104
|
+
if (interpolation.type === "none") {
|
|
105
|
+
__classPrivateFieldSet(this, _TempoGridCursor_m, 1.0, "f");
|
|
106
|
+
__classPrivateFieldSet(this, _TempoGridCursor_q, 0.0, "f");
|
|
107
|
+
return __classPrivateFieldSet(this, _TempoGridCursor_lastBpm, a.value, "f");
|
|
108
|
+
}
|
|
109
|
+
else if (interpolation.type === "linear") {
|
|
110
|
+
__classPrivateFieldSet(this, _TempoGridCursor_m, 1.0, "f");
|
|
111
|
+
__classPrivateFieldSet(this, _TempoGridCursor_q, (b.value - a.value) * TempoChangeGrid / (b.position - a.position), "f");
|
|
112
|
+
return __classPrivateFieldSet(this, _TempoGridCursor_lastBpm, a.value + (position - a.position) / (b.position - a.position) * (b.value - a.value), "f");
|
|
113
|
+
}
|
|
114
|
+
else {
|
|
115
|
+
const { m, q } = Curve.coefficients({
|
|
116
|
+
slope: interpolation.slope,
|
|
117
|
+
steps: (b.position - a.position) / TempoChangeGrid,
|
|
118
|
+
y0: a.value,
|
|
119
|
+
y1: b.value
|
|
120
|
+
});
|
|
121
|
+
__classPrivateFieldSet(this, _TempoGridCursor_m, m, "f");
|
|
122
|
+
__classPrivateFieldSet(this, _TempoGridCursor_q, q, "f");
|
|
123
|
+
return __classPrivateFieldSet(this, _TempoGridCursor_lastBpm, Curve.valueAt({
|
|
124
|
+
slope: interpolation.slope,
|
|
125
|
+
steps: b.position - a.position,
|
|
126
|
+
y0: a.value,
|
|
127
|
+
y1: b.value
|
|
128
|
+
}, position - a.position), "f");
|
|
129
|
+
}
|
|
130
|
+
}, _TempoGridCursor_zoneAt = function _TempoGridCursor_zoneAt(position) {
|
|
131
|
+
const events = __classPrivateFieldGet(this, _TempoGridCursor_events, "f");
|
|
132
|
+
if (position < events[0].position) {
|
|
133
|
+
return -1;
|
|
134
|
+
}
|
|
135
|
+
const last = events.length - 1;
|
|
136
|
+
if (position >= events[last].position) {
|
|
137
|
+
return -3;
|
|
138
|
+
}
|
|
139
|
+
let low = 0;
|
|
140
|
+
let high = last;
|
|
141
|
+
while (low < high) {
|
|
142
|
+
const mid = (low + high + 1) >> 1;
|
|
143
|
+
if (events[mid].position <= position) {
|
|
144
|
+
low = mid;
|
|
145
|
+
}
|
|
146
|
+
else {
|
|
147
|
+
high = mid - 1;
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
return low;
|
|
151
|
+
};
|
|
15
152
|
/**
|
|
16
153
|
* TempoMap implementation that handles varying tempo (tempo automation).
|
|
17
154
|
* Steps through at TempoChangeGrid intervals to match BlockRenderer behavior.
|
|
@@ -23,6 +160,7 @@ export class VaryingTempoMap {
|
|
|
23
160
|
_VaryingTempoMap_adapter.set(this, void 0);
|
|
24
161
|
_VaryingTempoMap_ppqnCache.set(this, []);
|
|
25
162
|
_VaryingTempoMap_secondsCache.set(this, []);
|
|
163
|
+
_VaryingTempoMap_cursor.set(this, new TempoGridCursor());
|
|
26
164
|
__classPrivateFieldSet(this, _VaryingTempoMap_adapter, adapter, "f");
|
|
27
165
|
__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)));
|
|
28
166
|
}
|
|
@@ -59,7 +197,7 @@ export class VaryingTempoMap {
|
|
|
59
197
|
return terminator;
|
|
60
198
|
}
|
|
61
199
|
}
|
|
62
|
-
_VaryingTempoMap_terminator = new WeakMap(), _VaryingTempoMap_adapter = new WeakMap(), _VaryingTempoMap_ppqnCache = new WeakMap(), _VaryingTempoMap_secondsCache = new WeakMap(), _VaryingTempoMap_instances = new WeakSet(), _VaryingTempoMap_rebuildCache = function _VaryingTempoMap_rebuildCache() {
|
|
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() {
|
|
63
201
|
__classPrivateFieldGet(this, _VaryingTempoMap_ppqnCache, "f").length = 0;
|
|
64
202
|
__classPrivateFieldGet(this, _VaryingTempoMap_secondsCache, "f").length = 0;
|
|
65
203
|
const tempoEvents = __classPrivateFieldGet(this, _VaryingTempoMap_adapter, "f").tempoTrackEvents;
|
|
@@ -80,14 +218,8 @@ _VaryingTempoMap_terminator = new WeakMap(), _VaryingTempoMap_adapter = new Weak
|
|
|
80
218
|
if (eventPosition <= currentPPQN) {
|
|
81
219
|
continue;
|
|
82
220
|
}
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
const nextGrid = quantizeCeil(currentPPQN, TempoChangeGrid);
|
|
86
|
-
const segmentEnd = nextGrid <= currentPPQN ? nextGrid + TempoChangeGrid : nextGrid;
|
|
87
|
-
const actualEnd = Math.min(segmentEnd, eventPosition);
|
|
88
|
-
accumulatedSeconds += PPQN.pulsesToSeconds(actualEnd - currentPPQN, currentBpm);
|
|
89
|
-
currentPPQN = actualEnd;
|
|
90
|
-
}
|
|
221
|
+
accumulatedSeconds += __classPrivateFieldGet(this, _VaryingTempoMap_cursor, "f").integrate(events, currentPPQN, eventPosition, storageBpm);
|
|
222
|
+
currentPPQN = eventPosition;
|
|
91
223
|
entries.push({ ppqn: eventPosition, seconds: accumulatedSeconds, bpm: collection.valueAt(eventPosition, storageBpm) });
|
|
92
224
|
}
|
|
93
225
|
__classPrivateFieldGet(this, _VaryingTempoMap_ppqnCache, "f").push(...entries);
|
|
@@ -106,6 +238,7 @@ _VaryingTempoMap_terminator = new WeakMap(), _VaryingTempoMap_adapter = new Weak
|
|
|
106
238
|
if (collection.events.isEmpty()) {
|
|
107
239
|
return PPQN.pulsesToSeconds(position, storageBpm);
|
|
108
240
|
}
|
|
241
|
+
const events = collection.events.asArray();
|
|
109
242
|
let startPPQN = 0.0;
|
|
110
243
|
let startSeconds = 0.0;
|
|
111
244
|
if (__classPrivateFieldGet(this, _VaryingTempoMap_ppqnCache, "f").length > 0) {
|
|
@@ -119,17 +252,7 @@ _VaryingTempoMap_terminator = new WeakMap(), _VaryingTempoMap_adapter = new Weak
|
|
|
119
252
|
}
|
|
120
253
|
}
|
|
121
254
|
}
|
|
122
|
-
|
|
123
|
-
let currentPPQN = startPPQN;
|
|
124
|
-
while (currentPPQN < position) {
|
|
125
|
-
const currentBpm = collection.valueAt(currentPPQN, storageBpm);
|
|
126
|
-
const nextGrid = quantizeCeil(currentPPQN, TempoChangeGrid);
|
|
127
|
-
const segmentEnd = nextGrid <= currentPPQN ? nextGrid + TempoChangeGrid : nextGrid;
|
|
128
|
-
const actualEnd = Math.min(segmentEnd, position);
|
|
129
|
-
accumulatedSeconds += PPQN.pulsesToSeconds(actualEnd - currentPPQN, currentBpm);
|
|
130
|
-
currentPPQN = actualEnd;
|
|
131
|
-
}
|
|
132
|
-
return accumulatedSeconds;
|
|
255
|
+
return startSeconds + __classPrivateFieldGet(this, _VaryingTempoMap_cursor, "f").integrate(events, startPPQN, position, storageBpm);
|
|
133
256
|
}, _VaryingTempoMap_absoluteSecondsToPPQN = function _VaryingTempoMap_absoluteSecondsToPPQN(targetSeconds) {
|
|
134
257
|
if (targetSeconds <= 0) {
|
|
135
258
|
return 0.0;
|
|
@@ -143,6 +266,7 @@ _VaryingTempoMap_terminator = new WeakMap(), _VaryingTempoMap_adapter = new Weak
|
|
|
143
266
|
if (collection.events.isEmpty()) {
|
|
144
267
|
return PPQN.secondsToPulses(targetSeconds, storageBpm);
|
|
145
268
|
}
|
|
269
|
+
const events = collection.events.asArray();
|
|
146
270
|
let startPPQN = 0.0;
|
|
147
271
|
let startSeconds = 0.0;
|
|
148
272
|
if (__classPrivateFieldGet(this, _VaryingTempoMap_secondsCache, "f").length > 0) {
|
|
@@ -156,21 +280,5 @@ _VaryingTempoMap_terminator = new WeakMap(), _VaryingTempoMap_adapter = new Weak
|
|
|
156
280
|
}
|
|
157
281
|
}
|
|
158
282
|
}
|
|
159
|
-
|
|
160
|
-
let accumulatedPPQN = startPPQN;
|
|
161
|
-
while (accumulatedSeconds < targetSeconds) {
|
|
162
|
-
const currentBpm = collection.valueAt(accumulatedPPQN, storageBpm);
|
|
163
|
-
const nextGrid = quantizeCeil(accumulatedPPQN, TempoChangeGrid);
|
|
164
|
-
const segmentEnd = nextGrid <= accumulatedPPQN ? nextGrid + TempoChangeGrid : nextGrid;
|
|
165
|
-
const segmentPPQN = segmentEnd - accumulatedPPQN;
|
|
166
|
-
const segmentSeconds = PPQN.pulsesToSeconds(segmentPPQN, currentBpm);
|
|
167
|
-
if (accumulatedSeconds + segmentSeconds >= targetSeconds) {
|
|
168
|
-
const remainingSeconds = targetSeconds - accumulatedSeconds;
|
|
169
|
-
accumulatedPPQN += PPQN.secondsToPulses(remainingSeconds, currentBpm);
|
|
170
|
-
break;
|
|
171
|
-
}
|
|
172
|
-
accumulatedSeconds += segmentSeconds;
|
|
173
|
-
accumulatedPPQN = segmentEnd;
|
|
174
|
-
}
|
|
175
|
-
return accumulatedPPQN;
|
|
283
|
+
return __classPrivateFieldGet(this, _VaryingTempoMap_cursor, "f").advance(events, startPPQN, startSeconds, targetSeconds, storageBpm);
|
|
176
284
|
};
|
|
@@ -19,7 +19,7 @@ export declare const EngineSettingsSchema: z.ZodObject<{
|
|
|
19
19
|
allowTakes: z.ZodBoolean;
|
|
20
20
|
automationEnabled: z.ZodBoolean;
|
|
21
21
|
olderTakeAction: z.ZodUnion<z.ZodLiteral<"disable-track" | "mute-region">[]>;
|
|
22
|
-
olderTakeScope: z.ZodUnion<z.ZodLiteral<"all" | "previous-only">[]>;
|
|
22
|
+
olderTakeScope: z.ZodUnion<z.ZodLiteral<"none" | "all" | "previous-only">[]>;
|
|
23
23
|
}, z.core.$strip>>;
|
|
24
24
|
}, z.core.$strip>;
|
|
25
25
|
export type EngineSettings = z.infer<typeof EngineSettingsSchema>;
|
|
@@ -27,6 +27,6 @@ export declare namespace EngineSettings {
|
|
|
27
27
|
const BeatSubDivisionOptions: readonly [1, 2, 4, 8];
|
|
28
28
|
const RecordingCountInBars: readonly [1, 2, 3, 4, 5, 6, 7, 8];
|
|
29
29
|
const OlderTakeActionOptions: readonly ["disable-track", "mute-region"];
|
|
30
|
-
const OlderTakeScopeOptions: readonly ["all", "previous-only"];
|
|
30
|
+
const OlderTakeScopeOptions: readonly ["none", "all", "previous-only"];
|
|
31
31
|
}
|
|
32
32
|
//# sourceMappingURL=EnginePreferencesSchema.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EnginePreferencesSchema.d.ts","sourceRoot":"","sources":["../../src/engine/EnginePreferencesSchema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAA;AAOrB,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;iBAuC/B,CAAA;AAEF,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAA;AAEjE,yBAAiB,cAAc,CAAC;IACrB,MAAM,sBAAsB,uBAA0B,CAAA;IACtD,MAAM,oBAAoB,mCAAwB,CAAA;IAClD,MAAM,sBAAsB,2CAA0B,CAAA;IACtD,MAAM,qBAAqB,
|
|
1
|
+
{"version":3,"file":"EnginePreferencesSchema.d.ts","sourceRoot":"","sources":["../../src/engine/EnginePreferencesSchema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAA;AAOrB,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;iBAuC/B,CAAA;AAEF,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAA;AAEjE,yBAAiB,cAAc,CAAC;IACrB,MAAM,sBAAsB,uBAA0B,CAAA;IACtD,MAAM,oBAAoB,mCAAwB,CAAA;IAClD,MAAM,sBAAsB,2CAA0B,CAAA;IACtD,MAAM,qBAAqB,2CAAyB,CAAA;CAC9D"}
|
|
@@ -2,7 +2,7 @@ import { z } from "zod";
|
|
|
2
2
|
const _BeatSubDivisionOptions = [1, 2, 4, 8];
|
|
3
3
|
const _RecordingCountInBars = [1, 2, 3, 4, 5, 6, 7, 8];
|
|
4
4
|
const _OlderTakeActionOptions = ["disable-track", "mute-region"];
|
|
5
|
-
const _OlderTakeScopeOptions = ["all", "previous-only"];
|
|
5
|
+
const _OlderTakeScopeOptions = ["none", "all", "previous-only"];
|
|
6
6
|
export const EngineSettingsSchema = z.object({
|
|
7
7
|
metronome: z.object({
|
|
8
8
|
enabled: z.boolean(),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@opendaw/studio-adapters",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.111",
|
|
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.86",
|
|
27
|
+
"@opendaw/lib-dsp": "^0.0.84",
|
|
28
|
+
"@opendaw/lib-fusion": "^0.0.94",
|
|
29
|
+
"@opendaw/lib-runtime": "^0.0.79",
|
|
30
|
+
"@opendaw/lib-std": "^0.0.78",
|
|
31
|
+
"@opendaw/studio-boxes": "^0.0.91",
|
|
32
|
+
"@opendaw/studio-enums": "^0.0.75",
|
|
33
33
|
"soundfont2": "^0.5.0"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
36
|
"@opendaw/eslint-config": "^0.0.28",
|
|
37
|
-
"@opendaw/typescript-config": "^0.0.
|
|
37
|
+
"@opendaw/typescript-config": "^0.0.32"
|
|
38
38
|
},
|
|
39
|
-
"gitHead": "
|
|
39
|
+
"gitHead": "513f0659d9ce582c3b75839310a717a3be22cfa4"
|
|
40
40
|
}
|