floating point errors resolved

changed some logs to debugs
This commit is contained in:
Core 2022-05-25 15:59:53 +01:00
parent 93bf5652d2
commit adf1a18be7
No known key found for this signature in database
GPG key ID: FE9BF1B547F8F3C6
2 changed files with 8 additions and 12 deletions

View file

@ -1,5 +1,5 @@
global.ipcRenderer = require('electron').ipcRenderer; global.ipcRenderer = require('electron').ipcRenderer;
console.log('Loaded Preload') console.info('Loaded Preload')
let cache = {playParams: {id: 0}, status: null, remainingTime: 0}, let cache = {playParams: {id: 0}, status: null, remainingTime: 0},
playbackCache = {status: null, time: Date.now()}; playbackCache = {status: null, time: Date.now()};
@ -24,7 +24,7 @@ const MusicKitInterop = {
/** wsapi */ /** wsapi */
MusicKit.getInstance().addEventListener(MusicKit.Events.nowPlayingItemDidChange, async () => { MusicKit.getInstance().addEventListener(MusicKit.Events.nowPlayingItemDidChange, async () => {
console.log('nowPlayingItemDidChange') console.debug('nowPlayingItemDidChange')
const attributes = MusicKitInterop.getAttributes() const attributes = MusicKitInterop.getAttributes()
const trackFilter = MusicKitInterop.filterTrack(attributes, false, true) const trackFilter = MusicKitInterop.filterTrack(attributes, false, true)
@ -156,19 +156,19 @@ const MusicKitInterop = {
// } catch (e) { } // } catch (e) { }
// if (MusicKit.getInstance().queue.nextPlayableItemIndex != -1 && MusicKit.getInstance().queue.nextPlayableItemIndex != null) // if (MusicKit.getInstance().queue.nextPlayableItemIndex != -1 && MusicKit.getInstance().queue.nextPlayableItemIndex != null)
// MusicKit.getInstance().changeToMediaAtIndex(MusicKit.getInstance().queue.nextPlayableItemIndex); // MusicKit.getInstance().changeToMediaAtIndex(MusicKit.getInstance().queue.nextPlayableItemIndex);
MusicKit.getInstance().skipToNextItem().then(r => console.log(`[MusicKitInterop.next] Skipping to Next ${r}`)); MusicKit.getInstance().skipToNextItem().then(r => console.debug(`[MusicKitInterop.next] Skipping to Next ${r}`));
}, },
previous: () => { previous: () => {
// if (MusicKit.getInstance().queue.previousPlayableItemIndex != -1 && MusicKit.getInstance().queue.previousPlayableItemIndex != null) // if (MusicKit.getInstance().queue.previousPlayableItemIndex != -1 && MusicKit.getInstance().queue.previousPlayableItemIndex != null)
// MusicKit.getInstance().changeToMediaAtIndex(MusicKit.getInstance().queue.previousPlayableItemIndex); // MusicKit.getInstance().changeToMediaAtIndex(MusicKit.getInstance().queue.previousPlayableItemIndex);
MusicKit.getInstance().skipToPreviousItem().then(r => console.log(`[MusicKitInterop.previous] Skipping to Previous ${r}`)); MusicKit.getInstance().skipToPreviousItem().then(r => console.debug(`[MusicKitInterop.previous] Skipping to Previous ${r}`));
} }
} }
process.once('loaded', () => { process.once('loaded', () => {
console.log("Setting ipcRenderer") console.debug("Setting ipcRenderer")
global.MusicKitInterop = MusicKitInterop; global.MusicKitInterop = MusicKitInterop;
}); });

View file

@ -246,7 +246,7 @@ const app = new Vue({
watch: { watch: {
cfg: { cfg: {
handler: function (val, oldVal) { handler: function (val, oldVal) {
console.debug(`cfg changed from ${oldVal} to ${val}`); console.debug(`Config changed: ${JSON.stringify(val)}`);
ipcRenderer.send("setStore", val); ipcRenderer.send("setStore", val);
}, },
deep: true deep: true
@ -3903,19 +3903,15 @@ const app = new Vue({
volumeUp() { volumeUp() {
if ((app.mk.volume + app.cfg.audio.volumeStep) > app.cfg.audio.maxVolume) { if ((app.mk.volume + app.cfg.audio.volumeStep) > app.cfg.audio.maxVolume) {
app.mk.volume = app.cfg.audio.maxVolume; app.mk.volume = app.cfg.audio.maxVolume;
console.debug('setting max volume')
} else { } else {
console.log('volume up') app.mk.volume = (Math.floor((app.mk.volume * 100)) + (app.cfg.audio.volumeStep * 100)) / 100
app.mk.volume = ((app.mk.volume * 100) + (app.cfg.audio.volumeStep * 100)) / 100
} }
}, },
volumeDown() { volumeDown() {
if ((app.mk.volume - app.cfg.audio.volumeStep) < 0) { if ((app.mk.volume - app.cfg.audio.volumeStep) < 0) {
app.mk.volume = 0; app.mk.volume = 0;
console.debug('setting volume to 0')
} else { } else {
console.log('volume down') app.mk.volume = (Math.floor((app.mk.volume * 100)) - (app.cfg.audio.volumeStep * 100)) / 100
app.mk.volume = ((app.mk.volume * 100) - (app.cfg.audio.volumeStep * 100)) / 100
} }
}, },
volumeWheel(event) { volumeWheel(event) {