MCPcopy Create free account
hub / github.com/LabSound/LabSound / _printGraph

Method _printGraph

src/core/AudioNode.cpp:29–74  ·  view source on GitHub ↗

static

Source from the content-addressed store, hash-verified

27
28// static
29void AudioNode::_printGraph(const AudioNode * root, std::function<void(const char *)> prnln, int indent)
30{
31 const int maxIndent = 40;
32 static char * spacesBuff = nullptr;
33 if (!spacesBuff) {
34 spacesBuff = (char *) malloc(maxIndent + 1);
35 memset(spacesBuff, ' ', maxIndent);
36 spacesBuff[maxIndent] = '\0';
37 }
38 int spaceTerminator = indent < maxIndent ? indent : maxIndent;
39 spacesBuff[spaceTerminator] = '\0';
40 std::string spaces = spacesBuff;
41 spacesBuff[spaceTerminator] = ' ';
42
43 std::string str = spaces;
44 str += std::string(root->name());
45 prnln(str.c_str());
46
47 const auto params = root->params();
48 auto names = root->paramNames();
49 for (int i = 0; i < params.size(); ++i)
50 {
51/* int input_count = params[i]->inputs();
52 if (inputs.sources.size() > 0) {
53 str = spaces + " [Param] " + names[i];
54 prnln(str.c_str());
55 for (const auto & n : inputs.sources)
56 _printGraph(n->get(), prnln, indent + 3);
57 }*/
58 }
59
60 if (root->m_inputs.size() > 0)
61 {
62 prnln(str.c_str());
63 for (auto & i : root->m_inputs)
64 {
65 if (!i)
66 continue;
67
68 str = spaces + " [Input] ";
69 prnln(str.c_str());
70// for (auto & n : i->sources)
71// _printGraph(n->get(), prnln, indent + 3);
72 }
73 }
74}
75
76
77// static

Callers

nothing calls this directly

Calls 4

paramsMethod · 0.80
paramNamesMethod · 0.80
sizeMethod · 0.80
nameMethod · 0.45

Tested by

no test coverage detected