satdump/src-core/dsp/flowgraph/node_int.cpp
2026-01-29 23:10:31 +01:00

48 lines
1.4 KiB
C++

#include "node_int.h"
#include "common/widgets/CircularProgressBar.h"
#include "core/style.h"
#include "flowgraph.h"
#include "imgui/imgui.h"
namespace satdump
{
namespace ndsp
{
NodeInternal::NodeInternal(const Flowgraph *f, std::shared_ptr<ndsp::Block> b) : f((Flowgraph *)f), blk(b) { optdisp = std::make_unique<ndsp::OptDisplayerWarper>(blk); }
bool NodeInternal::render()
{
ImGui::PushItemWidth(200);
bool r = optdisp->draw();
ImGui::PopItemWidth();
if (f->debug_mode)
{
if (blk->get_inputs().size())
{
ImGui::Text("Buffers :");
for (auto &i : blk->get_inputs())
{
if (!i.fifo)
continue;
float f = (float)i.fifo->size_approx() / (float)i.fifo->max_capacity();
CircularProgressBar(i.name.c_str(), f, {20, 20}, style::theme.green);
ImGui::SameLine();
ImGui::Text("%s", i.name.c_str());
}
}
}
return r;
}
nlohmann::json NodeInternal::getP() { return blk->get_cfg(); }
void NodeInternal::setP(nlohmann::json p)
{
blk->set_cfg(p);
optdisp->update();
}
} // namespace ndsp
} // namespace satdump