From d75d755d27420d35a91a567ceb08539efc5085b9 Mon Sep 17 00:00:00 2001 From: Plextora <71889427+Plextora@users.noreply.github.com> Date: Fri, 15 Nov 2024 19:52:23 -0500 Subject: [PATCH] Use speed signal instead of extra variable --- src/renderer/src/components/song/song.utils.ts | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/renderer/src/components/song/song.utils.ts b/src/renderer/src/components/song/song.utils.ts index 3652ceea..0ae9e3b5 100644 --- a/src/renderer/src/components/song/song.utils.ts +++ b/src/renderer/src/components/song/song.utils.ts @@ -55,13 +55,11 @@ export const setVolume = (newValue: ZeroToOne) => { const [speed, _setSpeed] = createSignal(1); export const setSpeed = (newValue: ZeroToOne) => { _setSpeed(newValue); - speedNum = newValue; player.playbackRate = newValue; }; export { volume, speed }; let bgPath: Optional; -let speedNum = 1; const player = new Audio(); @@ -303,7 +301,7 @@ window.api.listen("queue::songChanged", async (s) => { setSong(s); await window.api.request("discord::play", s); await play(); - player.playbackRate = speedNum; + player.playbackRate = speed(); }); player.addEventListener("ended", async () => {