Qmmp
Loading...
Searching...
No Matches
audioparameters.h
1/***************************************************************************
2 * Copyright (C) 2009-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 AUDIOPARAMETERS_H
22#define AUDIOPARAMETERS_H
23
24#include <QtGlobal>
25#include "channelmap.h"
26#include "qmmp.h"
27
31class QMMP_EXPORT AudioParameters
32{
33public:
42
52 AudioParameters(quint32 srate, const ChannelMap &map, Qmmp::AudioFormat format);
64 bool operator==(const AudioParameters &p) const;
68 bool operator!=(const AudioParameters &p) const;
72 quint32 sampleRate() const;
76 int channels() const;
80 const ChannelMap channelMap() const;
84 Qmmp::AudioFormat format() const;
88 int sampleSize() const;
93 int frameSize() const;
97 int bitsPerSample() const;
111 QString toString() const;
115 static int sampleSize(Qmmp::AudioFormat format);
119 static int bitsPerSample(Qmmp::AudioFormat format);
124 static int validBitsPerSample(Qmmp::AudioFormat format);
131 static Qmmp::AudioFormat findAudioFormat(int bits, ByteOrder byteOrder = LittleEndian);
132
133private:
134 quint32 m_srate = 0;
135 ChannelMap m_chan_map;
136 Qmmp::AudioFormat m_format = Qmmp::PCM_S16LE;
137 int m_sz = 2;
138 int m_precision = 16;
139};
140
141#endif // AUDIOPARAMETERS_H
Qmmp::AudioFormat format() const
ByteOrder byteOrder() const
AudioParameters & operator=(const AudioParameters &p)
int validBitsPerSample() const
static int bitsPerSample(Qmmp::AudioFormat format)
quint32 sampleRate() const
static int sampleSize(Qmmp::AudioFormat format)
int channels() const
bool operator==(const AudioParameters &p) const
int bitsPerSample() const
int frameSize() const
static Qmmp::AudioFormat findAudioFormat(int bits, ByteOrder byteOrder=LittleEndian)
QString toString() const
static int validBitsPerSample(Qmmp::AudioFormat format)
ByteOrder
Definition audioparameters.h:38
@ LittleEndian
Definition audioparameters.h:39
@ BigEndian
Definition audioparameters.h:40
AudioParameters(quint32 srate, const ChannelMap &map, Qmmp::AudioFormat format)
bool operator!=(const AudioParameters &p) const
int sampleSize() const
const ChannelMap channelMap() const
AudioParameters(const AudioParameters &other)
This class represents audio channel mapping.
Definition channelmap.h:31