diff options
| author | Tim Redfern <tim@eclectronics.org> | 2014-01-27 12:24:41 +0000 |
|---|---|---|
| committer | Tim Redfern <tim@eclectronics.org> | 2014-01-27 12:24:41 +0000 |
| commit | 487fcf990f3c536d7e1d2f66daa0c34c0407eac5 (patch) | |
| tree | 4f0dd5aa9d74af5e3e7628fbe20e1f0af60f512a /NT/src/rendercontext.h | |
| parent | 1f2bc21fd5ee9bff4fce190d7bb0ee4462e76e87 (diff) | |
NT resinstated as HTTP server
Diffstat (limited to 'NT/src/rendercontext.h')
| -rw-r--r-- | NT/src/rendercontext.h | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/NT/src/rendercontext.h b/NT/src/rendercontext.h index 6501c66..097af3f 100644 --- a/NT/src/rendercontext.h +++ b/NT/src/rendercontext.h @@ -15,7 +15,41 @@ TJR Jan 2014 #include "rotor.h" #include "graph.h" +// +// When rendering, where do duration etc come from? +// +// It should come from: +// a) a specified duration +// b) the duration of the song being worked on +// c) a default duration +// +// graph.get_duration() + namespace Rotor { + #define IDLE 0 + #define ANALYSING_AUDIO 1 + #define AUDIO_READY 2 + #define CREATING_PREVIEW 3 + #define PREVIEW_READY 4 + #define RENDERING 5 + #define RENDER_READY 6 + #define FAILED 7 + #define NOT_FOUND 8 + #define CANCELLED 9 + #define LOADING_GRAPH 10 + + #define ANALYSE_AUDIO 1 + #define PREVIEW 2 + #define RENDER 3 + #define LOAD_GRAPH 4 + + class Render_status { + public: + Render_status():status(0),progress(0.0){}; + Render_status(int _status):status(_status),progress(0.0){}; + int status; + double progress; + }; class Render_context: public Poco::Task { public: Render_context(const std::string& _id): Task(_id) { @@ -42,10 +76,20 @@ namespace Rotor { sleep(100); } } + Render_status get_render_status(const string &uid){ + if (renders.find(uid)!=renders.end()){ + if (renders[uid].status==RENDERING){ + renders[uid].progress=graph.progress; + } + return renders[uid]; + } + return Render_status(NOT_FOUND); + }; std::string text_render(std::string node_id=""); Graph graph; private: std::string id; + std::unordered_map<string,Render_status> renders; }; }; |
