From 7cf0551b85deed68d0eefd51e7b233e5c488f63b Mon Sep 17 00:00:00 2001 From: Tim Redfern Date: Tue, 26 Mar 2013 18:33:54 +0000 Subject: nearly working thumbnailer --- rotord/rotor.h | 77 ++++++++++++++++++++++++++++++++++++++++------------------ 1 file changed, 53 insertions(+), 24 deletions(-) (limited to 'rotord/rotor.h') diff --git a/rotord/rotor.h b/rotord/rotor.h index e16520b..de8e686 100755 --- a/rotord/rotor.h +++ b/rotord/rotor.h @@ -335,7 +335,7 @@ namespace Rotor { }; class base_audio_processor { public: - virtual bool process_frame(uint8_t *data,int samples)=0; + virtual int process_frame(uint8_t *data,int samples)=0; void init(int _channels,int _bits,int _samples) { channels=_channels; bits=_bits; @@ -350,7 +350,7 @@ namespace Rotor { public: audio_thumbnailer(){ height=64; - width=512; + width=128; //fit data=new uint8_t[height*width]; memset(data,0,height*width); } @@ -360,39 +360,66 @@ namespace Rotor { void init(int _channels,int _bits,int _samples) { base_audio_processor::init(_channels,_bits,_samples); samples_per_column=samples/width; - stored_data=new uint8_t[samples_per_column*channels*(bits>>3)]; - sample=0; + column=0; //point thumbnail bitmap + out_sample=0; //sample in whole track + offset=(int)(pow(2.0,bits)/2.0); + scale=1.0/offset; } - bool process_frame(uint8_t *data,int samples_in_frame){ + int process_frame(uint8_t *data,int samples_in_frame){ //begin by processing remaining samples //samples per column could be larger than a frame! (probably is) //but all we are doing is averaging int bytes=(bits>>3); int stride=channels*bytes; - int next_sample=0; - uint64_t accum; - while (next_sample>1; + for (int i=0;i work_queue; Poco::Mutex mutex; //lock for access from parent thread std::string audio_filename; + audio_thumbnailer *audio_thumb; vampHost::QMAnalyser audio_analyser; xmlIO xml; Graph graph; @@ -431,6 +460,6 @@ namespace Rotor { /* coding style -Types begin with a capital, use underscore as a seperator -instances begin with a small letter +Types begin with capitals 'CamelCase' +variables/ instances use lower case with underscore as a seperator */ -- cgit v1.2.3