TTKMusicPlayer  3.7.0.0
TTKMusicPlayer imitates Kugou UI, the music player uses of qmmp core library based on Qt for windows and linux
output.h
Go to the documentation of this file.
1 /***************************************************************************
2  * Copyright (C) 2009-2024 by Ilya Kotov *
3  * forkotov02@ya.ru *
4  * *
5  * This program is free software; you can redistribute it and/or modify *
6  * it under the terms of the GNU General Public License as published by *
7  * the Free Software Foundation; either version 2 of the License, or *
8  * (at your option) any later version. *
9  * *
10  * This program is distributed in the hope that it will be useful, *
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13  * GNU General Public License for more details. *
14  * *
15  * You should have received a copy of the GNU General Public License *
16  * along with this program; if not, write to the *
17  * Free Software Foundation, Inc., *
18  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
19  ***************************************************************************/
20 
21 #ifndef OUTPUT_H
22 #define OUTPUT_H
23 
24 #include <QList>
25 #include <QIODevice>
26 #include "outputfactory.h"
27 #include "audioparameters.h"
28 #include "trackinfo.h"
29 #include "channelmap.h"
30 
31 class QTimer;
32 class QmmpSettings;
33 class QmmpPluginCache;
34 
40 {
41 public:
45  Output() = default;
49  virtual ~Output() = default;
50 
59  virtual bool initialize(quint32 freq, ChannelMap map, Qmmp::AudioFormat format) = 0;
63  virtual qint64 latency() = 0;
73  virtual qint64 writeAudio(unsigned char *data, qint64 maxSize) = 0;
78  virtual void drain() = 0;
83  virtual void reset() = 0;
87  virtual void suspend();
91  virtual void resume();
97  virtual void setTrackInfo(const TrackInfo &info);
101  AudioParameters audioParameters() const;
105  quint32 sampleRate() const;
109  int channels() const;
113  const ChannelMap &channelMap() const;
117  Qmmp::AudioFormat format() const;
121  int sampleSize() const;
126  static Output *create();
130  static QList<OutputFactory*> factories();
135  static QString file(const OutputFactory *factory);
139  static void setCurrentFactory(const OutputFactory* factory);
143  static OutputFactory *currentFactory();
144 
145 protected:
152  void configure(quint32 freq, ChannelMap map, Qmmp::AudioFormat format);
153 
154 private:
155  quint32 m_frequency = 0;
158  int m_sample_size = 0;
159 
160  static void loadPlugins();
161  static QList<QmmpPluginCache*> *m_cache;
162 
163 };
164 
165 
166 #endif
static QList< QmmpPluginCache * > * m_cache
Definition: output.h:161
The QmmpSettings class provides access to global settings.
Definition: qmmpsettings.h:35
The AudioParameters class keeps information about audio settings.
The Output class provides the base interface class of audio outputs.
Definition: output.h:39
The TrackInfo class stores metadata and other information about track.
Definition: trackinfo.h:32
This class represents audio channel mapping.
Definition: channelmap.h:30
#define QMMP_EXPORT
Definition: qmmp_export.h:29
ChannelMap m_chan_map
Definition: output.h:156
AudioFormat
Definition: qmmp.h:129
Output plugin interface (output factory).
Definition: outputfactory.h:44