From 95295030238e63890b6ea3113a2741b843e0b8c1 Mon Sep 17 00:00:00 2001 From: Comment Date: Tue, 20 Aug 2013 20:58:14 +0100 Subject: audio viz: waves node --- rotord/src/nodes_drawing.h | 38 +++++++++++++++++++++++++++++++++----- rotord/src/rotor.cpp | 7 +++++-- 2 files changed, 38 insertions(+), 7 deletions(-) (limited to 'rotord/src') diff --git a/rotord/src/nodes_drawing.h b/rotord/src/nodes_drawing.h index d6b7abe..3c26c9f 100644 --- a/rotord/src/nodes_drawing.h +++ b/rotord/src/nodes_drawing.h @@ -113,7 +113,31 @@ namespace Rotor { private: Colour colour; }; - class Waves: public Draw_node { + class Audio_viz: public Draw_node { + public: + Audio_viz(){} + Audio_viz(map &settings):Audio_viz() { + base_settings(settings); + }; + ~Audio_viz(){}; + Audio_viz* clone(map &_settings) { return new Audio_viz(_settings);}; + void vector_output(cairo_t * cr,const Frame_spec &frame){ + if (audioactive){ + if (!frame.audio){ + cerr<<"Audio_viz: audio not found"< &_settings) { return new Waves(_settings);}; - void vector_output(cairo_t * cr,const Frame_spec &frame){ - if (frame.audio){ - + void vector_audio_output(cairo_t * cr,const Frame_spec &frame){ + cairo_set_source_rgb(cr, 1.0,1.0,1.0); + cairo_save(cr); //not really even necessary? + cairo_translate(cr, 0, frame.h/2); + for (int i=0;isamples[i*frame.audio->channels])*frame.h)>>16); } - else cerr<<"error: visualisation audio not found"<channels,samples_in_frame); } @@ -273,17 +275,18 @@ bool Video_output::render(const float duration, const float framerate,const stri //Assertion ff_avcodec_locked failed at libavcodec/utils.c:2967 //cerr<<"videoloader: "<channels,samples_in_frame))); + i=get_output(Frame_spec(vf,framerate,duration,outW,outH,a)); } else i=get_output(Frame_spec(vf,framerate,duration,outW,outH)); if (i) { exporter.encodeFrame(i->RGBdata); - } vf+=vstep; progress=vf/duration; + if (usingaudio) {delete a;}; } exporter.finishRecord(); -- cgit v1.2.3