@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.js
CHANGED
|
@@ -1870,9 +1870,11 @@ function createToneAdapter(options) {
|
|
|
1870
1870
|
getGlobalContext();
|
|
1871
1871
|
let _playoutGeneration = 1;
|
|
1872
1872
|
let playout = new TonePlayout({ effects: options?.effects });
|
|
1873
|
+
let _onPlaybackEnded = null;
|
|
1873
1874
|
playout.setOnPlaybackComplete(() => {
|
|
1874
1875
|
if (_playoutGeneration === 1) {
|
|
1875
1876
|
_isPlaying = false;
|
|
1877
|
+
_onPlaybackEnded?.();
|
|
1876
1878
|
}
|
|
1877
1879
|
});
|
|
1878
1880
|
let _isPlaying = false;
|
|
@@ -2005,6 +2007,7 @@ function createToneAdapter(options) {
|
|
|
2005
2007
|
playout.setOnPlaybackComplete(() => {
|
|
2006
2008
|
if (generation === _playoutGeneration) {
|
|
2007
2009
|
_isPlaying = false;
|
|
2010
|
+
_onPlaybackEnded?.();
|
|
2008
2011
|
}
|
|
2009
2012
|
});
|
|
2010
2013
|
}
|
|
@@ -2164,6 +2167,9 @@ function createToneAdapter(options) {
|
|
|
2164
2167
|
isPlaying() {
|
|
2165
2168
|
return _isPlaying;
|
|
2166
2169
|
},
|
|
2170
|
+
onPlaybackEnded(callback) {
|
|
2171
|
+
_onPlaybackEnded = callback;
|
|
2172
|
+
},
|
|
2167
2173
|
setMasterVolume(volume) {
|
|
2168
2174
|
playout?.setMasterGain(volume);
|
|
2169
2175
|
},
|
|
@@ -2229,7 +2235,13 @@ function createToneAdapter(options) {
|
|
|
2229
2235
|
ticksToSeconds(tick) {
|
|
2230
2236
|
return tick * 60 / (_bpm * _ppqn);
|
|
2231
2237
|
},
|
|
2238
|
+
/** Integer tick (engine `PlayoutAdapter.secondsToTicks` contract): the
|
|
2239
|
+
* exact position rounded once here, as NativePlayoutAdapter does. */
|
|
2232
2240
|
secondsToTicks(seconds) {
|
|
2241
|
+
return Math.round(seconds * _bpm * _ppqn / 60);
|
|
2242
|
+
},
|
|
2243
|
+
/** Fractional tick position (engine `PlayoutAdapter.secondsToTicksExact`). */
|
|
2244
|
+
secondsToTicksExact(seconds) {
|
|
2233
2245
|
return seconds * _bpm * _ppqn / 60;
|
|
2234
2246
|
},
|
|
2235
2247
|
// --- Cross-context worklet support ---
|
|
@@ -2295,6 +2307,7 @@ function createToneAdapter(options) {
|
|
|
2295
2307
|
}
|
|
2296
2308
|
playout = null;
|
|
2297
2309
|
_isPlaying = false;
|
|
2310
|
+
_onPlaybackEnded = null;
|
|
2298
2311
|
_currentTracks.clear();
|
|
2299
2312
|
_midiTrackBuild.clear();
|
|
2300
2313
|
}
|