AM mode for ringmod effect

master
zetaPRIME 2022-03-25 08:15:25 -04:00
parent a6032be6a9
commit 2bfd06acf2
2 changed files with 6 additions and 1 deletions

View File

@ -58,6 +58,7 @@ void RingMod::process() {
for (size_t f = 0; f < ts; f++) {
AudioFrame fc = (*c)[f];
AudioFrame fm = (*m)[f];
if (am) fm = {std::abs(fm.l), std::abs(fm.r)};
(*out)[f] = (fc*fm * mix) + (fc * (1.0-mix));
}
@ -65,16 +66,19 @@ void RingMod::process() {
void RingMod::saveData(QCborMap& m) const {
m[qs("mix")] = mix;
m[qs("am")] = am;
}
void RingMod::loadData(const QCborMap& m) {
mix = m.value("mix").toDouble(mix);
am = m.value("am").toBool(am);
}
void RingMod::onGadgetCreated() {
if (!obj) return;
auto l = new LayoutGadget(obj);
//l->setMetrics(12);
l->setMetrics(3, 4);
KnobGadget::autoPercent(l, mix)->setLabel(qs("Mix"))->setDefault(1.0);
(new ToggleGadget(l))->bind(am)->setToolTip("AM mode", {1.0, 0.0})->setColor({127, 255, 127});
}

View File

@ -5,6 +5,7 @@
namespace Xybrid::Effects {
class RingMod : public Data::Node {
double mix = 1.0;
bool am = false;
public:
RingMod();