Skip to content

Commit

Permalink
Minor process fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Your Name committed Apr 28, 2024
1 parent df3a84f commit d4cc209
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
15 changes: 9 additions & 6 deletions examples/Helpers/Poles.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#include <halp/log.hpp>
#include <halp/mappers.hpp>
#include <halp/meta.hpp>
#include <boost/container/vector.hpp>

namespace examples::helpers
{
Expand Down Expand Up @@ -45,11 +46,13 @@ struct Poles
}
}
} sigma;

halp::knob_f32<"Range", halp::range{0., 1., 1.0}> mult;
} inputs;

struct
{
halp::val_port<"Out", std::vector<float>> a;
halp::val_port<"Out", boost::container::vector<float>> a;
} outputs;

static double pdf(double x, double inv_sigma) noexcept
Expand All @@ -62,15 +65,15 @@ struct Poles
{
if(inputs.length.value < 0 || inputs.length.value > 1000)
return;

const float mult = inputs.mult.value;
auto& res = outputs.a.value;
res.resize(inputs.length + 1, boost::container::default_init);

std::vector<float>& res = outputs.a.value;
res.resize(inputs.length + 1);

std::string s;
for(int k = 0; k <= inputs.length; k++)
{
const double i = 2. * k / inputs.length - 1.;
res[k] = pdf(i / 10. - inputs.pos, inv_sigma);
res[k] = mult * pdf(i / 10. - inputs.pos, inv_sigma);
}
}
double inv_sigma{1.};
Expand Down
4 changes: 3 additions & 1 deletion examples/Raw/ProcessLauncher.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,9 @@ struct ProcessLauncher
// Stop case
if(cur)
{
cur->terminate();
QMetaObject::invokeMethod(qApp, [cur] {
cur->terminate();
});
}
return [](ProcessLauncher& self) { self.process.reset(); };
}
Expand Down

0 comments on commit d4cc209

Please sign in to comment.