aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortrialuser02 <trialuser02@90c681e8-e032-0410-971d-27865f9a5e38>2014-09-24 18:41:55 +0000
committertrialuser02 <trialuser02@90c681e8-e032-0410-971d-27865f9a5e38>2014-09-24 18:41:55 +0000
commit0cedd964e3579471ab647dcccbd61f41d65af926 (patch)
tree3c9cabb7b603f95e0923f612e9c7926225d78889
parent2a6c6f65505e490f4fdd8b052e1cb59d3c797dae (diff)
downloadqmmp-0cedd964e3579471ab647dcccbd61f41d65af926.tar.gz
qmmp-0cedd964e3579471ab647dcccbd61f41d65af926.tar.bz2
qmmp-0cedd964e3579471ab647dcccbd61f41d65af926.zip
added ChannelMap class
git-svn-id: http://svn.code.sf.net/p/qmmp-dev/code/trunk/qmmp@4512 90c681e8-e032-0410-971d-27865f9a5e38
-rw-r--r--src/qmmp/channelmap.cpp61
-rw-r--r--src/qmmp/channelmap.h39
-rw-r--r--src/qmmp/decoder.h2
-rw-r--r--src/qmmp/qmmp.pro6
4 files changed, 106 insertions, 2 deletions
diff --git a/src/qmmp/channelmap.cpp b/src/qmmp/channelmap.cpp
new file mode 100644
index 000000000..196c69d6b
--- /dev/null
+++ b/src/qmmp/channelmap.cpp
@@ -0,0 +1,61 @@
+/***************************************************************************
+ * Copyright (C) 2014 by Ilya Kotov *
+ * forkotov02@hotmail.ru *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the *
+ * Free Software Foundation, Inc., *
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
+ ***************************************************************************/
+
+#include "channelmap.h"
+
+Qmmp::AudioChannel ChannelMap::m_internal_map[8] = { Qmmp::CHAN_FRONT_LEFT,
+ Qmmp::CHAN_FRONT_RIGHT,
+ Qmmp::CHAN_REAR_LEFT,
+ Qmmp::CHAN_REAR_RIGHT,
+ Qmmp::CHAN_CENTER,
+ Qmmp::CHAN_LFE,
+ Qmmp::CHAN_SIDE_LEFT,
+ Qmmp::CHAN_SIDE_RIGHT };
+
+ChannelMap::ChannelMap()
+{
+}
+
+int ChannelMap::mask() const
+{
+ int mask = 0;
+ foreach (Qmmp::AudioChannel channel, *this)
+ {
+ mask |= channel;
+ }
+ return mask;
+}
+
+const ChannelMap ChannelMap::remaped() const
+{
+ ChannelMap map;
+ for(int i = 0; i < 8; ++i)
+ {
+ foreach (Qmmp::AudioChannel channel, *this)
+ {
+ if(channel == m_internal_map[i])
+ {
+ map.append(channel);
+ break;
+ }
+ }
+ }
+ return map;
+}
diff --git a/src/qmmp/channelmap.h b/src/qmmp/channelmap.h
new file mode 100644
index 000000000..5a9a96ef5
--- /dev/null
+++ b/src/qmmp/channelmap.h
@@ -0,0 +1,39 @@
+/***************************************************************************
+ * Copyright (C) 2014 by Ilya Kotov *
+ * forkotov02@hotmail.ru *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the *
+ * Free Software Foundation, Inc., *
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
+ ***************************************************************************/
+
+#ifndef CHANNELMAP_H
+#define CHANNELMAP_H
+
+#include <QList>
+#include "qmmp.h"
+
+class ChannelMap : public QList<Qmmp::AudioChannel>
+{
+public:
+ ChannelMap();
+
+ int mask() const;
+ const ChannelMap remaped() const;
+
+private:
+ static Qmmp::AudioChannel m_internal_map[8];
+};
+
+#endif // CHANNELMAP_H
diff --git a/src/qmmp/decoder.h b/src/qmmp/decoder.h
index 36251c798..195aefefb 100644
--- a/src/qmmp/decoder.h
+++ b/src/qmmp/decoder.h
@@ -179,6 +179,8 @@ protected:
*/
void configure(quint32 srate = 44100, int chan = 2, Qmmp::AudioFormat f = Qmmp::PCM_S16LE);
+ //void configure(quint32 srate = 44100, QList<Qmmp::AudioChannel> channels, Qmmp::AudioFormat f = Qmmp::PCM_S16LE);
+
private:
static void loadPlugins();
static DecoderFactory *m_lastFactory;
diff --git a/src/qmmp/qmmp.pro b/src/qmmp/qmmp.pro
index a7a4e5513..501083c7a 100644
--- a/src/qmmp/qmmp.pro
+++ b/src/qmmp/qmmp.pro
@@ -37,7 +37,8 @@ HEADERS += \
volumecontrol_p.h \
outputwriter_p.h \
recycler_p.h \
- qmmpplugincache_p.h
+ qmmpplugincache_p.h \
+ channelmap.h
SOURCES += recycler.cpp \
decoder.cpp \
output.cpp \
@@ -66,7 +67,8 @@ SOURCES += recycler.cpp \
eqsettings.cpp \
qmmpevents.cpp \
outputwriter.cpp \
- qmmpplugincache.cpp
+ qmmpplugincache.cpp \
+ channelmap.cpp
FORMS +=
unix:TARGET = ../../lib/qmmp
win32:TARGET = ../../../bin/qmmp