Skip to content

Commit

Permalink
Use speed signal instead of extra variable
Browse files Browse the repository at this point in the history
  • Loading branch information
Plextora committed Nov 16, 2024
1 parent 3d34c98 commit d75d755
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions src/renderer/src/components/song/song.utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,11 @@ export const setVolume = (newValue: ZeroToOne) => {
const [speed, _setSpeed] = createSignal<ZeroToOne>(1);
export const setSpeed = (newValue: ZeroToOne) => {
_setSpeed(newValue);
speedNum = newValue;
player.playbackRate = newValue;
};
export { volume, speed };

let bgPath: Optional<string>;
let speedNum = 1;

const player = new Audio();

Expand Down Expand Up @@ -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 () => {
Expand Down

0 comments on commit d75d755

Please sign in to comment.