aboutsummaryrefslogtreecommitdiff
path: root/src/plugins/Visual
diff options
context:
space:
mode:
authortrialuser02 <trialuser02@90c681e8-e032-0410-971d-27865f9a5e38>2010-01-16 15:33:17 +0000
committertrialuser02 <trialuser02@90c681e8-e032-0410-971d-27865f9a5e38>2010-01-16 15:33:17 +0000
commit435f1da1de18bafe57e43e47fd8a6fc69fd8bab7 (patch)
treee332293971b3b3883685b79c62bcd50bf2f49c12 /src/plugins/Visual
parent2fa169a585994ceb40db55405f46783d06820947 (diff)
downloadqmmp-435f1da1de18bafe57e43e47fd8a6fc69fd8bab7.tar.gz
qmmp-435f1da1de18bafe57e43e47fd8a6fc69fd8bab7.tar.bz2
qmmp-435f1da1de18bafe57e43e47fd8a6fc69fd8bab7.zip
updated audio engine
git-svn-id: http://svn.code.sf.net/p/qmmp-dev/code/trunk/qmmp@1503 90c681e8-e032-0410-971d-27865f9a5e38
Diffstat (limited to 'src/plugins/Visual')
-rw-r--r--src/plugins/Visual/analyzer/analyzer.cpp26
-rw-r--r--src/plugins/Visual/analyzer/analyzer.h8
-rw-r--r--src/plugins/Visual/projectm/projectmplugin.cpp8
-rw-r--r--src/plugins/Visual/projectm/projectmplugin.h4
4 files changed, 20 insertions, 26 deletions
diff --git a/src/plugins/Visual/analyzer/analyzer.cpp b/src/plugins/Visual/analyzer/analyzer.cpp
index 215c70a8a..de17d214d 100644
--- a/src/plugins/Visual/analyzer/analyzer.cpp
+++ b/src/plugins/Visual/analyzer/analyzer.cpp
@@ -82,43 +82,35 @@ void Analyzer::clear()
update();
}
-void Analyzer::add (Buffer *b, unsigned long w, int c, int p)
+void Analyzer::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 Analyzer::timeout()
diff --git a/src/plugins/Visual/analyzer/analyzer.h b/src/plugins/Visual/analyzer/analyzer.h
index 9b0352dae..1c0e8974e 100644
--- a/src/plugins/Visual/analyzer/analyzer.h
+++ b/src/plugins/Visual/analyzer/analyzer.h
@@ -36,8 +36,8 @@ class Buffer;
class VisualNode
{
public:
- VisualNode(short *l, short *r, unsigned long n, unsigned long o)
- : left(l), right(r), length(n), offset(o)
+ VisualNode(short *l, short *r, unsigned long n)
+ : left(l), right(r), length(n)
{
// left and right are allocated and then passed to this class
// the code that allocated left and right should give up all ownership
@@ -50,7 +50,7 @@ public:
}
short *left, *right;
- long length, offset;
+ long length;
};
class Analyzer : public Visual
@@ -61,7 +61,7 @@ public:
Analyzer( QWidget *parent = 0);
virtual ~Analyzer();
- void add(Buffer *, unsigned long, int, int);
+ void add(unsigned char *data, qint64 size, int chan);
void clear();
void paintEvent( QPaintEvent * );
diff --git a/src/plugins/Visual/projectm/projectmplugin.cpp b/src/plugins/Visual/projectm/projectmplugin.cpp
index b29dfab1e..b7e1483a4 100644
--- a/src/plugins/Visual/projectm/projectmplugin.cpp
+++ b/src/plugins/Visual/projectm/projectmplugin.cpp
@@ -54,8 +54,10 @@ void ProjectMPlugin::clear()
update();
}
-void ProjectMPlugin::add ( Buffer *b, unsigned long, int, int)
-{ //TODO 8 bit support
+void ProjectMPlugin::add (unsigned char *data, qint64 size, int chan)
+{
+ Q_UNUSED(chan);
+ //TODO multichannel support
if (m_projectMWidget->projectMInstance())
- m_projectMWidget->projectMInstance()->pcm()->addPCM16Data((short *)b->data, b->nbytes/4);
+ m_projectMWidget->projectMInstance()->pcm()->addPCM16Data((short *)data, size/4);
}
diff --git a/src/plugins/Visual/projectm/projectmplugin.h b/src/plugins/Visual/projectm/projectmplugin.h
index db16ab110..5f201ef39 100644
--- a/src/plugins/Visual/projectm/projectmplugin.h
+++ b/src/plugins/Visual/projectm/projectmplugin.h
@@ -1,5 +1,5 @@
/***************************************************************************
- * Copyright (C) 2009 by Ilya Kotov *
+ * Copyright (C) 2009-2010 by Ilya Kotov *
* forkotov02@hotmail.ru *
* *
* This program is free software; you can redistribute it and/or modify *
@@ -35,7 +35,7 @@ public:
ProjectMPlugin(QWidget *parent = 0);
virtual ~ProjectMPlugin();
- void add(Buffer *, unsigned long, int, int);
+ void add(unsigned char *data, qint64 size, int chan);
void clear();
private: