commit no. 3

This commit is contained in:
2026-03-25 19:47:16 +01:00
parent f45278123f
commit cc5241a1e5
11 changed files with 541 additions and 218 deletions

View File

@@ -15,12 +15,14 @@ class SpectrumDisplay {
public:
// Draw multiple channel spectra overlaid.
// `spectra` has one entry per channel; `styles` has matching colors.
// viewLo/viewHi (01) control the visible frequency range (zoom/pan).
void draw(const std::vector<std::vector<float>>& spectra,
const std::vector<ChannelStyle>& styles,
float minDB, float maxDB,
double sampleRate, bool isIQ,
FreqScale freqScale,
float posX, float posY, float sizeX, float sizeY) const;
float posX, float posY, float sizeX, float sizeY,
float viewLo = 0.0f, float viewHi = 1.0f) const;
// Convenience: single-channel draw (backward compat).
void draw(const std::vector<float>& spectrumDB,
@@ -30,14 +32,26 @@ public:
float posX, float posY, float sizeX, float sizeY) const;
double screenXToFreq(float screenX, float posX, float sizeX,
double sampleRate, bool isIQ, FreqScale freqScale) const;
double sampleRate, bool isIQ, FreqScale freqScale,
float viewLo = 0.0f, float viewHi = 1.0f) const;
float freqToScreenX(double freq, float posX, float sizeX,
double sampleRate, bool isIQ, FreqScale freqScale) const;
double sampleRate, bool isIQ, FreqScale freqScale,
float viewLo = 0.0f, float viewHi = 1.0f) const;
float screenYToDB(float screenY, float posY, float sizeY,
float minDB, float maxDB) const;
bool showGrid = true;
bool fillSpectrum = false;
// Peak hold: update with current spectra, then draw the held peaks.
void updatePeakHold(const std::vector<std::vector<float>>& spectra);
void clearPeakHold();
bool showGrid = true;
bool fillSpectrum = false;
bool peakHoldEnable = false;
float peakHoldDecay = 20.0f; // dB/second decay rate
private:
// One peak-hold trace per channel.
mutable std::vector<std::vector<float>> peakHold_;
};
} // namespace baudline