From 8a755b73192efa84876c9b0733fcabf674d00ee6 Mon Sep 17 00:00:00 2001 From: Amaru8 <52407090+Amaru8@users.noreply.github.com> Date: Wed, 18 May 2022 21:43:38 +0200 Subject: [PATCH 1/9] Update store.ts --- src/main/base/store.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/base/store.ts b/src/main/base/store.ts index d076924b..3bab1142 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": '1', + "playbackRate": 100, "quality": "HIGH", "seamless_audio": true, "normalization": false, From b3ce29159cdbd1912b19e3610853f93e2a1b926a Mon Sep 17 00:00:00 2001 From: Amaru8 <52407090+Amaru8@users.noreply.github.com> Date: Wed, 18 May 2022 21:45:00 +0200 Subject: [PATCH 2/9] Implement wheel support --- .../views/components/audio-playbackrate.ejs | 40 ++++++++++++++++--- 1 file changed, 34 insertions(+), 6 deletions(-) diff --git a/src/renderer/views/components/audio-playbackrate.ejs b/src/renderer/views/components/audio-playbackrate.ejs index 814d57a5..9b40a00d 100644 --- a/src/renderer/views/components/audio-playbackrate.ejs +++ b/src/renderer/views/components/audio-playbackrate.ejs @@ -15,7 +15,7 @@ {{playbackRate}} ×
- +
@@ -29,15 +29,43 @@ data: function () { return { app: this.$root, - playbackRate: this.$root.cfg.audio.playbackRate + playbackRate: this.$root.cfg.audio.playbackRate / 100 } }, watch: { playbackRate: function (newValue, _oldValue) { - this.$root.mk.playbackRate = newValue - this.$root.cfg.audio.playbackRate = newValue - this.playbackRate = newValue + this.saveValue(newValue); } - } + }, + methods: { + playbackRateWheel(event) { + if (app.checkScrollDirectionIsUp(event)) { + this.saveValue(this.$root.cfg.audio.playbackRate + 5); + } else { + this.saveValue(this.$root.cfg.audio.playbackRate - 5); + } + }, + 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; + } + } + }, + isAllowedRate(input) { + if (input >= 25 && input <= 200) { return true } + if (input >= 0.25 && input <= 2) { return true } + return false; + } + } }); \ No newline at end of file From 2a1d132293e5094fa646dd52ef93985aae928e98 Mon Sep 17 00:00:00 2001 From: Amaru8 <52407090+Amaru8@users.noreply.github.com> Date: Wed, 18 May 2022 21:46:04 +0200 Subject: [PATCH 3/9] Remove whitespace --- src/renderer/views/components/audio-playbackrate.ejs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/renderer/views/components/audio-playbackrate.ejs b/src/renderer/views/components/audio-playbackrate.ejs index 9b40a00d..cd7e417e 100644 --- a/src/renderer/views/components/audio-playbackrate.ejs +++ b/src/renderer/views/components/audio-playbackrate.ejs @@ -45,7 +45,7 @@ this.saveValue(this.$root.cfg.audio.playbackRate - 5); } }, - saveValue(newValue) { + saveValue(newValue) { newValue = Number(newValue); if (this.isAllowedRate(newValue)) { if (newValue > 2) { From 1f627827148694bc2922a0f5ac8696fa64c02799 Mon Sep 17 00:00:00 2001 From: Amaru8 <52407090+Amaru8@users.noreply.github.com> Date: Wed, 18 May 2022 21:47:04 +0200 Subject: [PATCH 4/9] Change rate auto-updating --- src/preload/cider-preload.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/preload/cider-preload.js b/src/preload/cider-preload.js index f5cc6dd2..00da3b8a 100644 --- a/src/preload/cider-preload.js +++ b/src/preload/cider-preload.js @@ -40,8 +40,8 @@ const MusicKitInterop = { if (MusicKit.getInstance().nowPlayingItem) { await this.sleep(1000); - console.log("Auto-updating Playback Rate from " + MusicKit.getInstance().playbackRate + " x to " + app.cfg.audio.playbackRate + " x"); - MusicKit.getInstance().playbackRate = app.cfg.audio.playbackRate; + console.log("Auto-updating Playback Rate from " + MusicKit.getInstance().playbackRate + " x to " + app.cfg.audio.playbackRate / 100 + " x"); + MusicKit.getInstance().playbackRate = app.cfg.audio.playbackRate / 100; } }); From b242614d95c04d231433fd5f6f2f82809d6d6cfd Mon Sep 17 00:00:00 2001 From: Amaru8 <52407090+Amaru8@users.noreply.github.com> Date: Wed, 18 May 2022 21:47:28 +0200 Subject: [PATCH 5/9] Remove console log --- src/preload/cider-preload.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/preload/cider-preload.js b/src/preload/cider-preload.js index 00da3b8a..2c9b137e 100644 --- a/src/preload/cider-preload.js +++ b/src/preload/cider-preload.js @@ -39,8 +39,7 @@ const MusicKitInterop = { } if (MusicKit.getInstance().nowPlayingItem) { - await this.sleep(1000); - console.log("Auto-updating Playback Rate from " + MusicKit.getInstance().playbackRate + " x to " + app.cfg.audio.playbackRate / 100 + " x"); + await this.sleep(750); MusicKit.getInstance().playbackRate = app.cfg.audio.playbackRate / 100; } }); From 9874d1c62dcc678c76941c66e1356aa36824b860 Mon Sep 17 00:00:00 2001 From: Amaru8 <52407090+Amaru8@users.noreply.github.com> Date: Wed, 18 May 2022 21:52:50 +0200 Subject: [PATCH 6/9] hmm --- src/renderer/views/components/audio-playbackrate.ejs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/renderer/views/components/audio-playbackrate.ejs b/src/renderer/views/components/audio-playbackrate.ejs index cd7e417e..2b39b681 100644 --- a/src/renderer/views/components/audio-playbackrate.ejs +++ b/src/renderer/views/components/audio-playbackrate.ejs @@ -68,4 +68,4 @@ } } }); - \ No newline at end of file + From a35d0d26f8975518b0d0445d7c79388ee66c6a65 Mon Sep 17 00:00:00 2001 From: Amaru8 <52407090+Amaru8@users.noreply.github.com> Date: Wed, 18 May 2022 22:01:02 +0200 Subject: [PATCH 7/9] marin showed me the way im okay help --- src/main/base/store.ts | 2 +- src/preload/cider-preload.js | 2 +- .../views/components/audio-playbackrate.ejs | 25 ++++++------------- 3 files changed, 10 insertions(+), 19 deletions(-) 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; } } }); From b9debc978f2f5165c5718781c2d16242ea3702df Mon Sep 17 00:00:00 2001 From: Amaru8 <52407090+Amaru8@users.noreply.github.com> Date: Sun, 22 May 2022 07:50:18 +0200 Subject: [PATCH 8/9] purge a function --- src/renderer/views/components/audio-playbackrate.ejs | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/renderer/views/components/audio-playbackrate.ejs b/src/renderer/views/components/audio-playbackrate.ejs index 9e1f1242..0b94e0c6 100644 --- a/src/renderer/views/components/audio-playbackrate.ejs +++ b/src/renderer/views/components/audio-playbackrate.ejs @@ -47,15 +47,12 @@ }, saveValue(newValue) { newValue = Number(newValue); - if (this.isAllowedRate(newValue)) { + if (newValue >= 0.25 && newValue <= 2) { 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) { - return input >= 0.25 && input <= 2 ? true : false; } } }); From 4793f2b26532ac21bb9c1264538e371b47b5ea58 Mon Sep 17 00:00:00 2001 From: Amaru8 <52407090+Amaru8@users.noreply.github.com> Date: Mon, 23 May 2022 19:56:34 +0200 Subject: [PATCH 9/9] uhh --- src/renderer/views/components/audio-playbackrate.ejs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/renderer/views/components/audio-playbackrate.ejs b/src/renderer/views/components/audio-playbackrate.ejs index 0b94e0c6..0e86d0ca 100644 --- a/src/renderer/views/components/audio-playbackrate.ejs +++ b/src/renderer/views/components/audio-playbackrate.ejs @@ -48,7 +48,7 @@ saveValue(newValue) { newValue = Number(newValue); if (newValue >= 0.25 && 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.cfg.audio.playbackRate = newValue; this.playbackRate = newValue;