TTKMusicPlayer  3.7.0.0
TTKMusicPlayer imitates Kugou UI, the music player uses of qmmp core library based on Qt for windows and linux
Public Types | Public Member Functions | Static Public Member Functions | Private Attributes | List of all members
AudioParameters Class Reference

The AudioParameters class keeps information about audio settings. More...

#include <audioparameters.h>

Public Types

enum  ByteOrder { LittleEndian = 0, BigEndian }
 

Public Member Functions

 AudioParameters ()=default
 
 AudioParameters (quint32 srate, const ChannelMap &map, Qmmp::AudioFormat format)
 
 AudioParameters (const AudioParameters &other)
 
AudioParametersoperator= (const AudioParameters &p)
 
bool operator== (const AudioParameters &p) const
 
bool operator!= (const AudioParameters &p) const
 
quint32 sampleRate () const
 
int channels () const
 
const ChannelMapchannelMap () const
 
Qmmp::AudioFormat format () const
 
int sampleSize () const
 
int frameSize () const
 
int bitsPerSample () const
 
int validBitsPerSample () const
 
ByteOrder byteOrder () const
 
QString toString () const
 

Static Public Member Functions

static int sampleSize (Qmmp::AudioFormat format)
 
static int bitsPerSample (Qmmp::AudioFormat format)
 
static int validBitsPerSample (Qmmp::AudioFormat format)
 
static Qmmp::AudioFormat findAudioFormat (int bits, ByteOrder byteOrder=LittleEndian)
 

Private Attributes

quint32 m_srate = 0
 
ChannelMap m_chan_map
 
Qmmp::AudioFormat m_format = Qmmp::PCM_S16LE
 
int m_sz = 2
 
int m_precision = 16
 

Detailed Description

The AudioParameters class keeps information about audio settings.

Author
Ilya Kotov forko.nosp@m.tov0.nosp@m.2@ya..nosp@m.ru

Definition at line 29 of file audioparameters.h.

Member Enumeration Documentation

Byte order of samples.

Enumerator
LittleEndian 

Samples are in little-endian byte order

BigEndian 

Samples are in big-endian byte order

Definition at line 35 of file audioparameters.h.

Constructor & Destructor Documentation

AudioParameters::AudioParameters ( )
default

Constructor.

AudioParameters::AudioParameters ( quint32  srate,
const ChannelMap map,
Qmmp::AudioFormat  format 
)

Constructs audio settings with the given parameters.

Parameters
srateSampling rate.
mapChannel map.
formatPCM data format.
AudioParameters::AudioParameters ( const AudioParameters other)

Constructs a copy of other.

Member Function Documentation

int AudioParameters::bitsPerSample ( ) const

Returns sample size in bits.

static int AudioParameters::bitsPerSample ( Qmmp::AudioFormat  format)
static

Returns sample size in bits of the given pcm data format.

ByteOrder AudioParameters::byteOrder ( ) const

Returns byte order for selected audio format.

const ChannelMap& AudioParameters::channelMap ( ) const

Returns channel map.

int AudioParameters::channels ( ) const

Returns number of channels.

static Qmmp::AudioFormat AudioParameters::findAudioFormat ( int  bits,
ByteOrder  byteOrder = LittleEndian 
)
static

Find audio format by number of bits and byte order. Returns Qmmp::UNKNOWN if format is not found.

Parameters
bitsNumber of used bits in the sample (precision).
byteOrderByte order.
Qmmp::AudioFormat AudioParameters::format ( ) const

Returns pcm format.

int AudioParameters::frameSize ( ) const

Returns the number of bytes required to represent one frame (a sample in each channel) in this format.

bool AudioParameters::operator!= ( const AudioParameters p) const

Returns true if parameters p is not equal to this parameters; otherwise returns false.

AudioParameters& AudioParameters::operator= ( const AudioParameters p)

Assigns audio parameters p to this parameters.

bool AudioParameters::operator== ( const AudioParameters p) const

Returns true if parameters p is equal to this parameters; otherwise returns false.

quint32 AudioParameters::sampleRate ( ) const

Returns sample rate in Hz.

int AudioParameters::sampleSize ( ) const

Returns sample size in bytes.

static int AudioParameters::sampleSize ( Qmmp::AudioFormat  format)
static

Returns sample size in bytes of the given pcm data format.

QString AudioParameters::toString ( ) const

Returns string represention of the audio parameters. May be useful for debug purposes.

int AudioParameters::validBitsPerSample ( ) const

Returns the number of used bits in the sample. The value shoud be less or equal to the value returned by bitsPerSample().

static int AudioParameters::validBitsPerSample ( Qmmp::AudioFormat  format)
static

Returns the number of used bits in the sample of the given pcm data format.

Member Data Documentation

ChannelMap AudioParameters::m_chan_map
private

Definition at line 135 of file audioparameters.h.

Qmmp::AudioFormat AudioParameters::m_format = Qmmp::PCM_S16LE
private

Definition at line 136 of file audioparameters.h.

int AudioParameters::m_precision = 16
private

Definition at line 138 of file audioparameters.h.

quint32 AudioParameters::m_srate = 0
private

Definition at line 134 of file audioparameters.h.

int AudioParameters::m_sz = 2
private

Definition at line 137 of file audioparameters.h.


The documentation for this class was generated from the following file: