mirror of
https://github.com/BinaryAlley/Nemera.git
synced 2026-12-03 13: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
+45
@@ -91,6 +91,51 @@ public class UserSettingsEntity : IStorageEntity, IAuditableEntity
|
||||
/// </summary>
|
||||
public PlaybackStreamingQuality StreamingQuality { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the direction in which each channel of the VU meter of the audio player grows.
|
||||
/// </summary>
|
||||
public VuMeterOrientation VuMeterOrientation { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the number of segments each channel of the VU meter is divided into.
|
||||
/// </summary>
|
||||
public int VuMeterSegmentCount { get; set; } = 12;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the gap, in pixels, between the segments and the channels of the VU meter.
|
||||
/// </summary>
|
||||
public int VuMeterSegmentGap { get; set; } = 1;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the level, between 0 and 1, above which a segment of the VU meter is drawn with its medium state.
|
||||
/// </summary>
|
||||
public double VuMeterMediumThreshold { get; set; } = 0.6;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the level, between 0 and 1, above which a segment of the VU meter is drawn with its high state.
|
||||
/// </summary>
|
||||
public double VuMeterHighThreshold { get; set; } = 0.8;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets whether the VU meter holds the peak level of each channel after it falls, or not.
|
||||
/// </summary>
|
||||
public bool VuMeterShowPeak { get; set; } = true;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the time, in milliseconds, a peak of the VU meter is held before it starts falling.
|
||||
/// </summary>
|
||||
public int VuMeterPeakHoldDurationInMilliseconds { get; set; } = 650;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the number of level units the display of the VU meter falls per second when the input level drops.
|
||||
/// </summary>
|
||||
public double VuMeterReleasePerSecond { get; set; } = 3.0;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the number of level units the peak of the VU meter falls per second after its hold time elapsed.
|
||||
/// </summary>
|
||||
public double VuMeterPeakReleasePerSecond { get; set; } = 0.65;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the last volume the player reported for the user. Written automatically by the player, and not part of the settings the user edits.
|
||||
/// </summary>
|
||||
|
||||
+10
-1
@@ -30,7 +30,16 @@ public static class UpdateUserSettingsRequestMapping
|
||||
request.ShouldAutoplay,
|
||||
request.IsGaplessPlaybackEnabled,
|
||||
request.ReplayGainMode,
|
||||
request.StreamingQuality
|
||||
request.StreamingQuality,
|
||||
request.VuMeterOrientation,
|
||||
request.VuMeterSegmentCount,
|
||||
request.VuMeterSegmentGap,
|
||||
request.VuMeterMediumThreshold,
|
||||
request.VuMeterHighThreshold,
|
||||
request.VuMeterShowPeak,
|
||||
request.VuMeterPeakHoldDurationInMilliseconds,
|
||||
request.VuMeterReleasePerSecond,
|
||||
request.VuMeterPeakReleasePerSecond
|
||||
);
|
||||
}
|
||||
}
|
||||
+19
-1
@@ -39,6 +39,15 @@ public static class UserSettingsEntityMapping
|
||||
repositoryEntity.IsGaplessPlaybackEnabled,
|
||||
repositoryEntity.ReplayGainMode,
|
||||
repositoryEntity.StreamingQuality,
|
||||
repositoryEntity.VuMeterOrientation,
|
||||
repositoryEntity.VuMeterSegmentCount,
|
||||
repositoryEntity.VuMeterSegmentGap,
|
||||
repositoryEntity.VuMeterMediumThreshold,
|
||||
repositoryEntity.VuMeterHighThreshold,
|
||||
repositoryEntity.VuMeterShowPeak,
|
||||
repositoryEntity.VuMeterPeakHoldDurationInMilliseconds,
|
||||
repositoryEntity.VuMeterReleasePerSecond,
|
||||
repositoryEntity.VuMeterPeakReleasePerSecond,
|
||||
repositoryEntity.Volume,
|
||||
repositoryEntity.IsMuted
|
||||
);
|
||||
@@ -65,7 +74,16 @@ public static class UserSettingsEntityMapping
|
||||
repositoryEntity.ShouldAutoplay,
|
||||
repositoryEntity.IsGaplessPlaybackEnabled,
|
||||
repositoryEntity.ReplayGainMode,
|
||||
repositoryEntity.StreamingQuality
|
||||
repositoryEntity.StreamingQuality,
|
||||
repositoryEntity.VuMeterOrientation,
|
||||
repositoryEntity.VuMeterSegmentCount,
|
||||
repositoryEntity.VuMeterSegmentGap,
|
||||
repositoryEntity.VuMeterMediumThreshold,
|
||||
repositoryEntity.VuMeterHighThreshold,
|
||||
repositoryEntity.VuMeterShowPeak,
|
||||
repositoryEntity.VuMeterPeakHoldDurationInMilliseconds,
|
||||
repositoryEntity.VuMeterReleasePerSecond,
|
||||
repositoryEntity.VuMeterPeakReleasePerSecond
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -35,6 +35,15 @@ public static class UserSettingsMapping
|
||||
IsGaplessPlaybackEnabled = domainEntity.IsGaplessPlaybackEnabled,
|
||||
ReplayGainMode = domainEntity.ReplayGainMode,
|
||||
StreamingQuality = domainEntity.StreamingQuality,
|
||||
VuMeterOrientation = domainEntity.VuMeterOrientation,
|
||||
VuMeterSegmentCount = domainEntity.VuMeterSegmentCount,
|
||||
VuMeterSegmentGap = domainEntity.VuMeterSegmentGap,
|
||||
VuMeterMediumThreshold = domainEntity.VuMeterMediumThreshold,
|
||||
VuMeterHighThreshold = domainEntity.VuMeterHighThreshold,
|
||||
VuMeterShowPeak = domainEntity.VuMeterShowPeak,
|
||||
VuMeterPeakHoldDurationInMilliseconds = domainEntity.VuMeterPeakHoldDurationInMilliseconds,
|
||||
VuMeterReleasePerSecond = domainEntity.VuMeterReleasePerSecond,
|
||||
VuMeterPeakReleasePerSecond = domainEntity.VuMeterPeakReleasePerSecond,
|
||||
Volume = domainEntity.Volume,
|
||||
IsMuted = domainEntity.IsMuted
|
||||
};
|
||||
@@ -61,7 +70,16 @@ public static class UserSettingsMapping
|
||||
domainEntity.ShouldAutoplay,
|
||||
domainEntity.IsGaplessPlaybackEnabled,
|
||||
domainEntity.ReplayGainMode,
|
||||
domainEntity.StreamingQuality
|
||||
domainEntity.StreamingQuality,
|
||||
domainEntity.VuMeterOrientation,
|
||||
domainEntity.VuMeterSegmentCount,
|
||||
domainEntity.VuMeterSegmentGap,
|
||||
domainEntity.VuMeterMediumThreshold,
|
||||
domainEntity.VuMeterHighThreshold,
|
||||
domainEntity.VuMeterShowPeak,
|
||||
domainEntity.VuMeterPeakHoldDurationInMilliseconds,
|
||||
domainEntity.VuMeterReleasePerSecond,
|
||||
domainEntity.VuMeterPeakReleasePerSecond
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -174,6 +174,26 @@ public static class ValidatorUtilities
|
||||
return ruleBuilder.Must(value => !value.HasValue || value.Value >= valueToCompare);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Defines a validation rule that ensures the nullable double property is greater than or equal to the value another property of the request selects.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// If either the property or the selected comparison value is <see langword="null"/>, this rule passes (use
|
||||
/// <see cref="NotNull{TRequest, TProperty}(IRuleBuilder{TRequest, TProperty})"/> to check for missing values).
|
||||
/// </remarks>
|
||||
/// <typeparam name="TRequest">The type of the request being validated.</typeparam>
|
||||
/// <param name="ruleBuilder">The rule builder instance.</param>
|
||||
/// <param name="comparisonSelector">A function that selects the value the property must be greater than or equal to.</param>
|
||||
/// <returns>The current <see cref="IRuleBuilder{TRequest, TProperty}"/> instance for method chaining.</returns>
|
||||
public static IRuleBuilder<TRequest, double?> GreaterThanOrEqualTo<TRequest>(this IRuleBuilder<TRequest, double?> ruleBuilder, Func<TRequest, double?> comparisonSelector)
|
||||
{
|
||||
return ruleBuilder.Must((request, value) =>
|
||||
{
|
||||
double? comparisonValue = comparisonSelector(request);
|
||||
return !value.HasValue || !comparisonValue.HasValue || value.Value >= comparisonValue.Value;
|
||||
});
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Defines a validation rule that ensures the property is not <see langword="null"/>.
|
||||
/// </summary>
|
||||
@@ -365,6 +385,22 @@ public static class ValidatorUtilities
|
||||
return ruleBuilder.Must(value => !value.HasValue || (value.Value >= minimumValue && value.Value <= maximumValue));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Defines a validation rule that ensures the nullable double property is within the specified inclusive range.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// If the property is <see langword="null"/>, this rule passes (use <see cref="NotNull{TRequest, TProperty}(IRuleBuilder{TRequest, TProperty})"/> to check for missing values).
|
||||
/// </remarks>
|
||||
/// <typeparam name="TRequest">The type of the request being validated.</typeparam>
|
||||
/// <param name="ruleBuilder">The rule builder instance.</param>
|
||||
/// <param name="minimumValue">The minimum allowed value of the property.</param>
|
||||
/// <param name="maximumValue">The maximum allowed value of the property.</param>
|
||||
/// <returns>The current <see cref="IRuleBuilder{TRequest, TProperty}"/> instance for method chaining.</returns>
|
||||
public static IRuleBuilder<TRequest, double?> InclusiveBetween<TRequest>(this IRuleBuilder<TRequest, double?> ruleBuilder, double minimumValue, double maximumValue)
|
||||
{
|
||||
return ruleBuilder.Must(value => !value.HasValue || (value.Value >= minimumValue && value.Value <= maximumValue));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Defines a validation rule that ensures the property is equal to another property of the request.
|
||||
/// </summary>
|
||||
|
||||
+19
-1
@@ -21,6 +21,15 @@ namespace Lumina.Application.Core.UsersManagement.Settings.Commands.UpdateUserSe
|
||||
/// <param name="IsGaplessPlaybackEnabled">Whether the player transitions between consecutive tracks without a gap, or not.</param>
|
||||
/// <param name="ReplayGainMode">The way ReplayGain normalization is applied to the tracks the user plays.</param>
|
||||
/// <param name="StreamingQuality">The quality cap applied to the audio the server normalizes for the user.</param>
|
||||
/// <param name="VuMeterOrientation">The direction in which each channel of the VU meter of the audio player grows.</param>
|
||||
/// <param name="VuMeterSegmentCount">The number of segments each channel of the VU meter is divided into.</param>
|
||||
/// <param name="VuMeterSegmentGap">The gap, in pixels, between the segments and the channels of the VU meter.</param>
|
||||
/// <param name="VuMeterMediumThreshold">The level, between 0 and 1, above which a segment of the VU meter is drawn with its medium state.</param>
|
||||
/// <param name="VuMeterHighThreshold">The level, between 0 and 1, above which a segment of the VU meter is drawn with its high state.</param>
|
||||
/// <param name="VuMeterShowPeak">Whether the VU meter holds the peak level of each channel after it falls, or not.</param>
|
||||
/// <param name="VuMeterPeakHoldDurationInMilliseconds">The time, in milliseconds, a peak of the VU meter is held before it starts falling.</param>
|
||||
/// <param name="VuMeterReleasePerSecond">The number of level units the display of the VU meter falls per second when the input level drops.</param>
|
||||
/// <param name="VuMeterPeakReleasePerSecond">The number of level units the peak of the VU meter falls per second after its hold time elapsed.</param>
|
||||
public record UpdateUserSettingsCommand(
|
||||
bool IsPaginationEnabled,
|
||||
int ItemsPerPage,
|
||||
@@ -34,5 +43,14 @@ public record UpdateUserSettingsCommand(
|
||||
bool? ShouldAutoplay,
|
||||
bool? IsGaplessPlaybackEnabled,
|
||||
ReplayGainMode? ReplayGainMode,
|
||||
PlaybackStreamingQuality? StreamingQuality
|
||||
PlaybackStreamingQuality? StreamingQuality,
|
||||
VuMeterOrientation? VuMeterOrientation,
|
||||
int? VuMeterSegmentCount,
|
||||
int? VuMeterSegmentGap,
|
||||
double? VuMeterMediumThreshold,
|
||||
double? VuMeterHighThreshold,
|
||||
bool? VuMeterShowPeak,
|
||||
int? VuMeterPeakHoldDurationInMilliseconds,
|
||||
double? VuMeterReleasePerSecond,
|
||||
double? VuMeterPeakReleasePerSecond
|
||||
) : ICommand;
|
||||
+10
-1
@@ -124,6 +124,15 @@ public class UpdateUserSettingsCommandHandler : ICommandHandler<UpdateUserSettin
|
||||
command.ShouldAutoplay!.Value,
|
||||
command.IsGaplessPlaybackEnabled!.Value,
|
||||
command.ReplayGainMode!.Value,
|
||||
command.StreamingQuality!.Value);
|
||||
command.StreamingQuality!.Value,
|
||||
command.VuMeterOrientation!.Value,
|
||||
command.VuMeterSegmentCount!.Value,
|
||||
command.VuMeterSegmentGap!.Value,
|
||||
command.VuMeterMediumThreshold!.Value,
|
||||
command.VuMeterHighThreshold!.Value,
|
||||
command.VuMeterShowPeak!.Value,
|
||||
command.VuMeterPeakHoldDurationInMilliseconds!.Value,
|
||||
command.VuMeterReleasePerSecond!.Value,
|
||||
command.VuMeterPeakReleasePerSecond!.Value);
|
||||
}
|
||||
}
|
||||
+73
@@ -49,5 +49,78 @@ public class UpdateUserSettingsCommandValidator : AbstractValidator<UpdateUserSe
|
||||
.IsInEnum()
|
||||
.WithError(Errors.UserSettings.InvalidStreamingQuality)
|
||||
.When(command => command.StreamingQuality is not null);
|
||||
|
||||
RuleFor(command => command.VuMeterOrientation)
|
||||
.NotNull()
|
||||
.WithError(Errors.UserSettings.VuMeterOrientationCannotBeNull);
|
||||
|
||||
RuleFor(command => command.VuMeterOrientation)
|
||||
.IsInEnum()
|
||||
.WithError(Errors.UserSettings.InvalidVuMeterOrientation)
|
||||
.When(command => command.VuMeterOrientation is not null);
|
||||
|
||||
RuleFor(command => command.VuMeterSegmentCount)
|
||||
.NotNull()
|
||||
.WithError(Errors.UserSettings.VuMeterSegmentCountCannotBeNull);
|
||||
|
||||
RuleFor(command => command.VuMeterSegmentCount)
|
||||
.InclusiveBetween(1, 128)
|
||||
.WithError(Errors.UserSettings.VuMeterSegmentCountMustBeBetweenOneAndOneHundredTwentyEight);
|
||||
|
||||
RuleFor(command => command.VuMeterSegmentGap)
|
||||
.NotNull()
|
||||
.WithError(Errors.UserSettings.VuMeterSegmentGapCannotBeNull);
|
||||
|
||||
RuleFor(command => command.VuMeterSegmentGap)
|
||||
.InclusiveBetween(0, 32)
|
||||
.WithError(Errors.UserSettings.VuMeterSegmentGapMustBeBetweenZeroAndThirtyTwo);
|
||||
|
||||
RuleFor(command => command.VuMeterMediumThreshold)
|
||||
.NotNull()
|
||||
.WithError(Errors.UserSettings.VuMeterMediumThresholdCannotBeNull);
|
||||
|
||||
RuleFor(command => command.VuMeterMediumThreshold)
|
||||
.InclusiveBetween(0d, 1d)
|
||||
.WithError(Errors.UserSettings.VuMeterMediumThresholdMustBeBetweenZeroAndOne);
|
||||
|
||||
RuleFor(command => command.VuMeterHighThreshold)
|
||||
.NotNull()
|
||||
.WithError(Errors.UserSettings.VuMeterHighThresholdCannotBeNull);
|
||||
|
||||
RuleFor(command => command.VuMeterHighThreshold)
|
||||
.InclusiveBetween(0d, 1d)
|
||||
.WithError(Errors.UserSettings.VuMeterHighThresholdMustBeBetweenZeroAndOne);
|
||||
|
||||
RuleFor(command => command.VuMeterHighThreshold)
|
||||
.GreaterThanOrEqualTo(command => command.VuMeterMediumThreshold)
|
||||
.WithError(Errors.UserSettings.VuMeterHighThresholdMustBeGreaterThanOrEqualToMediumThreshold);
|
||||
|
||||
RuleFor(command => command.VuMeterShowPeak)
|
||||
.NotNull()
|
||||
.WithError(Errors.UserSettings.VuMeterShowPeakCannotBeNull);
|
||||
|
||||
RuleFor(command => command.VuMeterPeakHoldDurationInMilliseconds)
|
||||
.NotNull()
|
||||
.WithError(Errors.UserSettings.VuMeterPeakHoldDurationCannotBeNull);
|
||||
|
||||
RuleFor(command => command.VuMeterPeakHoldDurationInMilliseconds)
|
||||
.InclusiveBetween(0, 10000)
|
||||
.WithError(Errors.UserSettings.VuMeterPeakHoldDurationMustBeBetweenZeroAndTenThousandMilliseconds);
|
||||
|
||||
RuleFor(command => command.VuMeterReleasePerSecond)
|
||||
.NotNull()
|
||||
.WithError(Errors.UserSettings.VuMeterReleasePerSecondCannotBeNull);
|
||||
|
||||
RuleFor(command => command.VuMeterReleasePerSecond)
|
||||
.InclusiveBetween(0d, 100d)
|
||||
.WithError(Errors.UserSettings.VuMeterReleasePerSecondMustBeBetweenZeroAndOneHundred);
|
||||
|
||||
RuleFor(command => command.VuMeterPeakReleasePerSecond)
|
||||
.NotNull()
|
||||
.WithError(Errors.UserSettings.VuMeterPeakReleasePerSecondCannotBeNull);
|
||||
|
||||
RuleFor(command => command.VuMeterPeakReleasePerSecond)
|
||||
.InclusiveBetween(0d, 100d)
|
||||
.WithError(Errors.UserSettings.VuMeterPeakReleasePerSecondMustBeBetweenZeroAndOneHundred);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user