summaryrefslogtreecommitdiff
path: root/rotord/src/graph.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'rotord/src/graph.cpp')
-rw-r--r--rotord/src/graph.cpp15
1 files changed, 11 insertions, 4 deletions
diff --git a/rotord/src/graph.cpp b/rotord/src/graph.cpp
index 313df2a..03d0a4b 100644
--- a/rotord/src/graph.cpp
+++ b/rotord/src/graph.cpp
@@ -277,10 +277,10 @@ bool Graph::parseJson(string &data,string &media_path){
return false;
}
//we know the json validates so clear the existing graph
- nodes.clear();
+ clear();
check_audio(root["audio"].asString(),media_path);
init(root["ID"].asString(),root["description"].asString());
- Json::Value jnodes = root["nodes"];
+ Json::Value jnodes = root["nodeDefinitions"];
for ( int i = 0; i < jnodes.size(); ++i ) {
//cerr<<"json found node: "<<jnodes[i]["type"].asString()<<endl;
map<string,string> settings;
@@ -348,7 +348,10 @@ bool Graph::parseJson(string &data,string &media_path){
if (nodes[nodeID]->parameters.find(parameter)!=nodes[nodeID]->parameters.end()) {
float val=jnodes[i]["parameters"][l]["value"].asFloat();
- nodes[nodeID]->parameters.find(parameter)->second->value=val;
+ if (val!=nodes[nodeID]->parameters.find(parameter)->second->value){
+ nodes[nodeID]->parameters.find(parameter)->second->value=val;
+ cerr << "Rotor: set parameter '"<<parameter<<"' of "<<nodeID<<" to "<<val<<endl;
+ }
string fromID=jnodes[i]["parameters"][l]["from"].asString();
if (nodes.find(fromID)!=nodes.end()) {
if (!nodes[nodeID]->parameters[parameter]->connect(nodes[fromID])){
@@ -367,6 +370,10 @@ bool Graph::parseJson(string &data,string &media_path){
string attribute=jnodes[i]["attributes"][m]["name"].asString();
if (nodes[nodeID]->attributes.find(attribute)!=nodes[nodeID]->attributes.end()) {
string val=jnodes[i]["attributes"][m]["value"].asString();
+ if (val!=nodes[nodeID]->attributes.find(attribute)->second->value){
+ nodes[nodeID]->attributes.find(attribute)->second->value=val;
+ cerr << "Rotor: set attribute '"<<attribute<<"' of "<<nodeID<<" to "<<val<<endl;
+ }
nodes[nodeID]->attributes.find(attribute)->second->value=val;
}
else cerr << "Rotor: cannot find attribute '" << attribute << "' of "<<settings["type"]<<" "<< nodeID << endl;
@@ -385,7 +392,7 @@ bool Graph::parseJson(string &data,string &media_path){
return true;
}
bool Graph::parseXml(string media_path){
- nodes.clear();
+ clear();
check_audio(xml.getAttribute("patchbay","audio","",0),media_path);
init(xml.getAttribute("patchbay","ID","",0),xml.getValue("patchbay","",0));
if(xml.pushTag("patchbay")) {