initial commit

This commit is contained in:
2026-03-25 19:46:15 +01:00
commit a513c66503
26 changed files with 2892 additions and 0 deletions

43
src/ui/SpectrumDisplay.h Normal file
View File

@@ -0,0 +1,43 @@
#pragma once
#include "core/Types.h"
#include <imgui.h>
#include <vector>
namespace baudline {
struct ChannelStyle {
ImU32 lineColor;
ImU32 fillColor;
};
class SpectrumDisplay {
public:
// Draw multiple channel spectra overlaid.
// `spectra` has one entry per channel; `styles` has matching colors.
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;
// Convenience: single-channel draw (backward compat).
void draw(const std::vector<float>& 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) const;
float freqToScreenX(double freq, float posX, float sizeX,
double sampleRate, bool isIQ, FreqScale freqScale) const;
float screenYToDB(float screenY, float posY, float sizeY,
float minDB, float maxDB) const;
bool showGrid = true;
bool fillSpectrum = false;
};
} // namespace baudline