fix: prevent audio processing when no audio source is loaded
This commit is contained in:
parent
fca971e13c
commit
610d8350af
1 changed files with 4 additions and 2 deletions
|
@ -31,10 +31,10 @@ export default defineComponent({
|
||||||
// Use the global audio loading queue to throttle concurrent loads
|
// Use the global audio loading queue to throttle concurrent loads
|
||||||
const preloadAudio = (src: string) => {
|
const preloadAudio = (src: string) => {
|
||||||
console.debug(`[AUDIOAREA] Queueing audio for preload: ${src}`);
|
console.debug(`[AUDIOAREA] Queueing audio for preload: ${src}`);
|
||||||
|
|
||||||
// Set audioSrc to empty initially
|
// Set audioSrc to empty initially
|
||||||
audioSrc.value = "";
|
audioSrc.value = "";
|
||||||
|
|
||||||
// Queue the audio for loading through our global service
|
// Queue the audio for loading through our global service
|
||||||
// Our improved AudioLoader will cache and deduplicate requests
|
// Our improved AudioLoader will cache and deduplicate requests
|
||||||
queueAudioForLoading(src)
|
queueAudioForLoading(src)
|
||||||
|
@ -60,6 +60,8 @@ export default defineComponent({
|
||||||
const vol_b = 1 - vol_x;
|
const vol_b = 1 - vol_x;
|
||||||
|
|
||||||
const onBBoxChange = () => {
|
const onBBoxChange = () => {
|
||||||
|
if (!audioSrc.value) return;
|
||||||
|
|
||||||
const x = props.bbox.x + props.bbox.w / 2;
|
const x = props.bbox.x + props.bbox.w / 2;
|
||||||
const y = props.bbox.y + props.bbox.h / 2;
|
const y = props.bbox.y + props.bbox.h / 2;
|
||||||
const distance = Math.sqrt(
|
const distance = Math.sqrt(
|
||||||
|
|
Loading…
Add table
Reference in a new issue