@waveform-playlist/playout 12.0.0 → 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 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +42 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +42 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.d.mts
CHANGED
|
@@ -602,6 +602,8 @@ interface ToneAdapterOptions {
|
|
|
602
602
|
effects?: EffectsFunction;
|
|
603
603
|
/** When provided, MIDI clips use SoundFont sample playback instead of PolySynth */
|
|
604
604
|
soundFontCache?: SoundFontCache;
|
|
605
|
+
/** Pulses per quarter note. Defaults to 192 (Tone.js native). */
|
|
606
|
+
ppqn?: number;
|
|
605
607
|
}
|
|
606
608
|
declare function createToneAdapter(options?: ToneAdapterOptions): PlayoutAdapter;
|
|
607
609
|
|
package/dist/index.d.ts
CHANGED
|
@@ -602,6 +602,8 @@ interface ToneAdapterOptions {
|
|
|
602
602
|
effects?: EffectsFunction;
|
|
603
603
|
/** When provided, MIDI clips use SoundFont sample playback instead of PolySynth */
|
|
604
604
|
soundFontCache?: SoundFontCache;
|
|
605
|
+
/** Pulses per quarter note. Defaults to 192 (Tone.js native). */
|
|
606
|
+
ppqn?: number;
|
|
605
607
|
}
|
|
606
608
|
declare function createToneAdapter(options?: ToneAdapterOptions): PlayoutAdapter;
|
|
607
609
|
|
package/dist/index.js
CHANGED
|
@@ -1634,6 +1634,8 @@ function createToneAdapter(options) {
|
|
|
1634
1634
|
let _loopEnd = 0;
|
|
1635
1635
|
let _audioInitialized = false;
|
|
1636
1636
|
let _pendingInit = null;
|
|
1637
|
+
const _ppqn = options?.ppqn ?? 192;
|
|
1638
|
+
let _bpm = 120;
|
|
1637
1639
|
function addTrackToPlayout(p, track) {
|
|
1638
1640
|
const audioClips = track.clips.filter((c) => c.audioBuffer && !c.midiNotes);
|
|
1639
1641
|
const midiClips = track.clips.filter((c) => c.midiNotes && c.midiNotes.length > 0);
|
|
@@ -1887,11 +1889,50 @@ function createToneAdapter(options) {
|
|
|
1887
1889
|
_loopEnd = end;
|
|
1888
1890
|
playout?.setLoop(enabled, start2, end);
|
|
1889
1891
|
},
|
|
1892
|
+
get audioContext() {
|
|
1893
|
+
return getGlobalAudioContext();
|
|
1894
|
+
},
|
|
1895
|
+
get ppqn() {
|
|
1896
|
+
return _ppqn;
|
|
1897
|
+
},
|
|
1898
|
+
setTempo(bpm, atTick) {
|
|
1899
|
+
if (atTick !== void 0) {
|
|
1900
|
+
throw new Error(
|
|
1901
|
+
"Multiple tempo changes not supported by TonePlayoutAdapter. Use NativePlayoutAdapter from @dawcore/transport for multi-tempo support."
|
|
1902
|
+
);
|
|
1903
|
+
}
|
|
1904
|
+
_bpm = bpm;
|
|
1905
|
+
},
|
|
1906
|
+
setMeter(_numerator, _denominator, atTick) {
|
|
1907
|
+
if (atTick !== void 0) {
|
|
1908
|
+
throw new Error(
|
|
1909
|
+
"Multiple meter changes not supported by TonePlayoutAdapter. Use NativePlayoutAdapter from @dawcore/transport for multi-meter support."
|
|
1910
|
+
);
|
|
1911
|
+
}
|
|
1912
|
+
},
|
|
1913
|
+
ticksToSeconds(tick) {
|
|
1914
|
+
return tick * 60 / (_bpm * _ppqn);
|
|
1915
|
+
},
|
|
1916
|
+
secondsToTicks(seconds) {
|
|
1917
|
+
return seconds * _bpm * _ppqn / 60;
|
|
1918
|
+
},
|
|
1919
|
+
// --- Cross-context worklet support ---
|
|
1920
|
+
// Tone.js wraps standardized-audio-context. Native AudioWorkletNode constructor
|
|
1921
|
+
// rejects it ("parameter 1 is not of type 'BaseAudioContext'").
|
|
1922
|
+
// These methods use Tone.js Context wrappers that handle both context types.
|
|
1923
|
+
// Note: addWorkletModule is NOT needed — rawContext.audioWorklet.addModule() works
|
|
1924
|
+
// identically for both native and standardized contexts. Only node/source creation differs.
|
|
1925
|
+
createAudioWorkletNode(name, options2) {
|
|
1926
|
+
return getGlobalContext().createAudioWorkletNode(name, options2);
|
|
1927
|
+
},
|
|
1928
|
+
createMediaStreamSource(stream) {
|
|
1929
|
+
return getGlobalContext().createMediaStreamSource(stream);
|
|
1930
|
+
},
|
|
1890
1931
|
dispose() {
|
|
1891
1932
|
try {
|
|
1892
1933
|
playout?.dispose();
|
|
1893
1934
|
} catch (err) {
|
|
1894
|
-
console.warn("[waveform-playlist] Error disposing playout:"
|
|
1935
|
+
console.warn("[waveform-playlist] Error disposing playout: " + String(err));
|
|
1895
1936
|
}
|
|
1896
1937
|
playout = null;
|
|
1897
1938
|
_isPlaying = false;
|