2 #include <Fx/NoiseFilter.hpp>
3 #include <Fx/Types.hpp>
5 #include <ossia/dataflow/value_port.hpp>
7 #include <halp/controls.hpp>
8 #include <halp/meta.hpp>
9 namespace Nodes::Smooth::v2
13 halp_meta(name,
"Smooth")
14 halp_meta(c_name,
"ValueFilter")
15 halp_meta(category,
"Control/Mappings")
16 halp_meta(author,
"ossia score")
17 halp_meta(manual_url,
"https://ossia.io/score-docs/processes/smooth.html#smooth")
18 halp_meta(description,
"Filter noisy value stream")
19 halp_meta(uuid,
"bf603921-5a48-4aa5-9bc1-48a762be6467")
24 halp::val_port<
"in", std::optional<ossia::value>> port{};
25 halp::enum_t<dno::type,
"Type"> type;
26 halp::knob_f32<
"Amount", halp::range{0., 1., 0.1}> amount;
27 halp::log_hslider_f32<
"Freq (1e/LP)", halp::range{0.001, 300., 120.}> freq;
28 halp::log_hslider_f32<
"Cutoff (1e/LP)", halp::range{0.001, 10., 1.}> cutoff;
29 halp::hslider_f32<
"Beta (1e only)", halp::range{0.001, 10., 1.}> beta;
30 halp::toggle<
"Continuous", halp::toggle_setup{}> continuous;
38 if(
auto& v = this->inputs.port.value)
40 auto filtered = this->filter(
41 *v, inputs.type, inputs.amount, inputs.freq, inputs.cutoff, inputs.beta);
42 outputs.port(std::move(filtered));
49 if(inputs.continuous && this->last.valid())
51 auto filtered = this->filter(
52 this->last, inputs.type, inputs.amount, inputs.freq, inputs.cutoff,
54 outputs.port(std::move(filtered));
61 Process::Enum& type, Process::FloatKnob& amount, Process::LogFloatSlider& freq,
62 Process::LogFloatSlider& cutoff, Process::FloatSlider& beta, Process::Toggle& cont,
70 const auto cMarg = 15;
75 c0_bg->setRect({0., 0., w, h});
77 auto type_item = makeControl(
78 tuplet::get<0>(Metadata::controls), type, parent, context, doc, portFactory);
79 type_item.root.setPos(70, 0);
80 type_item.control.rows = 4;
81 type_item.control.columns = 1;
82 type_item.control.setRect(QRectF{0, 0, 60, 105});
84 auto amount_item = makeControl(
85 tuplet::get<1>(Metadata::controls), amount, parent, context, doc, portFactory);
86 amount_item.root.setPos(tMarg, 30);
87 amount_item.control.setPos(0, cMarg);
89 auto freq_item = makeControl(
90 tuplet::get<2>(Metadata::controls), freq, parent, context, doc, portFactory);
91 freq_item.root.setPos(140, 0);
92 freq_item.control.setPos(0, cMarg);
94 auto cutoff_item = makeControl(
95 tuplet::get<3>(Metadata::controls), cutoff, parent, context, doc, portFactory);
96 cutoff_item.root.setPos(140, 40);
97 cutoff_item.control.setPos(0, cMarg);
99 auto beta_item = makeControl(
100 tuplet::get<4>(Metadata::controls), beta, parent, context, doc, portFactory);
101 beta_item.root.setPos(140, 80);
102 beta_item.control.setPos(0, cMarg);
104 auto cont_item = makeControl(
105 tuplet::get<5>(Metadata::controls), cont, parent, context, doc, portFactory);
106 cont_item.root.setPos(tMarg, 0);
Definition: NoiseFilter.hpp:128
Definition: PortFactory.hpp:74
The Process class.
Definition: score-lib-process/Process/Process.hpp:61
Definition: RectItem.hpp:96
Base classes and tools to implement processes and layers.
Definition: JSONVisitor.hpp:1324
Definition: Smooth_v2.hpp:12
Definition: ProcessContext.hpp:12
const T & interfaces() const
Access to a specific interface list.
Definition: ApplicationContext.hpp:67