@waveform-playlist/playout 12.5.3 → 12.5.5
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/index.js +13 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +13 -0
- package/dist/index.mjs.map +1 -1
- package/package.json +4 -4
package/dist/index.mjs
CHANGED
|
@@ -1853,9 +1853,11 @@ function createToneAdapter(options) {
|
|
|
1853
1853
|
getGlobalContext();
|
|
1854
1854
|
let _playoutGeneration = 1;
|
|
1855
1855
|
let playout = new TonePlayout({ effects: options?.effects });
|
|
1856
|
+
let _onPlaybackEnded = null;
|
|
1856
1857
|
playout.setOnPlaybackComplete(() => {
|
|
1857
1858
|
if (_playoutGeneration === 1) {
|
|
1858
1859
|
_isPlaying = false;
|
|
1860
|
+
_onPlaybackEnded?.();
|
|
1859
1861
|
}
|
|
1860
1862
|
});
|
|
1861
1863
|
let _isPlaying = false;
|
|
@@ -1988,6 +1990,7 @@ function createToneAdapter(options) {
|
|
|
1988
1990
|
playout.setOnPlaybackComplete(() => {
|
|
1989
1991
|
if (generation === _playoutGeneration) {
|
|
1990
1992
|
_isPlaying = false;
|
|
1993
|
+
_onPlaybackEnded?.();
|
|
1991
1994
|
}
|
|
1992
1995
|
});
|
|
1993
1996
|
}
|
|
@@ -2147,6 +2150,9 @@ function createToneAdapter(options) {
|
|
|
2147
2150
|
isPlaying() {
|
|
2148
2151
|
return _isPlaying;
|
|
2149
2152
|
},
|
|
2153
|
+
onPlaybackEnded(callback) {
|
|
2154
|
+
_onPlaybackEnded = callback;
|
|
2155
|
+
},
|
|
2150
2156
|
setMasterVolume(volume) {
|
|
2151
2157
|
playout?.setMasterGain(volume);
|
|
2152
2158
|
},
|
|
@@ -2212,7 +2218,13 @@ function createToneAdapter(options) {
|
|
|
2212
2218
|
ticksToSeconds(tick) {
|
|
2213
2219
|
return tick * 60 / (_bpm * _ppqn);
|
|
2214
2220
|
},
|
|
2221
|
+
/** Integer tick (engine `PlayoutAdapter.secondsToTicks` contract): the
|
|
2222
|
+
* exact position rounded once here, as NativePlayoutAdapter does. */
|
|
2215
2223
|
secondsToTicks(seconds) {
|
|
2224
|
+
return Math.round(seconds * _bpm * _ppqn / 60);
|
|
2225
|
+
},
|
|
2226
|
+
/** Fractional tick position (engine `PlayoutAdapter.secondsToTicksExact`). */
|
|
2227
|
+
secondsToTicksExact(seconds) {
|
|
2216
2228
|
return seconds * _bpm * _ppqn / 60;
|
|
2217
2229
|
},
|
|
2218
2230
|
// --- Cross-context worklet support ---
|
|
@@ -2278,6 +2290,7 @@ function createToneAdapter(options) {
|
|
|
2278
2290
|
}
|
|
2279
2291
|
playout = null;
|
|
2280
2292
|
_isPlaying = false;
|
|
2293
|
+
_onPlaybackEnded = null;
|
|
2281
2294
|
_currentTracks.clear();
|
|
2282
2295
|
_midiTrackBuild.clear();
|
|
2283
2296
|
}
|