diff options
| author | Tim Redfern <tim@eclectronics.org> | 2013-05-22 19:39:11 +0100 |
|---|---|---|
| committer | Tim Redfern <tim@eclectronics.org> | 2013-05-22 19:39:11 +0100 |
| commit | 55513473ca37841b40662e1a0221d7dd260a59b7 (patch) | |
| tree | be531f11f5258fa3cd576e2a8432513989fc82fa /rotord/rendercontext.cpp | |
| parent | 2c3a51b49232ebd6776ba491f96335208d3fdc66 (diff) | |
baffled by audio analysis
Diffstat (limited to 'rotord/rendercontext.cpp')
| -rw-r--r-- | rotord/rendercontext.cpp | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/rotord/rendercontext.cpp b/rotord/rendercontext.cpp index 624b7c1..dec9f34 100644 --- a/rotord/rendercontext.cpp +++ b/rotord/rendercontext.cpp @@ -18,7 +18,7 @@ void Render_context::runTask() { for (auto a: analysers) { processors.push_back(dynamic_cast<Base_audio_processor*>(a)); } - if (_load_audio(audio_filename,processors)) { + if (load_audio(audio_filename,processors)) { audio_loaded=true; state=IDLE; } @@ -268,6 +268,7 @@ Command_response Render_context::session_command(const std::vector<std::string>& } return response; } +/* //http://blog.tomaka17.com/2012/03/libavcodeclibavformat-tutorial/ //great to use c++11 features @@ -289,7 +290,8 @@ bool Render_context::load_audio(const string &filename,vector<Base_audio_process return true; } -bool Render_context::_load_audio(const string &filename,vector<Base_audio_processor*> processors){ +*/ +bool Render_context::load_audio(const string &filename,vector<Base_audio_processor*> processors){ av_register_all(); @@ -358,10 +360,14 @@ bool Render_context::_load_audio(const string &filename,vector<Base_audio_proces graph.duration=((float)formatContext->duration)/AV_TIME_BASE; std::cout << "This stream has " << codecContext->channels << " channels, a sample rate of " << codecContext->sample_rate << "Hz and "<<samples <<" samples" << std::endl; - std::cout << "The data is in format " <<codecContext->sample_fmt<< " (aka "<< av_get_sample_fmt_name(codecContext->sample_fmt) << ") "<<std::endl; + std::cout << "The data is in format " <<codecContext->sample_fmt<< " (aka "<< av_get_sample_fmt_name(codecContext->sample_fmt) << ")"<<std::endl; + //std::cout << "Decoding to format " <<frame->format<< " at "<<frame->sample_rate<<" Hz"<<std::endl; + + //frame->sample_rate=codecContext->sample_rate; + map <std::string,float> params; for (auto p: processors) { - if(!p->init(codecContext->channels,16,samples,codecContext->sample_rate) ){ + if(!p->init(codecContext->channels,16,samples,codecContext->sample_rate,params) ){ cerr<<"Plugin failed to initialse"<<endl; return false; } @@ -438,6 +444,7 @@ bool Render_context::_load_audio(const string &filename,vector<Base_audio_proces // Clean up! for (auto p: processors) { p->cleanup(); + p->print_summary(); } |
