aboutsummaryrefslogtreecommitdiff
path: root/src/plugins/Visual/analyzer/analyzer.cpp
diff options
context:
space:
mode:
authortrialuser02 <trialuser02@90c681e8-e032-0410-971d-27865f9a5e38>2010-01-21 09:39:42 +0000
committertrialuser02 <trialuser02@90c681e8-e032-0410-971d-27865f9a5e38>2010-01-21 09:39:42 +0000
commit81e063b606dfaf05311a4cbabaf378ab55fca9a7 (patch)
tree4b3e8194723a8d305568530a4b8b93c711a51623 /src/plugins/Visual/analyzer/analyzer.cpp
parentdbcf03bb3946253d0156834cc8e49c0575c8fcc5 (diff)
downloadqmmp-81e063b606dfaf05311a4cbabaf378ab55fca9a7.tar.gz
qmmp-81e063b606dfaf05311a4cbabaf378ab55fca9a7.tar.bz2
qmmp-81e063b606dfaf05311a4cbabaf378ab55fca9a7.zip
fixed analyzer
git-svn-id: http://svn.code.sf.net/p/qmmp-dev/code/trunk/qmmp@1520 90c681e8-e032-0410-971d-27865f9a5e38
Diffstat (limited to 'src/plugins/Visual/analyzer/analyzer.cpp')
-rw-r--r--src/plugins/Visual/analyzer/analyzer.cpp41
1 files changed, 19 insertions, 22 deletions
diff --git a/src/plugins/Visual/analyzer/analyzer.cpp b/src/plugins/Visual/analyzer/analyzer.cpp
index de17d214d..20aa6fb78 100644
--- a/src/plugins/Visual/analyzer/analyzer.cpp
+++ b/src/plugins/Visual/analyzer/analyzer.cpp
@@ -86,31 +86,28 @@ void Analyzer::add (unsigned char *data, qint64 size, int chan)
{
if (!m_timer->isActive ())
return;
- long len = size, cnt;
- short *l = 0, *r = 0;
-
- len /= chan;
- len /= 2;
- if (len > 512)
- len = 512;
- cnt = len;
- if (chan == 2)
- {
- l = new short[len];
- r = new short[len];
- stereo16_from_stereopcm16 (l, r, (short *) data, cnt);
- }
- else if (chan == 1)
+ short *l = 0, *r = 0;
+ qint64 samples = size/chan >> 1;
+ int frames = samples/512;
+ for (int i = 0; i < frames; ++i)
{
- l = new short[len];
- mono16_from_monopcm16 (l, (short *) data, cnt);
+ l = new short[512];
+ r = 0;
+ if (chan == 2)
+ {
+ r = new short[512];
+ stereo16_from_stereopcm16 (l, r, (short *) (data + i*4*512), 512);
+ }
+ else if (chan == 1)
+ mono16_from_monopcm16 (l, (short *) (data + i*2*512), 512);
+ else
+ {
+ r = new short[512];
+ stereo16_from_multichannel(l, r, (short *) (data + i*2*chan*512), 512, chan);
+ }
+ m_nodes.append (new VisualNode (l, r, 512));
}
- else
- len = 0;
-
- if (len)
- m_nodes.append (new VisualNode (l, r, len));
}
void Analyzer::timeout()