@waveform-playlist/playout 11.1.0 → 11.2.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.mjs CHANGED
@@ -1532,6 +1532,26 @@ var SoundFontCache = class {
1532
1532
  // src/audioContext.ts
1533
1533
  import { Context, setContext } from "tone";
1534
1534
  var globalToneContext = null;
1535
+ function configureGlobalContext(options) {
1536
+ if (globalToneContext) {
1537
+ const existingRate = globalToneContext.rawContext.sampleRate;
1538
+ if (options.sampleRate !== void 0 && options.sampleRate !== existingRate) {
1539
+ console.warn(
1540
+ "[playout] configureGlobalContext: context already created at " + existingRate + " Hz (requested " + options.sampleRate + " Hz). Call configureGlobalContext before any audio operations for sample rate control."
1541
+ );
1542
+ }
1543
+ return existingRate;
1544
+ }
1545
+ globalToneContext = new Context();
1546
+ setContext(globalToneContext);
1547
+ const actualRate = globalToneContext.rawContext.sampleRate;
1548
+ if (options.sampleRate !== void 0 && options.sampleRate !== actualRate) {
1549
+ console.warn(
1550
+ "[playout] Requested sampleRate " + options.sampleRate + " but AudioContext is running at " + actualRate + " \u2014 pre-computed peaks at " + options.sampleRate + " Hz will fall back to worker"
1551
+ );
1552
+ }
1553
+ return actualRate;
1554
+ }
1535
1555
  function getGlobalContext() {
1536
1556
  if (!globalToneContext) {
1537
1557
  globalToneContext = new Context();
@@ -1884,6 +1904,7 @@ export {
1884
1904
  applyFadeOut,
1885
1905
  calculatePlaybackRate,
1886
1906
  closeGlobalAudioContext,
1907
+ configureGlobalContext,
1887
1908
  createToneAdapter,
1888
1909
  extractLoopAndEnvelope,
1889
1910
  getGeneratorValue,