diff options
| author | Tim Redfern <tim@eclectronics.org> | 2013-09-02 15:18:40 +0100 |
|---|---|---|
| committer | Tim Redfern <tim@eclectronics.org> | 2013-09-02 15:18:40 +0100 |
| commit | eb6cbcd58f2f1142cab49a54283b290ecb9e0a4a (patch) | |
| tree | 646763240e61b8cfe11b30ebe4ea36d1b16ec2b6 /rotord/src/rendercontext.cpp | |
| parent | c5085b5a31c1e25bf83ae910710996863531f8b2 (diff) | |
load audio from graph
Diffstat (limited to 'rotord/src/rendercontext.cpp')
| -rw-r--r-- | rotord/src/rendercontext.cpp | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/rotord/src/rendercontext.cpp b/rotord/src/rendercontext.cpp index 3f20923..679cea1 100644 --- a/rotord/src/rendercontext.cpp +++ b/rotord/src/rendercontext.cpp @@ -21,20 +21,20 @@ void Render_context::runTask() { for (auto a: analysers) { processors.push_back(dynamic_cast<Audio_processor*>(a)); } - if (load_audio(audio_filename,processors)) { - audio_loaded=true; + if (load_audio(graph.audio_filename,processors)) { + graph.audio_loaded=true; state=IDLE; } else { //an error occurred: TODO have to clean up allocated data. autoptr? - audio_loaded=false; + graph.audio_loaded=false; state=IDLE; } } if(cmd.task==RENDER) { state=RENDERING; renders[cmd.uid]=Render_status(RENDERING); - if(graph.video_render(output_filename,audio_filename,output_framerate,progress)){ + if(graph.video_render(output_filename,output_framerate,progress)){ state=IDLE; renders[cmd.uid].status=RENDER_READY; } @@ -96,8 +96,8 @@ void Render_context::session_command(const Session_command& command,xmlIO& XML,H if (command.method=="PUT") { //get audio file location and initiate analysis if (command.body!="") { if (state==IDLE) { - audio_filename=media_dir+command.body; //for now, store session variables in memory //check file exists - Poco::File f=Poco::File(audio_filename); + graph.audio_filename=media_dir+command.body; //for now, store session variables in memory //check file exists + Poco::File f=Poco::File(graph.audio_filename); if (f.exists()) { //pass to worker thread ??if engine is ready?? ??what if engine has finished but results aren't read?? add_queue(Session_task(command.uid,ANALYSE_AUDIO)); @@ -126,7 +126,7 @@ void Render_context::session_command(const Session_command& command,xmlIO& XML,H sprintf(c,"%02f",progress); XML.addValue("progress",string(c)); } - else if (audio_loaded) { + else if (graph.audio_loaded) { //not sure about this-- should this state be retained? //can the data only be read once? //for now @@ -142,7 +142,8 @@ void Render_context::session_command(const Session_command& command,xmlIO& XML,H } if (command.method=="DELETE") { if (state==IDLE) { - audio_filename=""; + graph.audio_filename=""; + graph.audio_loaded=false; logger.information("Audio deleted"); XML.addValue("status","Audio deleted"); status=HTTPResponse::HTTP_OK; @@ -175,7 +176,7 @@ void Render_context::session_command(const Session_command& command,xmlIO& XML,H status=HTTPResponse::HTTP_OK; logger.information("Loaded graph from http PUT body"); XML.addValue("status","Loaded graph from PUT body"); - if (audio_loaded) { + if (graph.audio_loaded) { add_queue(Session_task(command.uid,ANALYSE_AUDIO)); status=HTTPResponse::HTTP_OK; logger.information("Starting audio analysis for graph: "+command.commands[0]); @@ -195,7 +196,7 @@ void Render_context::session_command(const Session_command& command,xmlIO& XML,H //or could our nodes even be subclassed from xml nodes? //the graph or the audio could load first- have to analyse the audio with vamp after the graph is loaded //for now the graph must load 1st - if (audio_loaded) { + if (graph.audio_loaded) { add_queue(Session_task(command.uid,ANALYSE_AUDIO)); status=HTTPResponse::HTTP_OK; logger.information("Starting audio analysis for graph: "+command.commands[0]); @@ -414,7 +415,7 @@ void Render_context::session_command(const Session_command& command,xmlIO& XML,H bool Render_context::load_audio(const string &filename,vector<Audio_processor*> processors){ Logger& logger = Logger::get("Rotor"); - logger.information("Starting audio analysis"); + logger.information("Analysing "+filename); libav::audioloader loader; loader.setup(filename); |
