marin showed me the way im okay help

This commit is contained in:
Amaru8 2022-05-18 22:01:02 +02:00
parent 9874d1c62d
commit a35d0d26f8
3 changed files with 10 additions and 19 deletions

View file

@ -133,7 +133,7 @@ export class Store {
"maxVolume": 1, "maxVolume": 1,
"lastVolume": 1, "lastVolume": 1,
"muted": false, "muted": false,
"playbackRate": 100, "playbackRate": 1,
"quality": "HIGH", "quality": "HIGH",
"seamless_audio": true, "seamless_audio": true,
"normalization": false, "normalization": false,

View file

@ -40,7 +40,7 @@ const MusicKitInterop = {
if (MusicKit.getInstance().nowPlayingItem) { if (MusicKit.getInstance().nowPlayingItem) {
await this.sleep(750); await this.sleep(750);
MusicKit.getInstance().playbackRate = app.cfg.audio.playbackRate / 100; MusicKit.getInstance().playbackRate = app.cfg.audio.playbackRate;
} }
}); });

View file

@ -29,7 +29,7 @@
data: function () { data: function () {
return { return {
app: this.$root, app: this.$root,
playbackRate: this.$root.cfg.audio.playbackRate / 100 playbackRate: this.$root.cfg.audio.playbackRate
} }
}, },
watch: { watch: {
@ -40,31 +40,22 @@
methods: { methods: {
playbackRateWheel(event) { playbackRateWheel(event) {
if (app.checkScrollDirectionIsUp(event)) { if (app.checkScrollDirectionIsUp(event)) {
this.saveValue(this.$root.cfg.audio.playbackRate + 5); this.saveValue(this.$root.cfg.audio.playbackRate + 0.05);
} else { } else {
this.saveValue(this.$root.cfg.audio.playbackRate - 5); this.saveValue(this.$root.cfg.audio.playbackRate - 0.05);
} }
}, },
saveValue(newValue) { saveValue(newValue) {
newValue = Number(newValue); newValue = Number(newValue);
if (this.isAllowedRate(newValue)) { if (this.isAllowedRate(newValue)) {
if (newValue > 2) { newValue = String(newValue).length > 6 ? newValue.toFixed(2) : newValue;
newValue = String(newValue).length > 4 ? newValue.toFixed(2) : newValue; this.$root.mk.playbackRate = newValue;
this.$root.mk.playbackRate = newValue / 100; this.$root.cfg.audio.playbackRate = newValue;
this.$root.cfg.audio.playbackRate = newValue; this.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;
}
} }
}, },
isAllowedRate(input) { isAllowedRate(input) {
if (input >= 25 && input <= 200) { return true } return input >= 0.25 && input <= 2 ? true : false;
if (input >= 0.25 && input <= 2) { return true }
return false;
} }
} }
}); });