aboutsummaryrefslogtreecommitdiff
path: root/lib/soundcore.h
diff options
context:
space:
mode:
authorvovanec <vovanec@90c681e8-e032-0410-971d-27865f9a5e38>2007-06-23 16:48:01 +0000
committervovanec <vovanec@90c681e8-e032-0410-971d-27865f9a5e38>2007-06-23 16:48:01 +0000
commit2d622fd9bcb8da9dd3f3206e296cd6a701fc9d12 (patch)
treef92135e6cb831e46336dfd4ade47e03ef3a19ac5 /lib/soundcore.h
parent4b6a6720805c585c89f44fd276b3ace8670514d9 (diff)
downloadqmmp-2d622fd9bcb8da9dd3f3206e296cd6a701fc9d12.tar.gz
qmmp-2d622fd9bcb8da9dd3f3206e296cd6a701fc9d12.tar.bz2
qmmp-2d622fd9bcb8da9dd3f3206e296cd6a701fc9d12.zip
moved into qmmp dir
git-svn-id: http://svn.code.sf.net/p/qmmp-dev/code/trunk/qmmp@12 90c681e8-e032-0410-971d-27865f9a5e38
Diffstat (limited to 'lib/soundcore.h')
-rw-r--r--lib/soundcore.h166
1 files changed, 166 insertions, 0 deletions
diff --git a/lib/soundcore.h b/lib/soundcore.h
new file mode 100644
index 000000000..1f88fe691
--- /dev/null
+++ b/lib/soundcore.h
@@ -0,0 +1,166 @@
+/***************************************************************************
+ * Copyright (C) 2006 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., *
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
+ ***************************************************************************/
+#ifndef SOUNDCORE_H
+#define SOUNDCORE_H
+
+#include <QObject>
+
+#include "decoder.h"
+#include "output.h"
+#include "visualization.h"
+
+/**
+ @author Ilya Kotov <forkotov02@hotmail.ru>
+*/
+
+class QIODevice;
+
+class SoundCore : public QObject
+{
+ Q_OBJECT
+public:
+
+ /*! This enum describes the errors that may be returned by the error() function.
+ * Available values is:
+ * \b SoundCore:NoError - no error occurred,
+ * \b SoundCore:DecoderError - an error occurred when creating decoder,
+ * \b SoundCore:OutputError - an error occurred when creating output.
+ */
+ enum ErrorType { NoError = 0, DecoderError, OutputError };
+
+ SoundCore(QObject *parent = 0);
+
+ ~SoundCore();
+
+
+ //control
+
+ /*!
+ * This function plays file with given path, returns \b TRUE if all is OK, otherwise \b FALSE
+ */
+ bool play(const QString &source);
+
+ /*!
+ * Returns the playback error status.
+ * For example, if play() returns false, this function can be called to find out
+ * the reason why the operation failed.
+ */
+ uint error();
+
+ /*!
+ * Stops playing
+ */
+ void stop();
+
+ /*!
+ * Pauses/resumes playing
+ */
+ void pause();
+
+ /*!
+ *This function sets the current play position to \b pos
+ */
+ void seek(int pos);
+
+ // properties
+
+ /*!
+ * Returns length in seconds
+ */
+ int length();
+
+ /*!
+ * Returns \b TRUE if \b play() called successful, otherwise \b FALSE.
+ */
+ bool isReady();
+
+ /*!
+ * Returns \b TRUE if \b play() called successful, otherwise \b FALSE.
+ * Also this function returns \b FALSE if \b stop() called before
+ */
+ bool isInitialized();
+
+ /*!
+ * Returns \b TRUE if plugins in pause mode, otherwise \b FALSE.
+ */
+ bool isPaused();
+
+ //equalizer
+
+ /*!
+ * Sets equalizer settings. Each item of \b bands[] and \b reamp should be
+ * \b -100..100
+ */
+ void setEQ(int bands[10], const int &preamp);
+
+ /*!
+ * Enables equalizer if on is \b TRUE or disables it if on is \b FALSE
+ */
+ void setEQEnabled(bool on);
+
+ //volume
+
+ /*!
+ * Sets volume. \b L - volume of left channel. \b R - volume of right channel.
+ * \b L and \b R should be 0..100
+ */
+ void setVolume(int L, int R);
+
+ //config
+
+ /*!
+ * updates configuration
+ */
+ void updateConfig();
+
+ //visualization
+ /*!
+ * adds visualization
+ */
+ void addVisualization(Visualization *visual);
+
+signals:
+
+ /*!
+ * This signal is emited when the state of the decoder changes.
+ * The argument \b state is the new state of the decoder
+ */
+ void decoderStateChanged(const DecoderState& state);
+
+ /*!
+ * This signal is emited when the state of the output changes.
+ * The argument \b state is the new state of the output
+ */
+ void outputStateChanged(const OutputState& state);
+
+private:
+ Decoder* m_decoder;
+ Output* m_output;
+ QIODevice* m_input;
+ uint m_error;
+ bool m_paused;
+ bool m_useEQ;
+ bool m_update;
+ int m_preamp;
+ int m_bands[10];
+ Visualization *m_vis;
+};
+
+#endif