BUG: Added SeriesBiquad Pybind11 constructor

This commit is contained in:
Anne de Jong 2022-10-11 10:43:31 +02:00
parent 6c614d7e6c
commit 6aa1262c73

View File

@ -54,7 +54,9 @@ void init_dsp(py::module &m) {
/// SeriesBiquad /// SeriesBiquad
py::class_<SeriesBiquad, std::shared_ptr<SeriesBiquad>> sbq(m, "SeriesBiquad", py::class_<SeriesBiquad, std::shared_ptr<SeriesBiquad>> sbq(m, "SeriesBiquad",
filter); filter);
sbq.def(py::init<const vd &>()); sbq.def(py::init([](dpyarray filter) {
return std::make_shared<SeriesBiquad>(NpyToCol<d,false>(filter));
}));
sbq.def("filter", [](SeriesBiquad &s, dpyarray input) { sbq.def("filter", [](SeriesBiquad &s, dpyarray input) {
vd res = NpyToCol<d, true>(input); vd res = NpyToCol<d, true>(input);
s.filter(res); s.filter(res);
@ -64,9 +66,8 @@ void init_dsp(py::module &m) {
/// BiquadBank /// BiquadBank
py::class_<BiquadBank, std::shared_ptr<BiquadBank>> bqb(m, "BiquadBank"); py::class_<BiquadBank, std::shared_ptr<BiquadBank>> bqb(m, "BiquadBank");
bqb.def(py::init<const dmat &, const vd *>()); bqb.def(py::init<const dmat &, const vd *>());
bqb.def("setGains", [](BiquadBank &b, dpyarray gains) { bqb.def("setGains",
b.setGains(NpyToCol(gains)); [](BiquadBank &b, dpyarray gains) { b.setGains(NpyToCol(gains)); });
});
bqb.def("filter", [](BiquadBank &b, dpyarray input) { bqb.def("filter", [](BiquadBank &b, dpyarray input) {
vd inout = NpyToCol<d, true>(input); vd inout = NpyToCol<d, true>(input);
b.filter(inout); b.filter(inout);