1
0
Fork 0
mirror of https://github.com/jellyfin/jellyfin-web synced 2025-03-30 19:56:21 +00:00

Add option to enable/disable normalization

This commit is contained in:
Telepathic Walrus 2023-01-30 20:36:11 +00:00
parent 5edebd9070
commit de09fd4d36
5 changed files with 38 additions and 6 deletions

View file

@ -185,6 +185,7 @@ import template from './playbackSettings.template.html';
context.querySelector('.chkPlayDefaultAudioTrack').checked = user.Configuration.PlayDefaultAudioTrack || false;
context.querySelector('.chkPreferFmp4HlsContainer').checked = userSettings.preferFmp4HlsContainer();
context.querySelector('.chkEnableCinemaMode').checked = userSettings.enableCinemaMode();
context.querySelector('.chkEnableAudioNormalization').checked = userSettings.enableAudioNormalization();
context.querySelector('.chkEnableNextVideoOverlay').checked = userSettings.enableNextVideoInfoOverlay();
context.querySelector('.chkRememberAudioSelections').checked = user.Configuration.RememberAudioSelections || false;
context.querySelector('.chkRememberSubtitleSelections').checked = user.Configuration.RememberSubtitleSelections || false;
@ -231,6 +232,8 @@ import template from './playbackSettings.template.html';
user.Configuration.EnableNextEpisodeAutoPlay = context.querySelector('.chkEpisodeAutoPlay').checked;
userSettingsInstance.preferFmp4HlsContainer(context.querySelector('.chkPreferFmp4HlsContainer').checked);
userSettingsInstance.enableCinemaMode(context.querySelector('.chkEnableCinemaMode').checked);
userSettingsInstance.enableAudioNormalization(context.querySelector('.chkEnableAudioNormalization').checked);
userSettingsInstance.enableNextVideoInfoOverlay(context.querySelector('.chkEnableNextVideoOverlay').checked);
user.Configuration.RememberAudioSelections = context.querySelector('.chkRememberAudioSelections').checked;

View file

@ -64,6 +64,14 @@
<div class="selectContainer">
<select is="emby-select" class="selectMusicInternetQuality" label="${LabelInternetQuality}"></select>
</div>
<div class="checkboxContainer checkboxContainer-withDescription">
<label>
<input type="checkbox" is="emby-checkbox" class="chkEnableAudioNormalization" />
<span>${EnableAudioNormalization}</span>
</label>
<div class="fieldDescription checkboxFieldDescription">${EnableAudioNormalizationHelp}</div>
</div>
</div>
</div>

View file

@ -4,6 +4,7 @@ import * as htmlMediaHelper from '../../components/htmlMediaHelper';
import profileBuilder from '../../scripts/browserDeviceProfile';
import { getIncludeCorsCredentials } from '../../scripts/settings/webSettings';
import Events from '../../utils/events.ts';
import { UserSettings } from '../../scripts/settings/userSettings';
function getDefaultProfile() {
return profileBuilder({});
@ -107,11 +108,15 @@ class HtmlAudioPlayer {
let val = options.url;
console.debug('playing url: ' + val);
import('../../scripts/settings/userSettings').then((userSettings)=> {
if(userSettings.enableAudioNormalization()){
const dbGain = -18 - options.item.Normalization;
console.debug(options.item);
self.gainNode.gain.value = Math.pow(10, (dbGain/20));
} else {
self.gainNode.gain.value = 1;
}
});
console.debug('gain:' + self.gainNode.gain.value);

View file

@ -156,6 +156,19 @@ export class UserSettings {
return toBoolean(this.get('enableCinemaMode', false), true);
}
/**
* Get or set 'Enable Audio Normalization' state.
* @param {boolean|undefined} val - Flag to enable 'Enable Audio Normalization' or undefined.
* @return {boolean} 'Enable Audio Normalization' state.
*/
enableAudioNormalization(val) {
if (val !== undefined) {
return this.set('enableAudioNormalization', val.toString(), false);
}
return toBoolean(this.get('enableAudioNormalization', false), true);
}
/**
* Get or set 'Next Video Info Overlay' state.
* @param {boolean|undefined} val - Flag to enable 'Next Video Info Overlay' or undefined.
@ -579,6 +592,7 @@ export const serverConfig = currentSettings.serverConfig.bind(currentSettings);
export const allowedAudioChannels = currentSettings.allowedAudioChannels.bind(currentSettings);
export const preferFmp4HlsContainer = currentSettings.preferFmp4HlsContainer.bind(currentSettings);
export const enableCinemaMode = currentSettings.enableCinemaMode.bind(currentSettings);
export const enableAudioNormalization = currentSettings.enableAudioNormalization.bind(currentSettings);
export const enableNextVideoInfoOverlay = currentSettings.enableNextVideoInfoOverlay.bind(currentSettings);
export const enableThemeSongs = currentSettings.enableThemeSongs.bind(currentSettings);
export const enableThemeVideos = currentSettings.enableThemeVideos.bind(currentSettings);

View file

@ -132,6 +132,7 @@
"ChannelNumber": "Channel number",
"Channels": "Channels",
"CinemaModeConfigurationHelp": "Cinema mode brings the theater experience straight to your living room with the ability to play trailers and custom intros before the main feature.",
"EnableAudioNormalizationHelp": "Audio normalization will add a constant gain to keep the average at a desired level(-18db). ",
"ClearQueue": "Clear queue",
"ClientSettings": "Client Settings",
"Collections": "Collections",
@ -222,6 +223,7 @@
"EnableBlurHash": "Enable blurred placeholders for images",
"EnableBlurHashHelp": "Images that are still being loaded will be displayed with a unique placeholder.",
"EnableCinemaMode": "Cinema mode",
"EnableAudioNormalization": "Audio Normalization",
"EnableColorCodedBackgrounds": "Color coded backgrounds",
"EnableDecodingColorDepth10Hevc": "Enable 10-bit hardware decoding for HEVC",
"EnableDecodingColorDepth10Vp9": "Enable 10-bit hardware decoding for VP9",