@waveform-playlist/playout 11.3.1 → 12.1.0
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.d.mts +2 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +42 -5
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +42 -3
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
package/dist/index.mjs
CHANGED
|
@@ -1627,6 +1627,8 @@ function createToneAdapter(options) {
|
|
|
1627
1627
|
let _loopEnd = 0;
|
|
1628
1628
|
let _audioInitialized = false;
|
|
1629
1629
|
let _pendingInit = null;
|
|
1630
|
+
const _ppqn = options?.ppqn ?? 192;
|
|
1631
|
+
let _bpm = 120;
|
|
1630
1632
|
function addTrackToPlayout(p, track) {
|
|
1631
1633
|
const audioClips = track.clips.filter((c) => c.audioBuffer && !c.midiNotes);
|
|
1632
1634
|
const midiClips = track.clips.filter((c) => c.midiNotes && c.midiNotes.length > 0);
|
|
@@ -1880,11 +1882,50 @@ function createToneAdapter(options) {
|
|
|
1880
1882
|
_loopEnd = end;
|
|
1881
1883
|
playout?.setLoop(enabled, start2, end);
|
|
1882
1884
|
},
|
|
1885
|
+
get audioContext() {
|
|
1886
|
+
return getGlobalAudioContext();
|
|
1887
|
+
},
|
|
1888
|
+
get ppqn() {
|
|
1889
|
+
return _ppqn;
|
|
1890
|
+
},
|
|
1891
|
+
setTempo(bpm, atTick) {
|
|
1892
|
+
if (atTick !== void 0) {
|
|
1893
|
+
throw new Error(
|
|
1894
|
+
"Multiple tempo changes not supported by TonePlayoutAdapter. Use NativePlayoutAdapter from @dawcore/transport for multi-tempo support."
|
|
1895
|
+
);
|
|
1896
|
+
}
|
|
1897
|
+
_bpm = bpm;
|
|
1898
|
+
},
|
|
1899
|
+
setMeter(_numerator, _denominator, atTick) {
|
|
1900
|
+
if (atTick !== void 0) {
|
|
1901
|
+
throw new Error(
|
|
1902
|
+
"Multiple meter changes not supported by TonePlayoutAdapter. Use NativePlayoutAdapter from @dawcore/transport for multi-meter support."
|
|
1903
|
+
);
|
|
1904
|
+
}
|
|
1905
|
+
},
|
|
1906
|
+
ticksToSeconds(tick) {
|
|
1907
|
+
return tick * 60 / (_bpm * _ppqn);
|
|
1908
|
+
},
|
|
1909
|
+
secondsToTicks(seconds) {
|
|
1910
|
+
return seconds * _bpm * _ppqn / 60;
|
|
1911
|
+
},
|
|
1912
|
+
// --- Cross-context worklet support ---
|
|
1913
|
+
// Tone.js wraps standardized-audio-context. Native AudioWorkletNode constructor
|
|
1914
|
+
// rejects it ("parameter 1 is not of type 'BaseAudioContext'").
|
|
1915
|
+
// These methods use Tone.js Context wrappers that handle both context types.
|
|
1916
|
+
// Note: addWorkletModule is NOT needed — rawContext.audioWorklet.addModule() works
|
|
1917
|
+
// identically for both native and standardized contexts. Only node/source creation differs.
|
|
1918
|
+
createAudioWorkletNode(name, options2) {
|
|
1919
|
+
return getGlobalContext().createAudioWorkletNode(name, options2);
|
|
1920
|
+
},
|
|
1921
|
+
createMediaStreamSource(stream) {
|
|
1922
|
+
return getGlobalContext().createMediaStreamSource(stream);
|
|
1923
|
+
},
|
|
1883
1924
|
dispose() {
|
|
1884
1925
|
try {
|
|
1885
1926
|
playout?.dispose();
|
|
1886
1927
|
} catch (err) {
|
|
1887
|
-
console.warn("[waveform-playlist] Error disposing playout:"
|
|
1928
|
+
console.warn("[waveform-playlist] Error disposing playout: " + String(err));
|
|
1888
1929
|
}
|
|
1889
1930
|
playout = null;
|
|
1890
1931
|
_isPlaying = false;
|
|
@@ -1897,8 +1938,6 @@ export {
|
|
|
1897
1938
|
SoundFontToneTrack,
|
|
1898
1939
|
TonePlayout,
|
|
1899
1940
|
ToneTrack,
|
|
1900
|
-
applyFadeIn,
|
|
1901
|
-
applyFadeOut,
|
|
1902
1941
|
calculatePlaybackRate,
|
|
1903
1942
|
closeGlobalAudioContext,
|
|
1904
1943
|
configureGlobalContext,
|