commit no. 7

This commit is contained in:
2026-03-25 19:48:24 +01:00
parent cf397eaa2d
commit 7b9a87fbc0
8 changed files with 628 additions and 274 deletions

View File

@@ -2,6 +2,7 @@
#include "core/Types.h"
#include "ui/SpectrumDisplay.h"
#include <deque>
#include <vector>
namespace baudline {
@@ -27,7 +28,7 @@ public:
float viewLo = 0.0f, float viewHi = 1.0f) const;
// Draw cursor readout panel (ImGui widgets).
void drawPanel() const;
void drawPanel();
// Set cursor A/B positions from mouse click.
void setCursorA(double freq, float dB, int bin);
@@ -47,6 +48,23 @@ public:
// Hover cursor (follows mouse, always active)
CursorInfo hover;
// Averaging: displayed dB is the mean of the last N samples.
int avgCount = 1; // 1 = no averaging
// Averaged dB values (used for display and delta).
float avgDBA() const;
float avgDBB() const;
private:
// Averaging state per cursor.
struct AvgState {
std::deque<float> samples;
double sum = 0.0;
int lastBin = -1; // reset when cursor moves
};
mutable AvgState avgA_, avgB_;
void pushAvg(AvgState& st, float dB, int bin) const;
};
} // namespace baudline