
We bake cookies in your browser for a better experience. Using this site means that you consent.Read More
TheQAudioFormat class stores audio parameter information.More...
| Header: | #include <QAudioFormat> |
| Since: | Qt 4.6 |
| 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 |
TheQAudioFormat 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 thecodec() 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 inQAudioDeviceInfo. This class also lets you query available parameter values for a device, so that you can set the parameters yourself. See theQAudioDeviceInfo 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:
codec() = ""Construct a new audio format usingother.
Destroy this audio format.
Returns the current byteOrder value.
See alsosetByteOrder().
Returns the current channel count value.
This function was introduced in Qt 4.7.
See alsosetChannelCount().
Returns the current codec value.
See alsosetCodec() andQAudioDeviceInfo::supportedCodecs().
Returns true if all of the parameters are valid.
Returns the current sample rate in Hertz.
This function was introduced in Qt 4.7.
See alsosetSampleRate().
Returns the current sample size value.
See alsosetSampleSize().
Returns the currentSampleType value.
See alsosetSampleType().
Sets thebyteOrder tobyteOrder.
See alsobyteOrder().
Sets the channel count tochannels.
This function was introduced in Qt 4.7.
See alsochannelCount().
Sets the codec tocodec.
See alsocodec() andQAudioDeviceInfo::supportedCodecs().
Sets the sample rate tosamplerate Hertz.
This function was introduced in Qt 4.7.
See alsosampleRate().
Sets the sample size to thesampleSize specified.
See alsosampleSize().
Sets thesampleType tosampleType.
See alsosampleType().
Returns true if thisQAudioFormat is not equal to theotherQAudioFormat; otherwise returns false.
All elements ofQAudioFormat are used for the comparison.
Assignsother to thisQAudioFormat implementation.
Returns true if thisQAudioFormat is equal to theotherQAudioFormat; otherwise returns false.
All elements ofQAudioFormat are used for the comparison.
© 2016 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of theGNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.