summaryrefslogtreecommitdiff
path: root/rotord/src/rendercontext.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'rotord/src/rendercontext.cpp')
-rw-r--r--rotord/src/rendercontext.cpp23
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);