aboutsummaryrefslogtreecommitdiff
path: root/src/plugins/Effect/stereo
diff options
context:
space:
mode:
authortrialuser02 <trialuser02@90c681e8-e032-0410-971d-27865f9a5e38>2015-12-27 11:09:46 +0000
committertrialuser02 <trialuser02@90c681e8-e032-0410-971d-27865f9a5e38>2015-12-27 11:09:46 +0000
commitb5dc393952c84dbd53c60afb8d367ad99bbd16ca (patch)
treed8c1ffc992fa60391f04179550a946a056b9b4de /src/plugins/Effect/stereo
parentd8525aed2bc18ac54e65a996d38df934966c0c7c (diff)
downloadqmmp-b5dc393952c84dbd53c60afb8d367ad99bbd16ca.tar.gz
qmmp-b5dc393952c84dbd53c60afb8d367ad99bbd16ca.tar.bz2
qmmp-b5dc393952c84dbd53c60afb8d367ad99bbd16ca.zip
ported all effect plugins
git-svn-id: http://svn.code.sf.net/p/qmmp-dev/code/trunk/qmmp@5899 90c681e8-e032-0410-971d-27865f9a5e38
Diffstat (limited to 'src/plugins/Effect/stereo')
-rw-r--r--src/plugins/Effect/stereo/stereoplugin.cpp44
-rw-r--r--src/plugins/Effect/stereo/stereoplugin.h5
2 files changed, 15 insertions, 34 deletions
diff --git a/src/plugins/Effect/stereo/stereoplugin.cpp b/src/plugins/Effect/stereo/stereoplugin.cpp
index 20c27de09..dcfff2a75 100644
--- a/src/plugins/Effect/stereo/stereoplugin.cpp
+++ b/src/plugins/Effect/stereo/stereoplugin.cpp
@@ -1,7 +1,7 @@
/***************************************************************************
* Copyright (C) 1999 by Johan Levin *
* *
- * Copyright (C) 2011-2014 by Ilya Kotov *
+ * Copyright (C) 2011-2015 by Ilya Kotov *
* forkotov02@hotmail.ru *
* *
* This program is free software; you can redistribute it and/or modify *
@@ -31,7 +31,6 @@ StereoPlugin *StereoPlugin::m_instance = 0;
StereoPlugin::StereoPlugin() : Effect()
{
m_instance = this;
- m_format = Qmmp::PCM_S16LE;
m_avg = 0;
m_ldiff = 0;
m_rdiff = 0;
@@ -53,44 +52,27 @@ void StereoPlugin::applyEffect(Buffer *b)
return;
m_mutex.lock();
- if(m_format == Qmmp::PCM_S16LE)
- {
- short *data = (short *)b->data;
- for (uint i = 0; i < (b->nbytes >> 1); i += 2)
- {
- m_avg = (data[i] + data[i + 1]) / 2;
- m_ldiff = data[i] - m_avg;
- m_rdiff = data[i + 1] - m_avg;
+ float *data = b->data;
- m_tmp = m_avg + m_ldiff * m_mul;
- data[i] = qBound(-32768.0, m_tmp, 32767.0);
- m_tmp = m_avg + m_rdiff * m_mul;
- data[i + 1] = qBound(-32768.0, m_tmp, 32767.0);
- }
- }
- else if(m_format == Qmmp::PCM_S24LE || m_format == Qmmp::PCM_S32LE)
+ for (uint i = 0; i < b->samples; i += 2)
{
- int *data = (int *)b->data;
- for (uint i = 0; i < (b->nbytes >> 2); i += 2)
- {
- m_avg = (data[i] + data[i + 1]) / 2;
- m_ldiff = data[i] - m_avg;
- m_rdiff = data[i + 1] - m_avg;
+ m_avg = (data[i] + data[i + 1]) / 2;
+ m_ldiff = data[i] - m_avg;
+ m_rdiff = data[i + 1] - m_avg;
- m_tmp = m_avg + m_ldiff * m_mul;
- data[i] = m_tmp;
- m_tmp = m_avg + m_rdiff * m_mul;
- data[i + 1] = m_tmp;
- }
+ m_tmp = m_avg + m_ldiff * m_mul;
+ data[i] = qBound(-1.0, m_tmp, 1.0);
+ m_tmp = m_avg + m_rdiff * m_mul;
+ data[i + 1] = qBound(-1.0, m_tmp, 1.0);
}
+
m_mutex.unlock();
}
-void StereoPlugin::configure(quint32 freq, ChannelMap map, Qmmp::AudioFormat format)
+void StereoPlugin::configure(quint32 freq, ChannelMap map)
{
m_chan = map.count();
- m_format = format;
- Effect::configure(freq, map, format);
+ Effect::configure(freq, map);
}
void StereoPlugin::setIntensity(double level)
diff --git a/src/plugins/Effect/stereo/stereoplugin.h b/src/plugins/Effect/stereo/stereoplugin.h
index a9901048b..19f18a148 100644
--- a/src/plugins/Effect/stereo/stereoplugin.h
+++ b/src/plugins/Effect/stereo/stereoplugin.h
@@ -1,5 +1,5 @@
/***************************************************************************
- * Copyright (C) 2011-2014 by Ilya Kotov *
+ * Copyright (C) 2011-2015 by Ilya Kotov *
* forkotov02@hotmail.ru *
* *
* This program is free software; you can redistribute it and/or modify *
@@ -34,7 +34,7 @@ public:
virtual ~StereoPlugin();
void applyEffect(Buffer *b);
- void configure(quint32 freq, ChannelMap map, Qmmp::AudioFormat format);
+ void configure(quint32 freq, ChannelMap map);
void setIntensity(double level);
static StereoPlugin* instance();
@@ -42,7 +42,6 @@ private:
int m_chan;
QMutex m_mutex;
double m_avg, m_ldiff, m_rdiff, m_tmp, m_mul;
- int m_format;
static StereoPlugin *m_instance;
};