summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--rotord/bin/examplegraph.json102
-rw-r--r--rotord/src/graph.cpp29
-rwxr-xr-xrotord/src/rotor.h2
3 files changed, 128 insertions, 5 deletions
diff --git a/rotord/bin/examplegraph.json b/rotord/bin/examplegraph.json
new file mode 100644
index 0000000..596fcdc
--- /dev/null
+++ b/rotord/bin/examplegraph.json
@@ -0,0 +1,102 @@
+ {
+ title: "Lights Down @Rotor",
+ audio: "filename",
+ id:,
+ type: 'patchBay',
+ nodeDefinitions: [
+ {
+ title: 'Video Loader',
+ type: 'video_loader',
+ inputs: 'fixed',
+ output: 'image',
+ description: 'loads a video file',
+ attributes: [
+ {
+ type: 'string',
+ title: 'Filename'
+ },
+ {
+ title: 'Mode',
+ name: 'mode',
+ type: 'enum',
+ value: 'still',
+ options: ['still', 'blend'],
+ description: 'video playback speed'
+ }
+ ],
+ parameters: [
+ {
+ title: 'Frame Rate',
+ name: 'framerate',
+ type: 'number',
+ value: '0',
+ min: '0',
+ max: '10',
+ description: 'frame rate override'
+ },
+ {
+ title: 'Speed',
+ name: 'speed',
+ type: 'number',
+ value: '1',
+ min: '0',
+ max: '10',
+ description: 'video playback speed'
+ }
+ ],
+ metadata: {
+ imageUrl: 'images/loader.svg',
+ },
+ },
+
+ {
+ title: 'Video Cycler',
+ type: 'video_cycler',
+ description: 'Cycles through video inputs according to selector signal',
+ inputs: 'duplicatable',
+ image_input: [
+ {
+ description: 'Input 1'
+ }
+ ],
+ signal_input: [
+ {
+ description: 'selector'
+ }
+ ],
+ metadata: {
+ imageUrl: 'images/cycler.svg'
+ }
+ },
+ {
+ title: 'Audio Analysis',
+ type: 'audio_analysis',
+ inputs: 'fixed',
+ description: 'analyse audio and output',
+ output: 'signal',
+ attributes: [
+ {
+ title: 'Analyser Plugin',
+ name: 'analyser',
+ type: 'enum',
+ value: 'barbeattracker',
+ options: ['barbeattracker', 'segmenter'],
+ }
+ ],
+ parameters: [
+ {
+ title: 'Output Number',
+ name: 'outputNo',
+ type: 'number',
+ value: '0',
+ min: '0',
+ max: '10',
+ description: 'plugin output to use'
+ }
+ ],
+ metadata: {
+ imageUrl: 'images/audio.svg'
+ }
+ },
+ ]
+ } \ No newline at end of file
diff --git a/rotord/src/graph.cpp b/rotord/src/graph.cpp
index 026325f..b799a59 100644
--- a/rotord/src/graph.cpp
+++ b/rotord/src/graph.cpp
@@ -66,12 +66,31 @@ bool Graph::load(string data,string media_path){
return false;
}
bool Graph::loadFile(string &filename,string media_path){
- if (loaded)
- printf("loading graph: %s\n",filename.c_str());
- if(xml.loadFile(filename) ){
- return parseXml(media_path);
+ //if (loaded)
+ printf("loading graph: %s\n",(filename).c_str());
+
+ //if(xml.loadFile(filename) ){
+ // return parseXml(media_path);
+ //}
+ Poco::FileInputStream fis(filename);
+ std::string read;
+ cerr<<fis;
+ cerr<<read.size()<<" json chars found"<<endl;
+ return false;
+}
+bool Graph::parseJson(string &data,string &media_path){
+ Json::Value root; // will contains the root value after parsing.
+ Json::Reader reader;
+ bool parsingSuccessful = reader.parse( data, root );
+ if ( !parsingSuccessful )
+ {
+ // report to the user the failure and their locations in the document.
+ std::cout << "Failed to parse configuration\n"
+ << reader.getFormattedErrorMessages();
+ return false;
}
- else return false;
+ cerr<<root["audio"]<<endl;
+ return true;
}
bool Graph::parseXml(string media_path){
if (loaded) nodes.clear();
diff --git a/rotord/src/rotor.h b/rotord/src/rotor.h
index 9427d83..cd4edb0 100755
--- a/rotord/src/rotor.h
+++ b/rotord/src/rotor.h
@@ -16,6 +16,7 @@
#include "Poco/Logger.h"
#include "Poco/Path.h"
#include "Poco/Base64Encoder.h"
+#include "Poco/FileStream.h"
#include "xmlIO.h"
#include "utils.h"
@@ -1050,6 +1051,7 @@ namespace Rotor {
bool load(string data,string media_path);
bool loadFile(string &filename,string media_path);
bool parseXml(string media_path);
+ bool parseJson(string &data,string &media_path);
bool set_resolution(int w,int h);
bool loaded;
float duration;