summaryrefslogtreecommitdiff
path: root/rotord/rotor.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'rotord/rotor.cpp')
-rwxr-xr-x[-rw-r--r--]rotord/rotor.cpp57
1 files changed, 32 insertions, 25 deletions
diff --git a/rotord/rotor.cpp b/rotord/rotor.cpp
index f9c39b3..5736c2f 100644..100755
--- a/rotord/rotor.cpp
+++ b/rotord/rotor.cpp
@@ -19,27 +19,31 @@ void Render_context::runTask() {
work_queue.pop_front();
}
mutex.unlock();
- switch(cmd) {
- case ANALYSE_AUDIO:
- state=ANALYSING_AUDIO;
- vector<Base_audio_processor*> processors;
- processors.push_back(audio_thumb);
- vector<Node*> analysers=graph.find_nodes("audio_analysis");
- for (auto a: analysers) {
- processors.push_back(a);
- }
- if (load_audio(audio_filename,processors)) {
- state=AUDIO_READY;
- }
- else {
- //an error occurred: TODO have to clean up allocated data. autoptr?
- state=IDLE;
- }
- break;
- case RENDER:
- state=RENDERING;
- ///
- break;
+ if(cmd==ANALYSE_AUDIO) {
+ state=ANALYSING_AUDIO;
+ vector<Base_audio_processor*> processors;
+ processors.push_back(audio_thumb);
+ vector<Node*> analysers=graph.find_nodes("audio_analysis");
+ for (auto a: analysers) {
+ processors.push_back(a);
+ }
+ if (load_audio(audio_filename,processors)) {
+ state=AUDIO_READY;
+ }
+ else {
+ //an error occurred: TODO have to clean up allocated data. autoptr?
+ state=IDLE;
+ }
+ }
+ if(cmd==RENDER) {
+ state=RENDERING;
+ if(graph.video_render(output_filename,audio_filename,output_framerate)){
+ state=RENDER_READY;
+ }
+ else {
+ //an error occurred: TODO have to clean up allocated data. autoptr?
+ state=IDLE;
+ }
}
sleep(100);
}
@@ -186,7 +190,7 @@ Command_response Render_context::session_command(const std::vector<std::string>&
framerate=ofToFloat(command[3]);
}
string signal_xml;
- if (graph.signal_render(framerate,signal_xml)){
+ if (graph.signal_render(signal_xml,framerate)){
response.status=HTTPResponse::HTTP_OK;
response.description=signal_xml;
}
@@ -250,7 +254,10 @@ Command_response Render_context::session_command(const std::vector<std::string>&
if (command[0]=="PUT") {
if (command.size()>2) {
if (state==IDLE) {
- output_filename=command[3]; //for now, store session variables in memory
+ output_filename=command[3];
+ if (command.size()>3) {
+ output_framerate=ofToFloat(command[4]);
+ }
add_queue(RENDER);
response.status=HTTPResponse::HTTP_OK;
response.description="<status context='"+command[1]+"'>Starting render: "+command[3]+"</status>\n";
@@ -497,7 +504,7 @@ Node_factory::Node_factory(){
//for now, statically load prototype map in constructor
add_type("audio_analysis",new Audio_analysis());
add_type("divide",new Signal_divide());
- add_type("==",new Is_new_integer());
+ add_type("bang",new Is_new_integer());
add_type("signal_output",new Signal_output());
add_type("video_output",new Video_output());
}
@@ -597,6 +604,6 @@ void Audio_analysis::print_features(){
cerr<<i.second<<" "<<i.first<<endl;
}
}
-bool Video_output::render(const float duration, const float framerate,string &filename){
+bool Video_output::render(const float duration, const float framerate,const string &output_filename,const string &audio_filename){
//render out the network
} \ No newline at end of file