1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
|
#ifndef RENDERCONTEXT_H
#define RENDERCONTEXT_H
#include "Poco/Task.h"
#include "Poco/File.h"
#include "Poco/StringTokenizer.h"
#include "rotor.h"
namespace Rotor {
class Render_context: public Poco::Task { //Poco task object
//manages a 'patchbay'
//high level interfaces for the wizard
//and low level interface onto the graph
public:
Render_context(const std::string& name): Task(name) {
audio_thumb=new Audio_thumbnailer();
state=IDLE;
output_framerate=25.0f;
audio_loaded=false;
xmlIO xml;
if(xml.loadFile("settings.xml") ){
graph_dir=xml.getAttribute("Rotor","graph_dir","",0);
media_dir=xml.getAttribute("Rotor","media_dir","",0);
output_dir=xml.getAttribute("Rotor","output_dir","",0);
}
else cerr<<"Rotor: settings.xml not found, using defaults"<<endl;
};
~Render_context(){delete audio_thumb;};
void runTask();
void add_queue(int item);
Command_response session_command(const std::vector<std::string>& command);
void session_command(const std::vector<std::string>& command,xmlIO& XML,Poco::Net::HTTPResponse::HTTPStatus& status);
void cancel(); //interrupt locking process
int make_preview(int nodeID, float time); //starts a frame preview - returns status code - how to retrieve?
bool load_audio(const string &filename,vector<Audio_processor*> processors);
bool load_video(const string &nodeID,const string &filename);//can be performance or clip
private:
int state;
float progress; //for a locking process: audio analysis or rendering
//thread only does one thing at once
std::deque<int> work_queue;
Poco::Mutex mutex; //lock for access from parent thread
std::string audio_filename;
std::string output_filename;
std::string graph_dir;
std::string media_dir;
std::string output_dir;
Audio_thumbnailer *audio_thumb;
Graph graph;
Node_factory factory;
float output_framerate;
bool audio_loaded;
};
}
#endif
|