From ba7cd4308d21505455fdc522403e1158c8253d7f Mon Sep 17 00:00:00 2001 From: Minteck Date: Sun, 6 Jun 2021 02:09:46 +0200 Subject: Fix audio --- views/script/core_music.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'views/script/core_music.js') diff --git a/views/script/core_music.js b/views/script/core_music.js index d1e8619..adb0ae2 100644 --- a/views/script/core_music.js +++ b/views/script/core_music.js @@ -5,6 +5,8 @@ global.cspn = 1; const musicIpc = require('electron').ipcRenderer; musicIpc.on('setmusic', (event, args) => { + try { csp1.volume = 0; } catch (e) {} + try { csp2.volume = 0; } catch (e) {} song = args; if (song !== null && song !== "" && csng !== song) { @@ -13,6 +15,7 @@ musicIpc.on('setmusic', (event, args) => { csi1 = setInterval(() => { if (csp1.volume <= 0.05) { csp1.pause(); + csp1.volume = 0; clearInterval(csi1); return; } @@ -37,6 +40,7 @@ musicIpc.on('setmusic', (event, args) => { csi2 = setInterval(() => { if (csp2.volume <= 0.05) { csp2.pause(); + csp2.volume = 0; clearInterval(csi2); return; } @@ -64,7 +68,7 @@ musicIpc.on('fademusic', (event) => { if (cspn === 1) { if (csp1 !== null) { csi1 = setInterval(() => { - if (csp1.volume <= 0.5) { + if (csp1.volume <= 0.05) { clearInterval(csi1); return; } @@ -74,7 +78,7 @@ musicIpc.on('fademusic', (event) => { } else { if (csp2 !== null) { csi2 = setInterval(() => { - if (csp2.volume <= 0.5) { + if (csp2.volume <= 0.05) { clearInterval(csi2); return; } -- cgit