@series-inc/rundot-3d-engine 0.6.3 → 0.6.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.
@@ -1589,13 +1589,27 @@ async function PopulateAudioBank3D(systemInstance, audioBank, clips) {
1589
1589
  await Promise.all(loadPromises);
1590
1590
  }
1591
1591
  function PlayAudioOneShot2D(audioBank, audioClip) {
1592
- if (!audioBank[audioClip]) {
1592
+ const audio = audioBank[audioClip];
1593
+ if (!audio) {
1593
1594
  throw new Error(`Audio clip not found in bank: ${audioClip}`);
1594
1595
  }
1595
- if (!audioBank[audioClip].buffer) {
1596
+ if (!audio.buffer) {
1596
1597
  throw new Error(`Audio clip not loaded yet: ${audioClip}`);
1597
1598
  }
1598
- audioBank[audioClip].play();
1599
+ const ctx = audio.context;
1600
+ const source = ctx.createBufferSource();
1601
+ source.buffer = audio.buffer;
1602
+ source.playbackRate.value = audio.playbackRate;
1603
+ const gain = ctx.createGain();
1604
+ gain.gain.value = audio.getVolume();
1605
+ source.connect(gain);
1606
+ const filters = audio.filters;
1607
+ if (filters && filters.length > 0) {
1608
+ gain.connect(filters[0]);
1609
+ } else {
1610
+ gain.connect(ctx.destination);
1611
+ }
1612
+ source.start(0);
1599
1613
  }
1600
1614
  function PlayAudioRandom2D(audioBank, clipNames) {
1601
1615
  if (!Array.isArray(clipNames) || clipNames.length === 0) {
@@ -6153,4 +6167,4 @@ export {
6153
6167
  PrefabLoader,
6154
6168
  StowKitSystem
6155
6169
  };
6156
- //# sourceMappingURL=chunk-3YI5JLCR.js.map
6170
+ //# sourceMappingURL=chunk-CIAGTANU.js.map