a5423b7f55
Extracted from op-pedal mixer-engine branch. Core components: - MixerEngine / MixerChannelStrip / MixerBus — cleaned of LV2/Pedalboard/IHost/MidiMapper deps - MixerControlServer — Unix domain socket JSON control interface - main.cpp — JACK audio I/O client with headless fallback - CMake build — auto-fetches nlohmann/json, links JACK - 9 core tests passing Architecture: JACK ports → MixerEngine::process() → JACK ports, controlled via Unix socket JSON commands.
91 lines
2.7 KiB
C++
91 lines
2.7 KiB
C++
// Copyright (c) 2026 Ourpad Network
|
|
// See LICENSE file in the project root for full license text.
|
|
|
|
#pragma once
|
|
|
|
#include <cstdint>
|
|
#include <string>
|
|
#include <vector>
|
|
|
|
namespace mixer {
|
|
|
|
/// Types of buses in the mixer architecture.
|
|
enum class MixerBusType {
|
|
Master, // Main L/R output — end of signal chain
|
|
Subgroup, // Named subgroup (Drums, Guitars, Vocals...)
|
|
Aux, // Aux send bus (monitor mix or FX send)
|
|
FxReturn, // Stereo return from a shared FX processor (reverb, delay)
|
|
};
|
|
|
|
/// Channel type classification for mixer channel strips.
|
|
enum class MixerChannelType {
|
|
Instrument, // guitar, bass, keys — expects amp modeling
|
|
Mic, // vocal mic — expects compressor, EQ, reverb chain
|
|
Line, // line-level input (backing tracks, synths, drum machines)
|
|
AuxReturn, // return from external FX processor
|
|
};
|
|
|
|
/// Configuration for a single aux send on a channel strip.
|
|
struct AuxSendConfig {
|
|
float level = -96.0f; // dB, -96 ≈ -inf (effectively off)
|
|
bool preFader = false; // true = pre-fader (monitor send), false = post-fader (FX send)
|
|
int64_t targetBusId = -1; // bus ID this sends to
|
|
|
|
bool isActive() const { return level > -90.0f && targetBusId >= 0; }
|
|
};
|
|
|
|
/// Per-channel high-pass filter configuration.
|
|
struct HpfConfig {
|
|
bool enabled = false;
|
|
float frequency = 80.0f; // Hz
|
|
};
|
|
|
|
/// Routing entry: a source (channel or bus) feeds a target bus with a level.
|
|
struct MixerRouteEntry {
|
|
enum SourceType {
|
|
SourceChannel,
|
|
SourceBus
|
|
};
|
|
|
|
SourceType sourceType;
|
|
int64_t sourceId; // channel instanceId or bus ID
|
|
int64_t targetBusId; // the bus being fed into
|
|
float level = 0.0f; // dB
|
|
};
|
|
|
|
/// Describes a mapping from a mixer bus to physical output channels.
|
|
struct MixerOutputRoute {
|
|
int64_t sourceBusId; // Bus to route from
|
|
int sourceStartChannel; // Starting channel on the bus (0=L, 1=R)
|
|
int targetStartChannel; // Starting physical output channel
|
|
int channels; // Number of consecutive channels to route (1 or 2 typically)
|
|
};
|
|
|
|
/// A complete snapshot of the mixer state for save/restore.
|
|
struct MixerSnapshot {
|
|
struct ChannelState {
|
|
int channelIndex;
|
|
float volume;
|
|
float pan;
|
|
bool mute;
|
|
bool solo;
|
|
MixerChannelType channelType;
|
|
std::string label;
|
|
bool hpEnabled;
|
|
float hpFrequency;
|
|
std::vector<float> auxSendLevels; // indexed by aux bus index
|
|
};
|
|
struct BusState {
|
|
int64_t id;
|
|
std::string name;
|
|
MixerBusType type;
|
|
float volume;
|
|
bool mute;
|
|
};
|
|
std::vector<ChannelState> channels;
|
|
std::vector<BusState> buses;
|
|
std::vector<MixerRouteEntry> routes;
|
|
};
|
|
|
|
} // namespace mixer
|