|
|
|
|
@ -292,6 +292,8 @@ export function FreeFlow(){ |
|
|
|
|
} |
|
|
|
|
function fadeOutAudio(callback){ |
|
|
|
|
|
|
|
|
|
if(refVolDownInterval.current) clearInterval(refVolDownInterval.current); |
|
|
|
|
|
|
|
|
|
if(refAudio.current || refAudioAnnounce.current){ |
|
|
|
|
console.log('Fading out audio'); |
|
|
|
|
|
|
|
|
|
@ -308,10 +310,9 @@ export function FreeFlow(){ |
|
|
|
|
if (audio.volume > 0) { |
|
|
|
|
audio.volume =Math.max(0, audio.volume - 1.0/(AUDIO_FADE_TIME/100)); // Decrease volume gradually |
|
|
|
|
} else { |
|
|
|
|
clearInterval(fadeOutInterval); |
|
|
|
|
audio.pause(); |
|
|
|
|
audio.volume = 0; // Reset volume for next play |
|
|
|
|
if(callback) callback(); |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@ -319,10 +320,15 @@ export function FreeFlow(){ |
|
|
|
|
if (announce.volume > 0) { |
|
|
|
|
announce.volume = Math.max(0, announce.volume - 1.0/(AUDIO_FADE_TIME/100)); // Decrease volume gradually |
|
|
|
|
} else { |
|
|
|
|
clearInterval(fadeOutInterval); |
|
|
|
|
//clearInterval(fadeOutInterval); |
|
|
|
|
announce.pause(); |
|
|
|
|
announce.volume = 0; // Reset volume for next play |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if(audio?.volume==0 && announce?.volume==0){ |
|
|
|
|
clearInterval(fadeOutInterval); |
|
|
|
|
if(callback) callback(); |
|
|
|
|
} |
|
|
|
|
}, 100); // Decrease volume every 100ms |
|
|
|
|
|
|
|
|
|
refFadeOutInterval.current=fadeOutInterval; |
|
|
|
|
|