diff --git a/src/main/base/store.ts b/src/main/base/store.ts index 3bab1142..69208a4e 100644 --- a/src/main/base/store.ts +++ b/src/main/base/store.ts @@ -133,7 +133,7 @@ export class Store { "maxVolume": 1, "lastVolume": 1, "muted": false, - "playbackRate": 100, + "playbackRate": 1, "quality": "HIGH", "seamless_audio": true, "normalization": false, diff --git a/src/preload/cider-preload.js b/src/preload/cider-preload.js index 2c9b137e..75a4af44 100644 --- a/src/preload/cider-preload.js +++ b/src/preload/cider-preload.js @@ -40,7 +40,7 @@ const MusicKitInterop = { if (MusicKit.getInstance().nowPlayingItem) { await this.sleep(750); - MusicKit.getInstance().playbackRate = app.cfg.audio.playbackRate / 100; + MusicKit.getInstance().playbackRate = app.cfg.audio.playbackRate; } }); diff --git a/src/renderer/views/components/audio-playbackrate.ejs b/src/renderer/views/components/audio-playbackrate.ejs index 2b39b681..9e1f1242 100644 --- a/src/renderer/views/components/audio-playbackrate.ejs +++ b/src/renderer/views/components/audio-playbackrate.ejs @@ -29,7 +29,7 @@ data: function () { return { app: this.$root, - playbackRate: this.$root.cfg.audio.playbackRate / 100 + playbackRate: this.$root.cfg.audio.playbackRate } }, watch: { @@ -40,31 +40,22 @@ methods: { playbackRateWheel(event) { if (app.checkScrollDirectionIsUp(event)) { - this.saveValue(this.$root.cfg.audio.playbackRate + 5); + this.saveValue(this.$root.cfg.audio.playbackRate + 0.05); } else { - this.saveValue(this.$root.cfg.audio.playbackRate - 5); + this.saveValue(this.$root.cfg.audio.playbackRate - 0.05); } }, saveValue(newValue) { newValue = Number(newValue); if (this.isAllowedRate(newValue)) { - if (newValue > 2) { - newValue = String(newValue).length > 4 ? newValue.toFixed(2) : newValue; - this.$root.mk.playbackRate = newValue / 100; - this.$root.cfg.audio.playbackRate = newValue; - this.playbackRate = newValue / 100; - } else { - newValue = String(newValue).length > 6 ? newValue.toFixed(2) : newValue; - this.$root.mk.playbackRate = newValue; - this.$root.cfg.audio.playbackRate = newValue * 100; - this.playbackRate = newValue; - } + newValue = String(newValue).length > 6 ? newValue.toFixed(2) : newValue; + this.$root.mk.playbackRate = newValue; + this.$root.cfg.audio.playbackRate = newValue; + this.playbackRate = newValue; } }, isAllowedRate(input) { - if (input >= 25 && input <= 200) { return true } - if (input >= 0.25 && input <= 2) { return true } - return false; + return input >= 0.25 && input <= 2 ? true : false; } } });