Added Playback Rate functionality (#933)

* Add () to openAudioControls function call

* Duplicate new placeholder modal

* Add to app.modals

* Make modal do something

* Changed input to slider

* Change i18n string name and remove con.log

* Finalized i18n strings

* Add to store.ts and update i18n hehe

* Save rate to cfg

* fuck off

* AAHH

* Make auto-set more reliable

* no nightcore stuff here

Co-authored-by: cryptofyre <cryptofyre@cryptofyre.org>
This commit is contained in:
Amaru8 2022-04-25 07:55:13 +02:00 committed by GitHub
parent 67834c192a
commit 144127f142
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
14 changed files with 106 additions and 2 deletions

View file

@ -37,6 +37,12 @@ const MusicKitInterop = {
if (trackFilter || !app.cfg.lastfm.filterLoop) {
global.ipcRenderer.send('nowPlayingItemDidChangeLastFM', attributes);
}
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;
}
});
MusicKit.getInstance().addEventListener(MusicKit.Events.authorizationStatusDidChange, () => {
@ -47,6 +53,13 @@ const MusicKitInterop = {
console.warn(`[mediaPlaybackError] ${e}`);
})
},
sleep(ms) {
return new Promise((resolve) => {
setTimeout(resolve, ms);
});
},
async modifyNamesOnLocale() {
if (app.mklang === '' || app.mklang == null) {
return;