From 5c5e42a26df6bd5afa05750967352ffa15a67e29 Mon Sep 17 00:00:00 2001 From: Tim Redfern Date: Wed, 27 Mar 2013 17:16:25 +0000 Subject: nearly reading samples --- rotord/rotor.cpp | 66 ++++++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 64 insertions(+), 2 deletions(-) (limited to 'rotord/rotor.cpp') diff --git a/rotord/rotor.cpp b/rotord/rotor.cpp index 85382ea..36cc6f3 100644 --- a/rotord/rotor.cpp +++ b/rotord/rotor.cpp @@ -119,7 +119,7 @@ Command_response Render_context::session_command(const std::vector& response.description="Rotor: audio ready\n"; response.description+=""; + response.description+=""; state=IDLE; } } @@ -536,7 +536,7 @@ bool Render_context::load_audio(const string &filename,vector doxygen" into google (like // "AVFrame doxygen" for AVFrame's docs) - //std::cout << "Got a frame: bytes " << bytes << std::endl; + //std::cout << "Got a frame: bytes " << bytes << ", "<nb_samples<<" samples"<process_frame(frame->data[0],frame->nb_samples); @@ -633,3 +633,65 @@ Node_factory::Node_factory(){ add_type("==",new Is_new_integer()); add_type("signal_output",new Signal_output()); } +void audio_thumbnailer::init(int _channels,int _bits,int _samples) { + //base_audio_processor::init(_channels,_bits,_samples); + channels=_channels; + bits=_bits; + samples=_samples; + + + samples_per_column=samples/width; + column=0; //point thumbnail bitmap + out_sample=0; //sample in whole track + offset=(int)(pow(2.0,bits)/2.0); + scale=1.0/offset; +} +int audio_thumbnailer::process_frame(uint8_t *_data,int samples_in_frame){ + //begin by processing remaining samplesthread 4 + //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 in_sample=0; + while (in_sample>1; + for (int i=0;i