[Audio] Fix #1207 (discussions)

Eliminates audio stuttering even when AudioContext is enabled. Make lyrics account for the extra latency introduced by Audio Lab.
This commit is contained in:
maikirakiwi 2022-07-02 23:08:40 -07:00
parent 4d459a3a21
commit e28b484d92
2 changed files with 15 additions and 18 deletions

View file

@ -147,6 +147,7 @@ const app = new Vue({
start: 0,
end: 0
},
lyricOffset: 0.02,
v3: {
requestBody: {
platform: "web"
@ -920,7 +921,7 @@ const app = new Vue({
})
this.mk.addEventListener(MusicKit.Events.playbackTimeDidChange, (a) => {
self.lyriccurrenttime = self.mk.currentPlaybackTime
self.lyriccurrenttime = self.mk.currentPlaybackTime + app.lyricOffset
this.currentSongInfo = a
self.playerLCD.playbackDuration = (self.mk.currentPlaybackTime)
// wsapi
@ -957,24 +958,19 @@ const app = new Vue({
}
this.currentSongInfo = a
if (this.currentSongInfo === null || this.currentSongInfo === undefined) { return; } // EVIL EMPTY OBJECTS BE GONE
console.debug("songinfo: " + JSON.stringify(a))
if (app.cfg.advanced.AudioContext) {
try {
if (app.mk.nowPlayingItem.flavor.includes("64")) {
localStorage.setItem("playingBitrate", "64")
} else if (app.mk.nowPlayingItem.flavor.includes("256")) {
localStorage.setItem("playingBitrate", "256")
} else {
localStorage.setItem("playingBitrate", "256")
}
} catch (e) {
try {
if (app.mk.nowPlayingItem.flavor.includes("64")) {
localStorage.setItem("playingBitrate", "64")
} else if (app.mk.nowPlayingItem.flavor.includes("256")) {
localStorage.setItem("playingBitrate", "256")
} else {
localStorage.setItem("playingBitrate", "256")
}
if (!app.cfg.audio.normalization) { CiderAudio.hierarchical_loading(); }
} catch (e) {
localStorage.setItem("playingBitrate", "256")
}
if (!app.cfg.audio.normalization) { CiderAudio.hierarchical_loading(); }
if (app.cfg.audio.normalization) {
// get unencrypted audio previews to get SoundCheck's normalization tag
try {