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
@@ -54,6 +54,14 @@
|
||||
geometry, so a theme consumes the properties to style each state and to give either bar its own shape and
|
||||
orientation. The player marks the bar with 'is-buffering' while it is loading, and carries the state in
|
||||
'data-audio-player-progress-state' ('idle', 'ready' or 'buffering') together with the slider ARIA attributes.
|
||||
- The VU meter root carries 'data-audio-player-vu-meter'. The player fills it with one 'audio-player-vu-channel'
|
||||
element per band, one 'audio-player-vu-segment' per segment of the channel, and one 'audio-player-vu-peak' per
|
||||
channel, and writes 'data-audio-player-vu-segment-state' ('active' or 'inactive'),
|
||||
'data-audio-player-vu-segment-zone' ('normal', 'medium' or 'high') and 'data-audio-player-vu-peak-state'
|
||||
('active' or 'inactive'). It publishes the segment gap and the peak position as the custom properties
|
||||
'--audio-player-vu-segment-gap' and '--audio-player-vu-peak-position'. The root sits between the album art and
|
||||
the current time label; a theme that does not render the hook gets the meter inserted there when the bar is bound.
|
||||
The meter is entirely theme-owned: the stylesheet decides its shape, orientation, size and colors.
|
||||
- Themed shells only: the plain text script elements that carry the raw source of the
|
||||
'shared/audio-player/queue-item' and 'shared/audio-player/playlist-item' sub templates, with the ids
|
||||
'audio-player-template-queue-item' and 'audio-player-template-playlist-item'. This application fallback partial
|
||||
@@ -102,9 +110,11 @@
|
||||
<ul class="audio-player-queue" data-audio-player-queue aria-label="@localizer["AudioPlayerQueue"]"></ul>
|
||||
</div>
|
||||
</div>
|
||||
<!-- Condensed bar: transport controls, three state progress bar, volume, and track name. -->
|
||||
<!-- Condensed bar: transport controls, three state progress bar, volume, VU meter and track name. -->
|
||||
<div class="audio-player-bar">
|
||||
<img class="audio-player-cover-thumbnail" data-audio-player-cover-thumbnail alt="" />
|
||||
<!-- VU meter: one segmented channel per band. The script fills it, and a theme restyles every part. -->
|
||||
<div class="audio-player-vu-meter" data-audio-player-vu-meter aria-hidden="true"></div>
|
||||
<div class="audio-player-track-labels">
|
||||
<span class="audio-player-track-name" data-audio-player-track-name></span>
|
||||
<span class="audio-player-album-name" data-audio-player-album-name></span>
|
||||
|
||||
@@ -122,6 +122,7 @@
|
||||
<script defer src="~/js/audio-player/audio-player-utils.js" asp-append-version="true"></script>
|
||||
<script defer src="~/js/audio-player/audio-player-errors.js" asp-append-version="true"></script>
|
||||
<script defer src="~/js/audio-player/audio-player-events.js" asp-append-version="true"></script>
|
||||
<script defer src="~/js/audio-player/audio-player-vu-meter.js" asp-append-version="true"></script>
|
||||
<script defer src="~/js/audio-player/audio-player-queue.js" asp-append-version="true"></script>
|
||||
<script defer src="~/js/audio-player/audio-player-download.js" asp-append-version="true"></script>
|
||||
<script defer src="~/js/audio-player/audio-player-render.js" asp-append-version="true"></script>
|
||||
|
||||
@@ -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