[DEV/DEBUG] add an API to have better dot display and correct reversi display of stream in dot
This commit is contained in:
parent
2483530165
commit
afc8b186c7
@ -59,6 +59,20 @@ void audio::drain::Algo::configurationChange() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string audio::drain::Algo::getDotDesc() {
|
||||||
|
std::string out;
|
||||||
|
if (m_input.getFormat() != m_output.getFormat()) {
|
||||||
|
out += "\\nformat: " + etk::to_string(m_input.getFormat()) + "->" + etk::to_string(m_output.getFormat());
|
||||||
|
}
|
||||||
|
if (m_input.getMap() != m_output.getMap()) {
|
||||||
|
out += "\\nmap: " + etk::to_string(m_input.getMap()) + "->" + etk::to_string(m_output.getMap());
|
||||||
|
}
|
||||||
|
if (m_input.getFrequency() != m_output.getFrequency()) {
|
||||||
|
out += "\\nsamplerate: " + etk::to_string(m_input.getFrequency()) + "->" + etk::to_string(m_output.getFrequency());
|
||||||
|
}
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
|
||||||
size_t audio::drain::Algo::needInputData(size_t _output) {
|
size_t audio::drain::Algo::needInputData(size_t _output) {
|
||||||
size_t input = _output;
|
size_t input = _output;
|
||||||
/* NOT good at all ...
|
/* NOT good at all ...
|
||||||
|
@ -47,6 +47,8 @@ namespace audio {
|
|||||||
void setType(const std::string& _type) {
|
void setType(const std::string& _type) {
|
||||||
m_type = _type;
|
m_type = _type;
|
||||||
}
|
}
|
||||||
|
public:
|
||||||
|
virtual std::string getDotDesc();
|
||||||
private:
|
private:
|
||||||
bool m_temporary;
|
bool m_temporary;
|
||||||
public:
|
public:
|
||||||
|
@ -456,62 +456,115 @@ static void link(etk::FSNode& _node, const std::string& _first, const std::strin
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void audio::drain::Process::generateDot(etk::FSNode& _node, int32_t _offset, int32_t _basicID, std::string& _nameIn, std::string& _nameOut, bool _reserseGraph) {
|
void audio::drain::Process::generateDot(etk::FSNode& _node,
|
||||||
|
int32_t _offset,
|
||||||
|
int32_t _basicID,
|
||||||
|
std::string& _nameIn,
|
||||||
|
std::string& _nameOut,
|
||||||
|
bool _reserseGraph) {
|
||||||
_node << " subgraph clusterNode_" << _basicID << "_process {\n";
|
_node << " subgraph clusterNode_" << _basicID << "_process {\n";
|
||||||
_node << " label=\"Drain::Process" << (_reserseGraph?"_R":"_N") << "\";\n";
|
_node << " label=\"Drain::Process" << (_reserseGraph?"_R":"_N") << "\";\n";
|
||||||
_node << " node [shape=ellipse];\n";
|
_node << " node [shape=ellipse];\n";
|
||||||
|
|
||||||
if (_reserseGraph == false) {
|
if (_reserseGraph == false) {
|
||||||
|
// ----------------------
|
||||||
|
// -- STEP 1 --
|
||||||
|
// ----------------------
|
||||||
_nameIn = "INTERFACE_ALGO_" + etk::to_string(_basicID) + "_in";
|
_nameIn = "INTERFACE_ALGO_" + etk::to_string(_basicID) + "_in";
|
||||||
_node << " " << _nameIn << " [ label=\"format=" << etk::to_string(getInputConfig().getFormat())
|
_node << " " << _nameIn << " [ label=\"format=" << etk::to_string(getInputConfig().getFormat())
|
||||||
<< "\\n freq=" << getInputConfig().getFrequency()
|
<< "\\n freq=" << getInputConfig().getFrequency()
|
||||||
<< "\\n channelMap=" << etk::to_string(getInputConfig().getMap()) << "\\n in\" ];\n";
|
<< "\\n channelMap=" << etk::to_string(getInputConfig().getMap()) << "\\n in\" ];\n";
|
||||||
} else {
|
// ----------------------
|
||||||
_nameIn = "INTERFACE_ALGO_" + etk::to_string(_basicID) + "_out";
|
// -- STEP 2 --
|
||||||
_node << " " << _nameIn << " [ label=\"format=" << etk::to_string(getOutputConfig().getFormat())
|
// ----------------------
|
||||||
<< "\\n freq=" << getOutputConfig().getFrequency()
|
|
||||||
<< "\\n channelMap=" << etk::to_string(getOutputConfig().getMap()) << "\\n out\" ];\n";
|
|
||||||
}
|
|
||||||
std::string connectString = _nameIn;
|
std::string connectString = _nameIn;
|
||||||
_node << " node [shape=box];\n";
|
_node << " node [shape=box];\n";
|
||||||
if (_reserseGraph == false) {
|
// ----------------------
|
||||||
|
// -- STEP 3 --
|
||||||
|
// ----------------------
|
||||||
for (size_t iii=0; iii<m_listAlgo.size(); ++iii) {
|
for (size_t iii=0; iii<m_listAlgo.size(); ++iii) {
|
||||||
if (m_listAlgo[iii] == nullptr) {
|
if (m_listAlgo[iii] == nullptr) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
std::string connectStringSecond = "ALGO_" + etk::to_string(_basicID) + "__" + etk::to_string(iii);
|
std::string connectStringSecond = "ALGO_" + etk::to_string(_basicID) + "__" + etk::to_string(iii);
|
||||||
_node << " " << connectStringSecond << " [label=\"ALGO\\ntype='" << m_listAlgo[iii]->getType() << "'\\nname='" << m_listAlgo[iii]->getName() << "'\" ];\n";
|
_node << " " << connectStringSecond << " [label=\"ALGO\\ntype='" << m_listAlgo[iii]->getType() << "'";
|
||||||
|
if (m_listAlgo[iii]->getName() != "") {
|
||||||
|
_node << "\\nname='" << m_listAlgo[iii]->getName() << "'";
|
||||||
|
}
|
||||||
|
std::string tmpDesc = m_listAlgo[iii]->getDotDesc();
|
||||||
|
if (tmpDesc.size() != 0) {
|
||||||
|
_node << tmpDesc;
|
||||||
|
}
|
||||||
|
_node << "\" ];\n";
|
||||||
link(_node, connectString, "->", connectStringSecond);
|
link(_node, connectString, "->", connectStringSecond);
|
||||||
connectString = connectStringSecond;
|
connectString = connectStringSecond;
|
||||||
}
|
}
|
||||||
} else {
|
// ----------------------
|
||||||
//for (int32_t iii=m_listAlgo.size()-1; iii>=0; --iii) {
|
// -- STEP 4 --
|
||||||
for (size_t iii=0; iii<m_listAlgo.size(); ++iii) {
|
// ----------------------
|
||||||
if (m_listAlgo[iii] == nullptr) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
std::string connectStringSecond = "ALGO_" + etk::to_string(_basicID) + "__" + etk::to_string(iii);
|
|
||||||
_node << " " << connectStringSecond << " [label=\"ALGO\\ntype='" << m_listAlgo[iii]->getType() << "'\\nname='" << m_listAlgo[iii]->getName() << "'\" ];\n";
|
|
||||||
link(_node, connectStringSecond, "<-", connectString);
|
|
||||||
connectString = connectStringSecond;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
_node << " node [shape=ellipse];\n";
|
_node << " node [shape=ellipse];\n";
|
||||||
if (_reserseGraph == false) {
|
// ----------------------
|
||||||
|
// -- STEP 5 --
|
||||||
|
// ----------------------
|
||||||
_nameOut = "INTERFACE_ALGO_" + etk::to_string(_basicID) + "_out";
|
_nameOut = "INTERFACE_ALGO_" + etk::to_string(_basicID) + "_out";
|
||||||
_node << " " << _nameOut << " [ label=\"format=" << etk::to_string(getOutputConfig().getFormat())
|
_node << " " << _nameOut << " [ label=\"format=" << etk::to_string(getOutputConfig().getFormat())
|
||||||
<< "\\n freq=" << getOutputConfig().getFrequency()
|
<< "\\n freq=" << getOutputConfig().getFrequency()
|
||||||
<< "\\n channelMap=" << etk::to_string(getOutputConfig().getMap()) << "\\n out\" ];\n";
|
<< "\\n channelMap=" << etk::to_string(getOutputConfig().getMap()) << "\\n out\" ];\n";
|
||||||
|
// ----------------------
|
||||||
|
// -- STEP 6 --
|
||||||
|
// ----------------------
|
||||||
|
link(_node, connectString, "->", _nameOut);
|
||||||
} else {
|
} else {
|
||||||
|
// ----------------------
|
||||||
|
// -- STEP 1 --
|
||||||
|
// ----------------------
|
||||||
|
_nameIn = "INTERFACE_ALGO_" + etk::to_string(_basicID) + "_out";
|
||||||
|
_node << " " << _nameIn << " [ label=\"format=" << etk::to_string(getOutputConfig().getFormat())
|
||||||
|
<< "\\n freq=" << getOutputConfig().getFrequency()
|
||||||
|
<< "\\n channelMap=" << etk::to_string(getOutputConfig().getMap()) << "\\n out\" ];\n";
|
||||||
|
// ----------------------
|
||||||
|
// -- STEP 2 --
|
||||||
|
// ----------------------
|
||||||
|
std::string connectString = _nameIn;
|
||||||
|
_node << " node [shape=box];\n";
|
||||||
|
// ----------------------
|
||||||
|
// -- STEP 3 --
|
||||||
|
// ----------------------
|
||||||
|
for (int32_t iii=m_listAlgo.size()-1; iii>=0; --iii) {
|
||||||
|
//for (size_t iii=0; iii<m_listAlgo.size(); ++iii) {
|
||||||
|
if (m_listAlgo[iii] == nullptr) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
std::string connectStringSecond = "ALGO_" + etk::to_string(_basicID) + "__" + etk::to_string(iii);
|
||||||
|
_node << " " << connectStringSecond << " [label=\"ALGO\\ntype='" << m_listAlgo[iii]->getType() << "'";
|
||||||
|
if (m_listAlgo[iii]->getName() != "") {
|
||||||
|
_node << "\\nname='" << m_listAlgo[iii]->getName() << "'";
|
||||||
|
}
|
||||||
|
std::string tmpDesc = m_listAlgo[iii]->getDotDesc();
|
||||||
|
if (tmpDesc.size() != 0) {
|
||||||
|
_node << tmpDesc;
|
||||||
|
}
|
||||||
|
_node << "\" ];\n";
|
||||||
|
//link(_node, connectStringSecond, "<-", connectString);
|
||||||
|
link(_node, connectString, "<-", connectStringSecond);
|
||||||
|
//link(_node, connectStringSecond, "->", connectString);
|
||||||
|
connectString = connectStringSecond;
|
||||||
|
}
|
||||||
|
// ----------------------
|
||||||
|
// -- STEP 4 --
|
||||||
|
// ----------------------
|
||||||
|
_node << " node [shape=ellipse];\n";
|
||||||
|
// ----------------------
|
||||||
|
// -- STEP 5 --
|
||||||
|
// ----------------------
|
||||||
_nameOut = "INTERFACE_ALGO_" + etk::to_string(_basicID) + "_in";
|
_nameOut = "INTERFACE_ALGO_" + etk::to_string(_basicID) + "_in";
|
||||||
_node << " " << _nameOut << " [ label=\"format=" << etk::to_string(getInputConfig().getFormat())
|
_node << " " << _nameOut << " [ label=\"format=" << etk::to_string(getInputConfig().getFormat())
|
||||||
<< "\\n freq=" << getInputConfig().getFrequency()
|
<< "\\n freq=" << getInputConfig().getFrequency()
|
||||||
<< "\\n channelMap=" << etk::to_string(getInputConfig().getMap()) << "\\n in\" ];\n";
|
<< "\\n channelMap=" << etk::to_string(getInputConfig().getMap()) << "\\n in\" ];\n";
|
||||||
}
|
// ----------------------
|
||||||
if (_reserseGraph == false) {
|
// -- STEP 6 --
|
||||||
link(_node, connectString, "->", _nameOut);
|
// ----------------------
|
||||||
} else {
|
link(_node, connectString, "<-", _nameOut);
|
||||||
link(_node, _nameOut, "<-", connectString);
|
|
||||||
}
|
}
|
||||||
_node << " }\n";
|
_node << " }\n";
|
||||||
}
|
}
|
||||||
@ -540,7 +593,15 @@ void audio::drain::Process::generateDotProcess(etk::FSNode& _node, int32_t _offs
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
std::string connectStringSecond = "ALGO_" + etk::to_string(_basicID) + "__" + etk::to_string(iii);
|
std::string connectStringSecond = "ALGO_" + etk::to_string(_basicID) + "__" + etk::to_string(iii);
|
||||||
_node << " " << connectStringSecond << " [label=\"ALGO\\ntype='" << m_listAlgo[iii]->getType() << "'\\nname='" << m_listAlgo[iii]->getName() << "'\" ];\n";
|
_node << " " << connectStringSecond << " [label=\"ALGO\\ntype='" << m_listAlgo[iii]->getType() << "'";
|
||||||
|
if (m_listAlgo[iii]->getName() != "") {
|
||||||
|
_node << "\\nname='" << m_listAlgo[iii]->getName() << "'";
|
||||||
|
}
|
||||||
|
std::string tmpDesc = m_listAlgo[iii]->getDotDesc();
|
||||||
|
if (tmpDesc.size() != 0) {
|
||||||
|
_node << tmpDesc;
|
||||||
|
}
|
||||||
|
_node << "\" ];\n";
|
||||||
link(_node, connectString, "->", connectStringSecond);
|
link(_node, connectString, "->", connectStringSecond);
|
||||||
connectString = connectStringSecond;
|
connectString = connectStringSecond;
|
||||||
}
|
}
|
||||||
@ -551,7 +612,15 @@ void audio::drain::Process::generateDotProcess(etk::FSNode& _node, int32_t _offs
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
std::string connectStringSecond = "ALGO_" + etk::to_string(_basicID) + "__" + etk::to_string(iii);
|
std::string connectStringSecond = "ALGO_" + etk::to_string(_basicID) + "__" + etk::to_string(iii);
|
||||||
_node << " " << connectStringSecond << " [label=\"ALGO\\ntype='" << m_listAlgo[iii]->getType() << "'\\nname='" << m_listAlgo[iii]->getName() << "'\" ];\n";
|
_node << " " << connectStringSecond << " [label=\"ALGO\\ntype='" << m_listAlgo[iii]->getType() << "'";
|
||||||
|
if (m_listAlgo[iii]->getName() != "") {
|
||||||
|
_node << "\\nname='" << m_listAlgo[iii]->getName() << "'";
|
||||||
|
}
|
||||||
|
std::string tmpDesc = m_listAlgo[iii]->getDotDesc();
|
||||||
|
if (tmpDesc.size() != 0) {
|
||||||
|
_node << tmpDesc;
|
||||||
|
}
|
||||||
|
_node << "\" ];\n";
|
||||||
link(_node, connectStringSecond, "<-", connectString);
|
link(_node, connectStringSecond, "<-", connectString);
|
||||||
connectString = connectStringSecond;
|
connectString = connectStringSecond;
|
||||||
}
|
}
|
||||||
|
@ -378,11 +378,11 @@ void audio::drain::Volume::addVolumeStage(const ememory::SharedPtr<audio::drain:
|
|||||||
bool audio::drain::Volume::setParameter(const std::string& _parameter, const std::string& _value) {
|
bool audio::drain::Volume::setParameter(const std::string& _parameter, const std::string& _value) {
|
||||||
if (_parameter == "FLOW") {
|
if (_parameter == "FLOW") {
|
||||||
// set Volume ...
|
// set Volume ...
|
||||||
for (size_t iii=0; iii<m_volumeList.size(); ++iii) {
|
for (auto &it : m_volumeList) {
|
||||||
if (m_volumeList[iii] == nullptr) {
|
if (it == nullptr) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (m_volumeList[iii]->getName() == "FLOW") {
|
if (it->getName() == "FLOW") {
|
||||||
float value = 0;
|
float value = 0;
|
||||||
if (sscanf(_value.c_str(), "%fdB", &value) != 1) {
|
if (sscanf(_value.c_str(), "%fdB", &value) != 1) {
|
||||||
return false;
|
return false;
|
||||||
@ -392,7 +392,7 @@ bool audio::drain::Volume::setParameter(const std::string& _parameter, const std
|
|||||||
DRAIN_ERROR("Can not set volume ... : '" << _parameter << "' out of range : [-300..300]");
|
DRAIN_ERROR("Can not set volume ... : '" << _parameter << "' out of range : [-300..300]");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
m_volumeList[iii]->setVolume(value);
|
it->setVolume(value);
|
||||||
DRAIN_DEBUG("Set volume : FLOW = " << value << " dB (from:" << _value << ")");
|
DRAIN_DEBUG("Set volume : FLOW = " << value << " dB (from:" << _value << ")");
|
||||||
volumeChange();
|
volumeChange();
|
||||||
return true;
|
return true;
|
||||||
@ -406,12 +406,12 @@ bool audio::drain::Volume::setParameter(const std::string& _parameter, const std
|
|||||||
std::string audio::drain::Volume::getParameter(const std::string& _parameter) const {
|
std::string audio::drain::Volume::getParameter(const std::string& _parameter) const {
|
||||||
if (_parameter == "FLOW") {
|
if (_parameter == "FLOW") {
|
||||||
// set Volume ...
|
// set Volume ...
|
||||||
for (size_t iii=0; iii<m_volumeList.size(); ++iii) {
|
for (auto &it : m_volumeList) {
|
||||||
if (m_volumeList[iii] == nullptr) {
|
if (it == nullptr) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (m_volumeList[iii]->getName() == "FLOW") {
|
if (it->getName() == "FLOW") {
|
||||||
return etk::to_string(m_volumeList[iii]->getVolume()) + "dB";
|
return etk::to_string(it->getVolume()) + "dB";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -422,11 +422,11 @@ std::string audio::drain::Volume::getParameter(const std::string& _parameter) co
|
|||||||
std::string audio::drain::Volume::getParameterProperty(const std::string& _parameter) const {
|
std::string audio::drain::Volume::getParameterProperty(const std::string& _parameter) const {
|
||||||
if (_parameter == "FLOW") {
|
if (_parameter == "FLOW") {
|
||||||
// set Volume ...
|
// set Volume ...
|
||||||
for (size_t iii=0; iii<m_volumeList.size(); ++iii) {
|
for (auto &it : m_volumeList) {
|
||||||
if (m_volumeList[iii] == nullptr) {
|
if (it == nullptr) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (m_volumeList[iii]->getName() == "FLOW") {
|
if (it->getName() == "FLOW") {
|
||||||
return "[-300..300]dB";
|
return "[-300..300]dB";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -435,3 +435,16 @@ std::string audio::drain::Volume::getParameterProperty(const std::string& _param
|
|||||||
return "[ERROR]";
|
return "[ERROR]";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string audio::drain::Volume::getDotDesc() {
|
||||||
|
std::string out = audio::drain::Algo::getDotDesc();
|
||||||
|
for (auto &it : m_volumeList) {
|
||||||
|
if (it == nullptr) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
out += "\\n" + it->getName() + "=" + etk::to_string(it->getVolume()) + "dB";
|
||||||
|
if (it->getMute() == true) {
|
||||||
|
out += " MUTE";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
@ -92,6 +92,8 @@ namespace audio {
|
|||||||
virtual std::string getParameterProperty(const std::string& _parameter) const;
|
virtual std::string getParameterProperty(const std::string& _parameter) const;
|
||||||
public:
|
public:
|
||||||
void volumeChange();
|
void volumeChange();
|
||||||
|
public:
|
||||||
|
virtual std::string getDotDesc();
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user