fix(dock): TRAX ladder gets the mic's ballistics (and a 33 Hz beat)
Reported: the TRAX bar moves, but its sampling looks far slower than the mic meter. Cause: the TRAX number was a raw instantaneous peak per metering block — a stutter sampled by the UI timer, with no smoothing. The mic looks fluid because it is smoothed at audio-callback rate. Fix: the player now smooths its measured level with the SAME curve the mic uses (MeterScale.NextLevel: fast attack, gentle decay), and the dock's meter clock runs at ~30 Hz instead of 20. Two ladders that move alike, because they are the same ballistics. Guard: MeterScaleTests pins the attack/decay behaviour alongside peak-hold.
This commit is contained in:
@@ -84,7 +84,8 @@ public sealed class MusicPlayer : ITraxPlayer
|
||||
_volume = new VolumeWaveProvider16(_reader) { Volume = MusicVolume * _userGain * _localGain };
|
||||
_metering = new MeteringSampleProvider(_volume.ToSampleProvider());
|
||||
_metering.StreamVolume += (_, e) =>
|
||||
Level = e.MaxSampleValues.Length == 0 ? 0f : e.MaxSampleValues.Max();
|
||||
Level = Helpers.MeterScale.NextLevel(Level,
|
||||
e.MaxSampleValues.Length == 0 ? 0f : e.MaxSampleValues.Max());
|
||||
_output = new WaveOutEvent();
|
||||
_output.PlaybackStopped += OnPlaybackStopped;
|
||||
_output.Init(_metering);
|
||||
|
||||
Reference in New Issue
Block a user