[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:
parent
4d459a3a21
commit
e28b484d92
2 changed files with 15 additions and 18 deletions
|
@ -49,7 +49,8 @@ const CiderAudio = {
|
||||||
},
|
},
|
||||||
connectContext: function (mediaElem) {
|
connectContext: function (mediaElem) {
|
||||||
if (!CiderAudio.context) {
|
if (!CiderAudio.context) {
|
||||||
CiderAudio.context = new window.AudioContext({ sampleRate: 96000 }); // Don't ever remove the sample rate arg. Ask Maikiwi.
|
CiderAudio.context = new window.AudioContext({ sampleRate: 96000, latencyHint: "playback"}); // Don't ever remove the sample rate arg. Ask Maikiwi.
|
||||||
|
app.lyricOffset = CiderAudio.context.baseLatency
|
||||||
}
|
}
|
||||||
if (!CiderAudio.source) {
|
if (!CiderAudio.source) {
|
||||||
CiderAudio.source = CiderAudio.context.createMediaElementSource(mediaElem);
|
CiderAudio.source = CiderAudio.context.createMediaElementSource(mediaElem);
|
||||||
|
|
|
@ -147,6 +147,7 @@ const app = new Vue({
|
||||||
start: 0,
|
start: 0,
|
||||||
end: 0
|
end: 0
|
||||||
},
|
},
|
||||||
|
lyricOffset: 0.02,
|
||||||
v3: {
|
v3: {
|
||||||
requestBody: {
|
requestBody: {
|
||||||
platform: "web"
|
platform: "web"
|
||||||
|
@ -920,7 +921,7 @@ const app = new Vue({
|
||||||
})
|
})
|
||||||
|
|
||||||
this.mk.addEventListener(MusicKit.Events.playbackTimeDidChange, (a) => {
|
this.mk.addEventListener(MusicKit.Events.playbackTimeDidChange, (a) => {
|
||||||
self.lyriccurrenttime = self.mk.currentPlaybackTime
|
self.lyriccurrenttime = self.mk.currentPlaybackTime + app.lyricOffset
|
||||||
this.currentSongInfo = a
|
this.currentSongInfo = a
|
||||||
self.playerLCD.playbackDuration = (self.mk.currentPlaybackTime)
|
self.playerLCD.playbackDuration = (self.mk.currentPlaybackTime)
|
||||||
// wsapi
|
// wsapi
|
||||||
|
@ -957,9 +958,6 @@ const app = new Vue({
|
||||||
}
|
}
|
||||||
this.currentSongInfo = a
|
this.currentSongInfo = a
|
||||||
if (this.currentSongInfo === null || this.currentSongInfo === undefined) { return; } // EVIL EMPTY OBJECTS BE GONE
|
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 {
|
try {
|
||||||
if (app.mk.nowPlayingItem.flavor.includes("64")) {
|
if (app.mk.nowPlayingItem.flavor.includes("64")) {
|
||||||
localStorage.setItem("playingBitrate", "64")
|
localStorage.setItem("playingBitrate", "64")
|
||||||
|
@ -973,8 +971,6 @@ const app = new Vue({
|
||||||
}
|
}
|
||||||
if (!app.cfg.audio.normalization) { CiderAudio.hierarchical_loading(); }
|
if (!app.cfg.audio.normalization) { CiderAudio.hierarchical_loading(); }
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
if (app.cfg.audio.normalization) {
|
if (app.cfg.audio.normalization) {
|
||||||
// get unencrypted audio previews to get SoundCheck's normalization tag
|
// get unencrypted audio previews to get SoundCheck's normalization tag
|
||||||
try {
|
try {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue