Mix1.hpp (1406B)
1 #pragma once 2 3 #include "bogaudio.hpp" 4 #include "mixer.hpp" 5 #include "dsp/signal.hpp" 6 7 using namespace bogaudio::dsp; 8 9 extern Model* modelMix1; 10 11 namespace bogaudio { 12 13 struct Mix1 : LinearCVMixerModule { 14 enum ParamsIds { 15 LEVEL_PARAM, 16 MUTE_PARAM, 17 NUM_PARAMS 18 }; 19 20 enum InputsIds { 21 MUTE_INPUT, 22 LEVEL_INPUT, 23 IN_INPUT, 24 NUM_INPUTS 25 }; 26 27 enum OutputsIds { 28 OUT_OUTPUT, 29 NUM_OUTPUTS 30 }; 31 32 MixerChannel* _engines[maxChannels] {}; 33 float _rmsSum = 0.0f; 34 float _rms = 0.0f; 35 36 Mix1() { 37 config(NUM_PARAMS, NUM_INPUTS, NUM_OUTPUTS); 38 configParam(LEVEL_PARAM, 0.0f, 1.0f, fabsf(MixerChannel::minDecibels) / (MixerChannel::maxDecibels - MixerChannel::minDecibels), "Level", "dB", 0.0f, MixerChannel::maxDecibels - MixerChannel::minDecibels, MixerChannel::minDecibels); 39 configSwitch(MUTE_PARAM, 0.0f, 1.0f, 0.0f, "Mute", {"Unmuted", "Muted"}); 40 configBypass(IN_INPUT, OUT_OUTPUT); 41 42 configInput(MUTE_INPUT, "Mute CV"); 43 configInput(LEVEL_INPUT, "Level CV"); 44 configInput(IN_INPUT, "Signal"); 45 46 configOutput(OUT_OUTPUT, "Signal"); 47 } 48 49 void sampleRateChange() override; 50 bool active() override; 51 int channels() override; 52 void addChannel(int c) override; 53 void removeChannel(int c) override; 54 void processAlways(const ProcessArgs& args) override; 55 void processChannel(const ProcessArgs& args, int c) override; 56 void postProcessAlways(const ProcessArgs& args) override; 57 }; 58 59 } // namespace bogaudio