[Audio] Added CAP & Normalization behavior for local files
This commit is contained in:
parent
d4f0b32c15
commit
c9ba30df06
2 changed files with 23 additions and 18 deletions
|
@ -721,18 +721,12 @@ const CiderAudio = {
|
||||||
let bufferedImpulse = await impulseData.arrayBuffer();
|
let bufferedImpulse = await impulseData.arrayBuffer();
|
||||||
CiderAudio.audioNodes.llpw[0].buffer = await CiderAudio.context.decodeAudioData(bufferedImpulse);
|
CiderAudio.audioNodes.llpw[0].buffer = await CiderAudio.context.decodeAudioData(bufferedImpulse);
|
||||||
});
|
});
|
||||||
console.debug("[Cider][Audio] CAP Adaptive - 256kbps_2_48k");
|
console.debug("[Cider][Audio] CAP Adaptive - 256kbps");
|
||||||
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
CiderAudio.audioNodes.llpw[0] = CiderAudio.context.createConvolver(); CiderAudio.audioNodes.llpw[0].normalize = false;
|
CiderAudio.audioNodes.llpw[0] = CiderAudio.context.createGain(); CiderAudio.audioNodes.llpw[0].gain.value = 1
|
||||||
CiderAudio.audioNodes.llpw[1] = CiderAudio.context.createGain(); CiderAudio.audioNodes.llpw[1].gain.value = 2.37; // Post Gain Compensation
|
console.debug("[Cider][Audio] CAP Disabled (Passthrough) : Non-Lossy Bitrate.");
|
||||||
CiderAudio.audioNodes.llpw[0].connect(CiderAudio.audioNodes.llpw[1]);
|
|
||||||
fetch('./cideraudio/impulses/CAP_256_FINAL_48k.wav').then(async (impulseData) => {
|
|
||||||
let bufferedImpulse = await impulseData.arrayBuffer();
|
|
||||||
CiderAudio.audioNodes.llpw[0].buffer = await CiderAudio.context.decodeAudioData(bufferedImpulse);
|
|
||||||
});
|
|
||||||
console.debug("[Cider][Audio] CAP Adaptive - CONFIG FALLBACK - 256kbps_2_48k");
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -956,17 +956,20 @@ const app = new Vue({
|
||||||
if (self.$refs.queue) {
|
if (self.$refs.queue) {
|
||||||
self.$refs.queue.updateQueue();
|
self.$refs.queue.updateQueue();
|
||||||
}
|
}
|
||||||
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
|
||||||
|
let localFiles = false;
|
||||||
try {
|
try {
|
||||||
if (app.mk.nowPlayingItem.flavor.includes("64")) {
|
if (app.mk.nowPlayingItem.flavor.includes("64") && app.mk.nowPlayingItem.flavor.includes(":")) {
|
||||||
localStorage.setItem("playingBitrate", "64")
|
localStorage.setItem("playingBitrate", "64")
|
||||||
} else if (app.mk.nowPlayingItem.flavor.includes("256")) {
|
} else if (app.mk.nowPlayingItem.flavor.includes("256") && app.mk.nowPlayingItem.flavor.includes(":")) {
|
||||||
localStorage.setItem("playingBitrate", "256")
|
localStorage.setItem("playingBitrate", "256")
|
||||||
} else {
|
} else {
|
||||||
localStorage.setItem("playingBitrate", "256")
|
localFiles = true;
|
||||||
|
localStorage.setItem("playingBitrate", app.mk.nowPlayingItem.flavor)
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
console.error(e)
|
||||||
localStorage.setItem("playingBitrate", "256")
|
localStorage.setItem("playingBitrate", "256")
|
||||||
}
|
}
|
||||||
if (!app.cfg.audio.normalization) { CiderAudio.hierarchical_loading(); }
|
if (!app.cfg.audio.normalization) { CiderAudio.hierarchical_loading(); }
|
||||||
|
@ -978,22 +981,30 @@ const app = new Vue({
|
||||||
try {
|
try {
|
||||||
previewURL = app.mk.nowPlayingItem.previewURL
|
previewURL = app.mk.nowPlayingItem.previewURL
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
if (e instanceof TypeError === false) { console.debug("[Cider][MaikiwiSoundCheck] normalizer function err: " + e) }
|
||||||
|
else {
|
||||||
|
if (localFiles === true) {CiderAudio.audioNodes.gainNode.gain = 0.8222426499470}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (previewURL == null && ((app.mk.nowPlayingItem?._songId ?? (app.mk.nowPlayingItem["songId"] ?? app.mk.nowPlayingItem.relationships.catalog.data[0].id)) != -1)) {
|
if (previewURL == null && ((app.mk.nowPlayingItem?._songId ?? (app.mk.nowPlayingItem["songId"] ?? app.mk.nowPlayingItem.relationships.catalog.data[0].id)) != -1)) {
|
||||||
app.mk.api.v3.music(`/v1/catalog/${app.mk.storefrontId}/songs/${app.mk.nowPlayingItem?._songId ?? (app.mk.nowPlayingItem["songId"] ?? app.mk.nowPlayingItem.relationships.catalog.data[0].id)}`).then((response) => {
|
app.mk.api.v3.music(`/v1/catalog/${app.mk.storefrontId}/songs/${app.mk.nowPlayingItem?._songId ?? (app.mk.nowPlayingItem["songId"] ?? app.mk.nowPlayingItem.relationships.catalog.data[0].id)}`).then((response) => {
|
||||||
previewURL = response.data.data[0].attributes.previews[0].url
|
previewURL = response.data.data[0].attributes.previews[0].url
|
||||||
if (previewURL)
|
if (previewURL) {
|
||||||
console.debug("[Cider][MaikiwiSoundCheck] previewURL response.data.data[0].attributes.previews[0].url: " + previewURL)
|
console.debug("[Cider][MaikiwiSoundCheck] previewURL response.data.data[0].attributes.previews[0].url: " + previewURL)
|
||||||
ipcRenderer.send('getPreviewURL', previewURL)
|
ipcRenderer.send('getPreviewURL', previewURL)
|
||||||
|
}
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
if (previewURL)
|
if (previewURL) {
|
||||||
console.debug("[Cider][MaikiwiSoundCheck] previewURL in app.mk.nowPlayingItem.previewURL: " + previewURL)
|
console.debug("[Cider][MaikiwiSoundCheck] previewURL in app.mk.nowPlayingItem.previewURL: " + previewURL)
|
||||||
ipcRenderer.send('getPreviewURL', previewURL)
|
ipcRenderer.send('getPreviewURL', previewURL)}
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
if (e instanceof TypeError === false) { console.debug("[Cider][MaikiwiSoundCheck] normalizer function err: " + e) }
|
if (e instanceof TypeError === false) { console.debug("[Cider][MaikiwiSoundCheck] normalizer function err: " + e) }
|
||||||
|
else {
|
||||||
|
if (localFiles === true) {CiderAudio.audioNodes.gainNode.gain = 0.8222426499470}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue