mirror of
https://github.com/BinaryAlley/Nemera.git
synced 2026-12-03 15:11:10 +00:00
Adds VU meter to the audio player bar
Adds a segmented spectrum VU meter to the condensed player bar, fed by an analyser tapped after ReplayGain and before the volume, so the meter does not depend on the output volume. Adds per-user VU meter settings (orientation, segment count and gap, thresholds, peak marker, hold and falloff rates) across the domain, persistence, API contracts, validation and the settings page, with a migration and localized resources. Sizes the meter cells in whole pixels and keeps the frame clock steady on browsers that round timers. Updates the theming guide, API documentation, request samples and the user manual.
This commit is contained in:
1 parent
9889c86c76
commit
2e9f7d8496
66 files changed
+7844
-81
No files matched your search
@@ -202,6 +202,106 @@
|
||||
</div>
|
||||
<small class="form-label text-disabled form-description">@_localizer["DescriptionStreamingQuality"]</small>
|
||||
</div>
|
||||
<!-- VU meter. -->
|
||||
<div class="form-row">
|
||||
<h4 class="text-light-two w-100">@_localizer["VuMeter"]</h4>
|
||||
</div>
|
||||
<!-- Orientation. -->
|
||||
<div class="form-row">
|
||||
<div class="form-label">
|
||||
<label for="VuMeterOrientation">@_localizer["VuMeterOrientation"]</label>:
|
||||
</div>
|
||||
<div class="form-field">
|
||||
<select id="VuMeterOrientation" class="enlightenment-input">
|
||||
<option value="Vertical">@_localizer["VuMeterOrientationVertical"]</option>
|
||||
<option value="Horizontal">@_localizer["VuMeterOrientationHorizontal"]</option>
|
||||
</select>
|
||||
</div>
|
||||
<small class="form-label text-disabled form-description">@_localizer["DescriptionVuMeterOrientation"]</small>
|
||||
</div>
|
||||
<!-- Segment count. -->
|
||||
<div class="form-row">
|
||||
<div class="form-label">
|
||||
<label for="VuMeterSegmentCount">@_localizer["VuMeterSegmentCount"]</label>:
|
||||
</div>
|
||||
<div class="form-field">
|
||||
<input type="number" id="VuMeterSegmentCount" min="1" max="128" step="1" class="enlightenment-input" />
|
||||
</div>
|
||||
<small class="form-label text-disabled form-description">@_localizer["DescriptionVuMeterSegmentCount"]</small>
|
||||
</div>
|
||||
<!-- Segment gap. -->
|
||||
<div class="form-row">
|
||||
<div class="form-label">
|
||||
<label for="VuMeterSegmentGap">@_localizer["VuMeterSegmentGap"]</label>:
|
||||
</div>
|
||||
<div class="form-field">
|
||||
<input type="number" id="VuMeterSegmentGap" min="0" max="32" step="1" class="enlightenment-input" />
|
||||
</div>
|
||||
<small class="form-label text-disabled form-description">@_localizer["DescriptionVuMeterSegmentGap"]</small>
|
||||
</div>
|
||||
<!-- Medium threshold. -->
|
||||
<div class="form-row">
|
||||
<div class="form-label">
|
||||
<label for="VuMeterMediumThreshold">@_localizer["VuMeterMediumThreshold"]</label>:
|
||||
</div>
|
||||
<div class="form-field">
|
||||
<input type="number" id="VuMeterMediumThreshold" min="0" max="1" step="0.05" class="enlightenment-input" />
|
||||
</div>
|
||||
<small class="form-label text-disabled form-description">@_localizer["DescriptionVuMeterMediumThreshold"]</small>
|
||||
</div>
|
||||
<!-- High threshold. -->
|
||||
<div class="form-row">
|
||||
<div class="form-label">
|
||||
<label for="VuMeterHighThreshold">@_localizer["VuMeterHighThreshold"]</label>:
|
||||
</div>
|
||||
<div class="form-field">
|
||||
<input type="number" id="VuMeterHighThreshold" min="0" max="1" step="0.05" class="enlightenment-input" />
|
||||
</div>
|
||||
<small class="form-label text-disabled form-description">@_localizer["DescriptionVuMeterHighThreshold"]</small>
|
||||
</div>
|
||||
<!-- Show peak. -->
|
||||
<div class="form-row">
|
||||
<div class="form-label">
|
||||
<label for="VuMeterShowPeak">@_localizer["VuMeterShowPeak"]</label>:
|
||||
</div>
|
||||
<div class="form-field">
|
||||
<label class="enlightenment-checkbox-label">
|
||||
<input type="checkbox" id="VuMeterShowPeak" class="enlightenment-checkbox-hidden" />
|
||||
<span class="enlightenment-checkbox"></span>
|
||||
</label>
|
||||
</div>
|
||||
<small class="form-label text-disabled form-description">@_localizer["DescriptionVuMeterShowPeak"]</small>
|
||||
</div>
|
||||
<!-- Peak hold duration. -->
|
||||
<div class="form-row">
|
||||
<div class="form-label">
|
||||
<label for="VuMeterPeakHoldDurationInMilliseconds">@_localizer["VuMeterPeakHoldDuration"]</label>:
|
||||
</div>
|
||||
<div class="form-field">
|
||||
<input type="number" id="VuMeterPeakHoldDurationInMilliseconds" min="0" max="10000" step="50" class="enlightenment-input" />
|
||||
</div>
|
||||
<small class="form-label text-disabled form-description">@_localizer["DescriptionVuMeterPeakHoldDuration"]</small>
|
||||
</div>
|
||||
<!-- Display release. -->
|
||||
<div class="form-row">
|
||||
<div class="form-label">
|
||||
<label for="VuMeterReleasePerSecond">@_localizer["VuMeterReleasePerSecond"]</label>:
|
||||
</div>
|
||||
<div class="form-field">
|
||||
<input type="number" id="VuMeterReleasePerSecond" min="0" max="100" step="0.05" class="enlightenment-input" />
|
||||
</div>
|
||||
<small class="form-label text-disabled form-description">@_localizer["DescriptionVuMeterReleasePerSecond"]</small>
|
||||
</div>
|
||||
<!-- Peak release. -->
|
||||
<div class="form-row">
|
||||
<div class="form-label">
|
||||
<label for="VuMeterPeakReleasePerSecond">@_localizer["VuMeterPeakReleasePerSecond"]</label>:
|
||||
</div>
|
||||
<div class="form-field">
|
||||
<input type="number" id="VuMeterPeakReleasePerSecond" min="0" max="100" step="0.05" class="enlightenment-input" />
|
||||
</div>
|
||||
<small class="form-label text-disabled form-description">@_localizer["DescriptionVuMeterPeakReleasePerSecond"]</small>
|
||||
</div>
|
||||
<div class="form-row" style="justify-content: center;">
|
||||
<button type="submit" class="confirm-button h-22px">@_localizer["Save"]</button>
|
||||
</div>
|
||||
@@ -231,6 +331,15 @@
|
||||
const checkboxIsGaplessPlaybackEnabled = document.getElementById('IsGaplessPlaybackEnabled');
|
||||
const selectReplayGainMode = document.getElementById('ReplayGainMode');
|
||||
const selectStreamingQuality = document.getElementById('StreamingQuality');
|
||||
const selectVuMeterOrientation = document.getElementById('VuMeterOrientation');
|
||||
const inputVuMeterSegmentCount = document.getElementById('VuMeterSegmentCount');
|
||||
const inputVuMeterSegmentGap = document.getElementById('VuMeterSegmentGap');
|
||||
const inputVuMeterMediumThreshold = document.getElementById('VuMeterMediumThreshold');
|
||||
const inputVuMeterHighThreshold = document.getElementById('VuMeterHighThreshold');
|
||||
const checkboxVuMeterShowPeak = document.getElementById('VuMeterShowPeak');
|
||||
const inputVuMeterPeakHoldDurationInMilliseconds = document.getElementById('VuMeterPeakHoldDurationInMilliseconds');
|
||||
const inputVuMeterReleasePerSecond = document.getElementById('VuMeterReleasePerSecond');
|
||||
const inputVuMeterPeakReleasePerSecond = document.getElementById('VuMeterPeakReleasePerSecond');
|
||||
|
||||
// Toggle the enabled state of the items per page input based on the pagination checkbox.
|
||||
function updateItemsPerPageEnabledState() {
|
||||
@@ -254,11 +363,25 @@
|
||||
checkboxIsGaplessPlaybackEnabled.checked = data.isGaplessPlaybackEnabled === true;
|
||||
selectReplayGainMode.value = data.replayGainMode ?? 'Off';
|
||||
selectStreamingQuality.value = data.streamingQuality ?? 'Auto';
|
||||
selectVuMeterOrientation.value = data.vuMeterOrientation ?? 'Vertical';
|
||||
inputVuMeterSegmentCount.value = data.vuMeterSegmentCount ?? 12;
|
||||
inputVuMeterSegmentGap.value = data.vuMeterSegmentGap ?? 1;
|
||||
inputVuMeterMediumThreshold.value = data.vuMeterMediumThreshold ?? 0.6;
|
||||
inputVuMeterHighThreshold.value = data.vuMeterHighThreshold ?? 0.8;
|
||||
checkboxVuMeterShowPeak.checked = data.vuMeterShowPeak !== false;
|
||||
inputVuMeterPeakHoldDurationInMilliseconds.value = data.vuMeterPeakHoldDurationInMilliseconds ?? 650;
|
||||
inputVuMeterReleasePerSecond.value = data.vuMeterReleasePerSecond ?? 3;
|
||||
inputVuMeterPeakReleasePerSecond.value = data.vuMeterPeakReleasePerSecond ?? 0.65;
|
||||
updateItemsPerPageEnabledState();
|
||||
}
|
||||
}
|
||||
|
||||
// Save the settings of the current user.
|
||||
// An empty numeric field is sent as null, so the server reports it as missing instead of reading it as zero.
|
||||
function readOptionalNumber(input) {
|
||||
return input.value.trim() === '' ? null : Number(input.value);
|
||||
}
|
||||
|
||||
async function handleSaveUserSettingsAsync() {
|
||||
const formData = {
|
||||
IsPaginationEnabled: checkboxIsPaginationEnabled.checked,
|
||||
@@ -273,11 +396,25 @@
|
||||
ShouldAutoplay: checkboxShouldAutoplay.checked,
|
||||
IsGaplessPlaybackEnabled: checkboxIsGaplessPlaybackEnabled.checked,
|
||||
ReplayGainMode: selectReplayGainMode.value,
|
||||
StreamingQuality: selectStreamingQuality.value
|
||||
StreamingQuality: selectStreamingQuality.value,
|
||||
VuMeterOrientation: selectVuMeterOrientation.value,
|
||||
VuMeterSegmentCount: readOptionalNumber(inputVuMeterSegmentCount),
|
||||
VuMeterSegmentGap: readOptionalNumber(inputVuMeterSegmentGap),
|
||||
VuMeterMediumThreshold: readOptionalNumber(inputVuMeterMediumThreshold),
|
||||
VuMeterHighThreshold: readOptionalNumber(inputVuMeterHighThreshold),
|
||||
VuMeterShowPeak: checkboxVuMeterShowPeak.checked,
|
||||
VuMeterPeakHoldDurationInMilliseconds: readOptionalNumber(inputVuMeterPeakHoldDurationInMilliseconds),
|
||||
VuMeterReleasePerSecond: readOptionalNumber(inputVuMeterReleasePerSecond),
|
||||
VuMeterPeakReleasePerSecond: readOptionalNumber(inputVuMeterPeakReleasePerSecond)
|
||||
};
|
||||
const data = await callApiPostAsync('@_urlService.GetAbsoluteUrl(WebRoutes.Settings.UPDATE_USER_SETTINGS)', formData);
|
||||
if (data && data.isUpdated === true)
|
||||
if (data && data.isUpdated === true) {
|
||||
notificationService.show('@_localizer["SettingsSaved"]', NotificationType.SUCCESS);
|
||||
// The player lives in the layout and is not recreated by the navigation manager, so the saved playback and
|
||||
// VU meter settings are handed to it directly instead of waiting for a full page reload.
|
||||
if (window.LuminaAudioPlayer && window.LuminaAudioPlayer.instance && typeof window.LuminaAudioPlayer.instance.reloadPreferencesAsync === 'function')
|
||||
await window.LuminaAudioPlayer.instance.reloadPreferencesAsync();
|
||||
}
|
||||
}
|
||||
|
||||
// On form submit event.
|
||||
|
||||
Reference in new issue
Block a user