#pragma once #include "core/Types.h" #include #include namespace baudmine { struct ChannelStyle { ImU32 lineColor; ImU32 fillColor; }; class SpectrumDisplay { public: // Draw multiple channel spectra overlaid. // `spectra` has one entry per channel; `styles` has matching colors. // viewLo/viewHi (0–1) control the visible frequency range (zoom/pan). void draw(const std::vector>& spectra, const std::vector& styles, float minDB, float maxDB, double sampleRate, bool isIQ, FreqScale freqScale, float posX, float posY, float sizeX, float sizeY, float viewLo = 0.0f, float viewHi = 1.0f, int minPixPerBin = 1) const; // Convenience: single-channel draw (backward compat). void draw(const std::vector& spectrumDB, float minDB, float maxDB, double sampleRate, bool isIQ, FreqScale freqScale, float posX, float posY, float sizeX, float sizeY) const; double screenXToFreq(float screenX, float posX, float sizeX, 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, float viewLo = 0.0f, float viewHi = 1.0f) const; float screenYToDB(float screenY, float posY, float sizeY, float minDB, float maxDB) const; // Peak hold: update with current spectra, then draw the held peaks. void updatePeakHold(const std::vector>& spectra); void clearPeakHold(); bool showGrid = true; bool fillSpectrum = false; bool additiveBlend = true; // additive color mixing for multi-channel bool peakHoldEnable = false; float peakHoldDecay = 20.0f; // dB/second decay rate private: // One peak-hold trace per channel. mutable std::vector> peakHold_; }; } // namespace baudmine