From 435f1da1de18bafe57e43e47fd8a6fc69fd8bab7 Mon Sep 17 00:00:00 2001 From: trialuser02 Date: Sat, 16 Jan 2010 15:33:17 +0000 Subject: updated audio engine git-svn-id: http://svn.code.sf.net/p/qmmp-dev/code/trunk/qmmp@1503 90c681e8-e032-0410-971d-27865f9a5e38 --- src/ui/shadedvisual.cpp | 26 +++++++++----------------- 1 file changed, 9 insertions(+), 17 deletions(-) (limited to 'src/ui/shadedvisual.cpp') diff --git a/src/ui/shadedvisual.cpp b/src/ui/shadedvisual.cpp index d58f96fa1..fdc487c7c 100644 --- a/src/ui/shadedvisual.cpp +++ b/src/ui/shadedvisual.cpp @@ -42,43 +42,35 @@ ShadedVisual::ShadedVisual(QWidget *parent) : Visual(parent) ShadedVisual::~ShadedVisual() {} -void ShadedVisual::add(Buffer *b, unsigned long w, int c, int p) +void ShadedVisual::add(unsigned char *data, qint64 size, int chan) { if (!m_timer->isActive ()) return; - long len = b->nbytes, cnt; + long len = size, cnt; short *l = 0, *r = 0; - len /= c; - len /= ( p / 8 ); + len /= chan; + len /= 2; if ( len > 512 ) len = 512; cnt = len; - if ( c == 2 ) + if (chan == 2) { l = new short[len]; r = new short[len]; - - if ( p == 8 ) - stereo16_from_stereopcm8 ( l, r, b->data, cnt ); - else if ( p == 16 ) - stereo16_from_stereopcm16 ( l, r, ( short * ) b->data, cnt ); + stereo16_from_stereopcm16 ( l, r, (short *) data, cnt); } - else if ( c == 1 ) + else if (chan == 1) { l = new short[len]; - - if ( p == 8 ) - mono16_from_monopcm8 ( l, b->data, cnt ); - else if ( p == 16 ) - mono16_from_monopcm16 ( l, ( short * ) b->data, cnt ); + mono16_from_monopcm16 (l, (short *) data, cnt); } else len = 0; if (len) - m_nodes.append (new VisualNode (l, r, len, w)); + m_nodes.append (new VisualNode (l, r, len)); } void ShadedVisual::clear() -- cgit v1.2.3-13-gbd6f