|
Qmmp
|
00001 /*************************************************************************** 00002 * Copyright (C) 2006-2017 by Ilya Kotov * 00003 * forkotov02@ya.ru * 00004 * * 00005 * This program is free software; you can redistribute it and/or modify * 00006 * it under the terms of the GNU General Public License as published by * 00007 * the Free Software Foundation; either version 2 of the License, or * 00008 * (at your option) any later version. * 00009 * * 00010 * This program is distributed in the hope that it will be useful, * 00011 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 00013 * GNU General Public License for more details. * 00014 * * 00015 * You should have received a copy of the GNU General Public License * 00016 * along with this program; if not, write to the * 00017 * Free Software Foundation, Inc., * 00018 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * 00019 ***************************************************************************/ 00020 #ifndef SOUNDCORE_H 00021 #define SOUNDCORE_H 00022 00023 #include <QObject> 00024 #include <QString> 00025 #include <QQueue> 00026 #include <QHash> 00027 #include "decoder.h" 00028 #include "output.h" 00029 #include "visual.h" 00030 #include "qmmp.h" 00031 #include "qmmpsettings.h" 00032 #include "audioparameters.h" 00033 #include "eqsettings.h" 00034 00035 class VolumeControl; 00036 class AbstractEngine; 00037 class InputSource; 00038 class StateHandler; 00039 00043 class SoundCore : public QObject 00044 { 00045 Q_OBJECT 00046 public: 00051 SoundCore(QObject *parent = 0); 00055 ~SoundCore(); 00059 qint64 totalTime() const; 00063 EqSettings eqSettings() const; 00067 void setEqSettings(const EqSettings &settings); 00071 int leftVolume() const; 00075 int rightVolume() const; 00079 int volume() const; 00083 int balance() const; 00087 bool isMuted() const; 00091 qint64 elapsed() const; 00095 int bitrate() const; 00099 AudioParameters audioParameters() const; 00103 Qmmp::State state() const; 00107 QMap <Qmmp::MetaData, QString> metaData() const; 00111 QString metaData(Qmmp::MetaData key) const; 00115 QHash<QString, QString> streamInfo() const; 00120 bool nextTrackAccepted() const; 00124 static SoundCore* instance(); 00125 00126 public slots: 00132 void setVolume(int left, int right); 00137 void setMuted(bool mute); 00141 void changeVolume(int delta); 00146 void setVolume(int volume); 00150 void volumeUp(); 00154 void volumeDown(); 00159 void setBalance(int balance); 00165 bool play(const QString &source, bool queue = false, qint64 offset = -1); 00169 void stop(); 00173 void pause(); 00177 void seek(qint64 pos); 00181 const QString url() const; 00182 00183 signals: 00188 void bufferingProgress(int progress); 00193 void elapsedChanged(qint64 time); 00198 void bitrateChanged(int bitrate); 00203 void audioParametersChanged(const AudioParameters &p); 00207 void metaDataChanged (); 00211 void streamInfoChanged(); 00215 void stateChanged (Qmmp::State newState); 00219 void finished(); 00225 void volumeChanged(int left, int right); 00230 void mutedChanged(bool muted); 00235 void volumeChanged(int volume); 00240 void balanceChanged(int balance); 00244 void eqSettingsChanged(); 00248 void nextTrackRequest(); 00249 00250 private slots: 00251 void startNextSource(); 00252 void startNextEngine(); 00253 00254 private: 00255 bool event(QEvent *e); 00256 enum NextEngineState 00257 { 00258 NO_ENGINE = 0, 00259 SAME_ENGINE, 00260 ANOTHER_ENGINE, 00261 INVALID_SOURCE 00262 }; 00263 QMap <Qmmp::MetaData, QString> m_metaData; 00264 QHash <QString, QString> m_streamInfo; 00265 QString m_url; 00266 static SoundCore* m_instance; 00267 StateHandler *m_handler; 00268 VolumeControl *m_volumeControl; 00269 AbstractEngine *m_engine; 00270 QQueue<InputSource *> m_sources; 00271 int m_nextState; 00272 bool m_muted; 00273 }; 00274 00275 #endif
1.7.6.1