TTKMusicPlayer  4.2.0.0
TTKMusicPlayer imitates Kugou UI, the music player uses of qmmp core library based on Qt for windows and linux
qmmp.h
Go to the documentation of this file.
1 /***************************************************************************
2  * Copyright (C) 2008-2025 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 QMMP_H
22 #define QMMP_H
23 
24 #include <QString>
25 #include "qmmp_export.h"
26 
27 #define QMMP_VERSION_MAJOR 1
28 #define QMMP_VERSION_MINOR 7
29 #define QMMP_VERSION_PATCH 7
30 #define QMMP_VERSION_STABLE 1
31 
32 #define QMMP_VERSION_INT (QMMP_VERSION_MAJOR<<16 | QMMP_VERSION_MINOR<<8 | QMMP_VERSION_PATCH)
33 
37 #ifdef Q_OS_WIN
38 # define QStringToFileName(s) TagLib::FileName(reinterpret_cast<const wchar_t *>(s.utf16()))
39 #else
40 # define QStringToFileName(s) s.toLocal8Bit().constData()
41 #endif
42 
43 #ifndef qPrintable
44 # define qPrintable(s) QString(s).toLocal8Bit().constData()
45 #endif
46 
47 #ifndef qUtf8Printable
48 # define qUtf8Printable(s) QString(s).toUtf8().constData()
49 #endif
50 
51 #ifndef QmmpPrintable
52 # define QmmpPrintable(s) Qmmp::generatePrintable(s).constData()
53 #endif
54 
55 #define CSTR_TO_QSTR(codec, str, utf) codec->toUnicode(str.toCString(utf)).trimmed()
56 
57 #ifndef TTK_LIBRARY
58 // as_const defined
59 #if __cplusplus < 201703L
60 namespace std
61 {
62 // this adds const to non-const objects
63 template <typename T>
64 Q_DECL_CONSTEXPR typename std::add_const<T>::type &as_const(T &t) noexcept { return t; }
65 // prevent rvalue arguments:
66 template <typename T>
67 void as_const(const T &&) = delete;
68 }
69 #endif
70 
71 #if QT_VERSION < QT_VERSION_CHECK(5,7,0) || QT_VERSION >= QT_VERSION_CHECK(6,6,0)
72 # define qAsConst std::as_const
73 #endif
74 
75 #if QT_VERSION < QT_VERSION_CHECK(5,10,0)
76 using qsizetype = QIntegerForSizeof<std::size_t>::Signed;
77 #endif
78 #endif
79 
84 {
85 public:
89  enum State
90  {
91  Playing = 0,
96  FatalError
97  };
101  enum MetaData
102  {
103  UNKNOWN = -1,
104  TITLE = 0,
113  DISCNUMBER
114  };
119  {
120  UNKNOWN_PROPERTY = -1,
121  BITRATE = 0,
128  };
133  {
134  REPLAYGAIN_TRACK_GAIN = 0,
137  REPLAYGAIN_ALBUM_PEAK
138  };
143  {
144  PCM_UNKNOWN = -1,
145  PCM_S8 = 0,
159  PCM_FLOAT
160  };
161 
166  {
167  CHAN_NULL = 0x00,
168  CHAN_FRONT_LEFT = 0x01,
169  CHAN_FRONT_RIGHT = 0x02,
170  CHAN_REAR_LEFT = 0x04,
171  CHAN_REAR_RIGHT = 0x08,
172  CHAN_FRONT_CENTER = 0x10,
173  CHAN_REAR_CENTER = 0x20,
174  CHAN_SIDE_LEFT = 0x40,
175  CHAN_SIDE_RIGHT = 0x80,
176  CHAN_LFE = 0x100,
177  };
178 
182  static QString configFile();
186  static QString configDir();
190  static QString cacheDir();
194  static QString strVersion();
198  static QString pluginPath();
203  static QStringList findPlugins(const QString &prefix);
207  static QString ttkPluginPath();
212  static QByteArray generatePrintable(const QString &text);
213 };
214 
215 #endif
Q_DECL_CONSTEXPR std::add_const< T >::type & as_const(T &t) noexcept
Definition: ttkqtglobal.h:49
#define T(v)
Definition: http_parser.c:237
Definition: ttkcompat.h:39
TrackProperty
Definition: qmmp.h:118
ReplayGainKey
Definition: qmmp.h:132
ChannelPosition
Definition: qmmp.h:165
MetaData
Definition: qmmp.h:101
State
Definition: qmmp.h:89
#define QMMP_EXPORT
Definition: qmmp_export.h:29
TTK_MODULE_EXPORT QString pluginPath(const QString &module, const QString &format)
size_t(* FILE_SIZE)(void *handle)
Definition: wke.h:124
AudioFormat
Definition: qmmp.h:142
The Qmmp class stores global settings and enums.
Definition: qmmp.h:83