knobGadget.setSize, autopan phase
parent
d75b7878f8
commit
a6032be6a9
|
@ -59,7 +59,7 @@ void AutoPan::process() {
|
|||
auto tl = static_cast<double>(ts) / static_cast<double>(sr); // tick length
|
||||
for (size_t f = 0; f < ts; f++) {
|
||||
AudioFrame fCurrent = (*in)[f];
|
||||
auto cc = cyc + (static_cast<double>(f) / static_cast<double>(sr)) * eRate;
|
||||
auto cc = cyc+phase + (static_cast<double>(f) / static_cast<double>(sr)) * eRate;
|
||||
|
||||
(*out)[f] = fCurrent.gainBalance(0.0, level * std::sin(cc * 2*PI));
|
||||
}
|
||||
|
@ -70,21 +70,25 @@ void AutoPan::process() {
|
|||
void AutoPan::saveData(QCborMap& m) const {
|
||||
m[qs("level")] = level;
|
||||
m[qs("rate")] = rate;
|
||||
m[qs("phase")] = phase;
|
||||
m[qs("bpmRelative")] = bpmRelative;
|
||||
}
|
||||
|
||||
void AutoPan::loadData(const QCborMap& m) {
|
||||
level = m.value("level").toDouble(level);
|
||||
rate = m.value("rate").toDouble(rate);
|
||||
phase = m.value("phase").toDouble(phase);
|
||||
bpmRelative = m.value("bpmRelative").toBool(bpmRelative);
|
||||
}
|
||||
|
||||
void AutoPan::onGadgetCreated() {
|
||||
if (!obj) return;
|
||||
auto l = new LayoutGadget(obj);
|
||||
l->setMetrics(-1, 2);
|
||||
|
||||
(new KnobGadget(l))->bind(rate)->setLabel(qs("Rate"))->setRange(0.0, 8.0, 0.01, -1, 0.001)->setDefault(1.0);
|
||||
auto l2 = (new LayoutGadget(l, true))->setMetrics(0, 4);
|
||||
auto l2 = (new LayoutGadget(l, true))->setMetrics(0, 2);
|
||||
(new ToggleGadget(l2))->bind(bpmRelative)->setColor({191, 127, 255})->setToolTip(qs("BPM-relative"));
|
||||
KnobGadget::autoPercent(l2, phase)->setLabel(qs("Phase"))->setSize(22);
|
||||
KnobGadget::autoBalance(l, level)->setLabel(qs("Level"));
|
||||
}
|
||||
|
|
|
@ -6,6 +6,7 @@ namespace Xybrid::Effects {
|
|||
class AutoPan : public Data::Node {
|
||||
double level;
|
||||
double rate = 1.0;
|
||||
double phase = 0.0;
|
||||
bool bpmRelative = false;
|
||||
|
||||
double cyc; // current cycle tracking
|
||||
|
|
|
@ -61,6 +61,7 @@ namespace Xybrid::UI {
|
|||
|
||||
inline KnobGadget* setLabel(const QString& s) { label->setText(s); dirty = true; update(); return this; }
|
||||
inline KnobGadget* setTextFunc(const std::function<QString(double)>& f) { fText = f; dirty = true; update(); return this; }
|
||||
inline KnobGadget* setSize(decltype(size) s) { this->size = s; return this; }
|
||||
inline KnobGadget* setRange(double min, double max, double step = -1, int px = -1, double sub = -1) {
|
||||
this->min = min;
|
||||
this->max = max;
|
||||
|
|
Loading…
Reference in New Issue