diff options
| author | Comment <tim@gray.(none)> | 2013-03-16 18:30:46 +0000 |
|---|---|---|
| committer | Comment <tim@gray.(none)> | 2013-03-16 18:30:46 +0000 |
| commit | 23fe664dabce0a7aa1890d2968e304b2ea666320 (patch) | |
| tree | 295b7e5b17bcc5892bab34c1c7b6a48d3d2104b0 | |
| parent | 7f88d63097332810dc8335d87dfa8fa465180c7b (diff) | |
audio processor
| -rw-r--r-- | rotord/rotor.cpp | 14 | ||||
| -rwxr-xr-x | rotord/rotor.h | 25 |
2 files changed, 31 insertions, 8 deletions
diff --git a/rotord/rotor.cpp b/rotord/rotor.cpp index f8d48c1..feb4a6c 100644 --- a/rotord/rotor.cpp +++ b/rotord/rotor.cpp @@ -326,7 +326,14 @@ static int open_codec_context(int *stream_idx,AVFormatContext *fmt_ctx, enum AVM bool Render_context::load_audio(string &filename){ - //load audio into memory and create thumbnail + //load audio data from file + //what's the best way to use this? the model is background processing, and we want to update a progress bar + //could pass a function pointer to call when each chunk of data becomes available? + //should the data processing be the responsibility of an object or a function? + //in the case of the audio thumbnail, there will be just one place where its kept + //in the case of audio analysis, the daemon will pass each audio analysis object each chunk of data as it gets it + //there could even be an array of audio analysis functions to perform simultaneously? + //how about a vector of objects that subclass the base audio processor class? av_register_all(); @@ -353,11 +360,12 @@ bool Render_context::load_audio(string &filename){ break; } } - - if (!stream) + if (!stream) { cerr <<"Didn't find any audio stream in the file"<< endl; return false; } + + return true; } diff --git a/rotord/rotor.h b/rotord/rotor.h index 21161a2..18b1f19 100755 --- a/rotord/rotor.h +++ b/rotord/rotor.h @@ -139,7 +139,7 @@ namespace Rotor { }; class Node{ - public:; + public: virtual Node* clone(map<string,string> &_settings)=0; UUID uid; //every usable node has a UUID int id; @@ -299,6 +299,20 @@ namespace Rotor { float framerate; float duration; }; + class base_audio_processor { + public: + base_audio_processor(); + base_audio_processor(int _channels,int _bits); + virtual bool process_chunk(char *data,int num_samples); + int channels,bits; + }; + class audio_thumbnailer: public base_audio_processor { + public: + audio_thumbnailer(int _channels,int _bits) { + channels=_channels; + bits=_bits; + }; + }; class Render_context: public Poco::Task { //Poco task object //manages a 'patchbay' //high level interfaces for the wizard @@ -314,15 +328,16 @@ namespace Rotor { void cancel(); //interrupt locking process int make_preview(int nodeID, float time); //starts a frame preview - returns status code - how to retrieve? int load_graph(Poco::UUID uid); - bool load_graph(string &graph_filename); //should eventually be as above + bool load_graph(string &graph_filename); //should eventually be as above UUID save_graph(); //returns UUID of saved graph - bool load_audio(string &filename); + bool load_audio(string &filename,vector<base_audio_processor*> processors); Render_requirements get_requirements(); - int load_video(int num,string &filename); //can be performance or clip + int load_video(int num,string &filename); //can be performance or clip private: int state; - float progress; //for a locking process: audio analysis or rendering + 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; |
