From 3ca766e0a5a9472000d463ce9edbb6c5abcc8565 Mon Sep 17 00:00:00 2001 From: Comment Date: Thu, 22 Aug 2013 09:51:50 +0100 Subject: working on json loader --- rotord/bin/examplegraph.json | 102 +++++++++++++++++++++++++++++++++++++++++++ rotord/src/graph.cpp | 29 +++++++++--- rotord/src/rotor.h | 2 + 3 files changed, 128 insertions(+), 5 deletions(-) create mode 100644 rotord/bin/examplegraph.json (limited to 'rotord') 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<