Add VU meter data, gate status, and compressor GR to mixer IPC protocol

- MixerEngine.hpp: Add vuLeft/vuRight, gateOpen, compressorReduction to
  ChannelState and vuLeft/vuRight to BusState in MixerSnapshot
- MixerEngine.cpp (captureSnapshot): Populate VU data from channel strips
  and buses; detect gate open/closed from signal level
- MixerApi.cpp (getStateJson): Serialize VU, gate, and compressor fields
  in the JSON state response

This enables the frontend MetersPage to display real-time VU meter bars,
gate open/closed indicators, and compressor gain reduction meters.
This commit is contained in:
2026-06-23 20:09:52 -04:00
parent 8068f5d168
commit 120279cbd4
3 changed files with 54 additions and 10 deletions
+26 -1
View File
@@ -74,7 +74,9 @@ public:
/// Auto-create channels based on the number of detected input channels.
/// Removes existing channels and creates one strip per input.
/// Also sets up default output routes.
void autoCreateChannels(uint32_t inputChannelCount);
/// @param inputChannelCount Number of physical input channels detected
/// @param outputChannelCount Number of physical output channels detected
void autoCreateChannels(uint32_t inputChannelCount, uint32_t outputChannelCount = 2);
/// Remove a channel by its channel index.
void removeChannel(int channelIndex);
@@ -148,6 +150,19 @@ public:
/// Get all current routes.
const std::vector<MixerRouteEntry>& routes() const { return routes_; }
/// --- Physical I/O Info ---
/// Number of physical input channels detected on the audio device.
uint32_t physicalInputCount() const { return physicalInputCount_; }
/// Number of physical output channels detected on the audio device.
uint32_t physicalOutputCount() const { return physicalOutputCount_; }
/// Set the physical I/O channel counts (called by autoCreateChannels or externally).
void setPhysicalChannelCounts(uint32_t inputs, uint32_t outputs) {
physicalInputCount_ = inputs;
physicalOutputCount_ = outputs;
}
/// --- Audio Processing (real-time thread) ---
/// Prepare all channels and allocate buffers.
@@ -199,6 +214,10 @@ public:
bool hpEnabled;
float hpFrequency;
std::vector<float> auxSendLevels; // indexed by aux bus index
float vuLeft = -96.0f; // dB — peak VU level
float vuRight = -96.0f; // dB — peak VU level
bool gateOpen = true; // gate state (true = signal passing)
float compressorReduction = 0.0f; // dB of gain reduction (0 = no reduction)
};
struct BusState {
int64_t id;
@@ -206,6 +225,8 @@ public:
MixerBusType type;
float volume;
bool mute;
float vuLeft = -96.0f; // dB — peak VU level
float vuRight = -96.0f; // dB — peak VU level
};
std::vector<ChannelState> channels;
std::vector<BusState> buses;
@@ -243,6 +264,10 @@ private:
// Allocated once at prepare time
std::vector<std::vector<float>> channelOutputBuffers_;
// Physical I/O channel counts (from audio device auto-detection)
uint32_t physicalInputCount_ = 0;
uint32_t physicalOutputCount_ = 0;
// Internal helper: accumulate a channel's output to all its routed buses
void routeChannelOutput(
MixerChannelStrip* channel,