The QAudioFormat class stores audio parameter information. More...
#include <QAudioFormat>
This class was introduced in Qt Mobility 1.0.
enum | Endian { BigEndian, LittleEndian } |
enum | SampleType { Unknown, SignedInt, UnSignedInt, Float } |
QAudioFormat () | |
QAudioFormat ( const QAudioFormat & other ) | |
~QAudioFormat () | |
QAudioFormat::Endian | byteOrder () const |
int | channelCount () const |
QString | codec () const |
bool | isValid () const |
int | sampleRate () const |
int | sampleSize () const |
QAudioFormat::SampleType | sampleType () const |
void | setByteOrder ( QAudioFormat::Endian byteOrder ) |
void | setChannelCount ( int channels ) |
void | setCodec ( const QString & codec ) |
void | setSampleRate ( int samplerate ) |
void | setSampleSize ( int sampleSize ) |
void | setSampleType ( QAudioFormat::SampleType sampleType ) |
bool | operator!= ( const QAudioFormat & other ) const |
QAudioFormat & | operator= ( const QAudioFormat & other ) |
bool | operator== ( const QAudioFormat & other ) const |
The QAudioFormat class stores audio parameter information.
An audio format specifies how data in an audio stream is arranged, i.e, how the stream is to be interpreted. The encoding itself is specified by the codec() used for the stream.
In addition to the encoding, QAudioFormat contains other parameters that further specify how the audio data is arranged. These are the frequency, the number of channels, the sample size, the sample type, and the byte order. The following table describes these in more detail.
Parameter | Description |
---|---|
Sample Rate | Samples per second of audio data in Hertz. |
Number of channels | The number of audio channels (typically one for mono or two for stereo) |
Sample size | How much data is stored in each sample (typically 8 or 16 bits) |
Sample type | Numerical representation of sample (typically signed integer, unsigned integer or float) |
Byte order | Byte ordering of sample (typically little endian, big endian) |
You can obtain audio formats compatible with the audio device used through functions in QAudioDeviceInfo. This class also lets you query available parameter values for a device, so that you can set the parameters yourself. See the QAudioDeviceInfo class description for details. You need to know the format of the audio streams you wish to play. Qt does not set up formats for you.
Constant | Value | Description |
---|---|---|
QAudioFormat::BigEndian | QSysInfo::BigEndian | samples are big endian byte order |
QAudioFormat::LittleEndian | QSysInfo::LittleEndian | samples are little endian byte order |
Constant | Value | Description |
---|---|---|
QAudioFormat::Unknown | 0 | Not Set |
QAudioFormat::SignedInt | 1 | samples are signed integers |
QAudioFormat::UnSignedInt | 2 | samples are unsigned intergers |
QAudioFormat::Float | 3 | samples are floats |
Construct a new audio format.
Values are initialized as follows:
Construct a new audio format using other.
This function was introduced in Qt Mobility 1.0.
Destroy this audio format.
Returns the current byteOrder value.
This function was introduced in Qt Mobility 1.0.
See also setByteOrder().
Returns the current channel count value.
This function was introduced in Qt Mobility 1.0.
See also setChannelCount().
Returns the current codec value.
This function was introduced in Qt Mobility 1.0.
See also setCodec() and QAudioDeviceInfo::supportedCodecs().
Returns true if all of the parameters are valid.
This function was introduced in Qt Mobility 1.0.
Returns the current sample rate in Hertz.
This function was introduced in Qt Mobility 1.0.
See also setSampleRate().
Returns the current sample size value.
This function was introduced in Qt Mobility 1.0.
See also setSampleSize().
Returns the current SampleType value.
This function was introduced in Qt Mobility 1.0.
See also setSampleType().
Sets the byteOrder to byteOrder.
This function was introduced in Qt Mobility 1.0.
See also byteOrder().
Sets the channel count to channels.
This function was introduced in Qt Mobility 1.0.
See also channelCount().
Sets the codec to codec.
This function was introduced in Qt Mobility 1.0.
See also codec() and QAudioDeviceInfo::supportedCodecs().
Sets the sample rate to samplerate Hertz.
This function was introduced in Qt Mobility 1.0.
See also sampleRate().
Sets the sample size to the sampleSize specified.
This function was introduced in Qt Mobility 1.0.
See also sampleSize().
Sets the sampleType to sampleType.
This function was introduced in Qt Mobility 1.0.
See also sampleType().
Returns true if this QAudioFormat is not equal to the other QAudioFormat; otherwise returns false.
All elements of QAudioFormat are used for the comparison.
This function was introduced in Qt Mobility 1.0.
Assigns other to this QAudioFormat implementation.
This function was introduced in Qt Mobility 1.0.
Returns true if this QAudioFormat is equal to the other QAudioFormat; otherwise returns false.
All elements of QAudioFormat are used for the comparison.
This function was introduced in Qt Mobility 1.0.
© 2008-2011 Nokia Corporation and/or its subsidiaries. Nokia, Qt and their respective logos are trademarks of Nokia Corporation in Finland and/or other countries worldwide.
All other trademarks are property of their respective owners. Privacy Policy
Licensees holding valid Qt Commercial licenses may use this document in accordance with the Qt Commercial License Agreement provided with the Software or, alternatively, in accordance with the terms contained in a written agreement between you and Nokia.
Alternatively, this document may be used under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation.