cacophony 0.5.21 → 0.5.22
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/cacophony.cjs.js +1 -1
- package/dist/cacophony.cjs.js.map +1 -1
- package/dist/cacophony.es.js +5 -6
- package/dist/cacophony.es.js.map +1 -1
- package/dist/cacophony.iife.js +1 -1
- package/dist/cacophony.iife.js.map +1 -1
- package/dist/cacophony.umd.js +1 -1
- package/dist/cacophony.umd.js.map +1 -1
- package/dist/playback.d.ts +4 -5
- package/docs/assets/search.js +1 -1
- package/docs/classes/Cacophony.html +5 -5
- package/docs/classes/Group.html +3 -3
- package/docs/classes/MicrophonePlayback.html +2 -2
- package/docs/classes/MicrophoneStream.html +3 -3
- package/docs/classes/Playback.html +30 -31
- package/docs/classes/Sound.html +18 -18
- package/docs/enums/SoundType.html +2 -2
- package/docs/interfaces/BaseSound.html +2 -2
- package/docs/types/FadeType.html +1 -1
- package/docs/types/LoopCount.html +1 -1
- package/docs/types/Orientation.html +1 -1
- package/docs/types/PanType.html +1 -1
- package/docs/types/Position.html +1 -1
- package/package.json +1 -1
- package/src/playback.ts +13 -10
package/dist/cacophony.es.js
CHANGED
|
@@ -167,7 +167,6 @@ class u extends d {
|
|
|
167
167
|
loopCount = 0;
|
|
168
168
|
currentLoop = 0;
|
|
169
169
|
buffer;
|
|
170
|
-
playing = !1;
|
|
171
170
|
/**
|
|
172
171
|
* Gets the stereo panning value.
|
|
173
172
|
* @returns {number | null} The current stereo pan value, or null if stereo panning is not applicable.
|
|
@@ -230,10 +229,10 @@ class u extends d {
|
|
|
230
229
|
handleLoop = () => {
|
|
231
230
|
if (!(!this.source || !this.panner)) {
|
|
232
231
|
if (this.loopCount !== "infinite" && this.currentLoop > this.loopCount) {
|
|
233
|
-
this.
|
|
232
|
+
this.stop();
|
|
234
233
|
return;
|
|
235
234
|
}
|
|
236
|
-
this.loopCount !== "infinite" && this.currentLoop++, this.buffer ? (this.source = this.context.createBufferSource(), this.source.buffer = this.buffer, this.source.connect(this.panner), this.source.onended = this.handleLoop.bind(this), (this.loopCount === "infinite" || this.currentLoop <= this.loopCount) && this.source.start(0)) : this.seek(0)
|
|
235
|
+
this.loopCount !== "infinite" && this.currentLoop++, this.buffer ? (this.source = this.context.createBufferSource(), this.source.buffer = this.buffer, this.source.connect(this.panner), this.source.onended = this.handleLoop.bind(this), (this.loopCount === "infinite" || this.currentLoop <= this.loopCount) && this.source.start(0)) : this.seek(0);
|
|
237
236
|
}
|
|
238
237
|
};
|
|
239
238
|
/**
|
|
@@ -244,7 +243,7 @@ class u extends d {
|
|
|
244
243
|
play() {
|
|
245
244
|
if (!this.source)
|
|
246
245
|
throw new Error("Cannot play a sound that has been cleaned up");
|
|
247
|
-
return "mediaElement" in this.source && this.source.mediaElement ? this.source.mediaElement.play() : "start" in this.source && this.source.start && this.source.start(),
|
|
246
|
+
return "mediaElement" in this.source && this.source.mediaElement ? this.source.mediaElement.play() : "start" in this.source && this.source.start && this.source.start(), [this];
|
|
248
247
|
}
|
|
249
248
|
/**
|
|
250
249
|
* Gets the 3D audio options if HRTF panning is used.
|
|
@@ -409,7 +408,7 @@ class u extends d {
|
|
|
409
408
|
isPlaying() {
|
|
410
409
|
if (!this.source)
|
|
411
410
|
throw new Error("Cannot check if a sound is playing that has been cleaned up");
|
|
412
|
-
return this.
|
|
411
|
+
return "mediaElement" in this.source && this.source.mediaElement ? !this.source.mediaElement.paused : "playbackState" in this.source ? this.source.playbackState === "running" : !1;
|
|
413
412
|
}
|
|
414
413
|
/**
|
|
415
414
|
* Cleans up resources used by the Playback instance.
|
|
@@ -443,7 +442,7 @@ class u extends d {
|
|
|
443
442
|
stop() {
|
|
444
443
|
if (!this.source)
|
|
445
444
|
throw new Error("Cannot stop a sound that has been cleaned up");
|
|
446
|
-
this.isPlaying() && ("stop" in this.source && this.source.stop(), "mediaElement" in this.source && this.source.mediaElement && (this.source.mediaElement.pause(), this.source.mediaElement.currentTime = 0)
|
|
445
|
+
this.isPlaying() && ("stop" in this.source && this.source.stop(), "mediaElement" in this.source && this.source.mediaElement && (this.source.mediaElement.pause(), this.source.mediaElement.currentTime = 0));
|
|
447
446
|
}
|
|
448
447
|
/**
|
|
449
448
|
* Pauses the audio playback.
|