The QAudioFormat class stores audio parameter information. 更多...
| 头: | #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 |
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.
除编码外, 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.
| 参数 | 描述 |
|---|---|
| 采样率 | Samples per second of audio data in Hertz. |
| 通道数 | The number of audio channels (typically one for mono or two for stereo) |
| 采样大小 | How much data is stored in each sample (typically 8 or 16 bits) |
| 采样类型 | Numerical representation of sample (typically signed integer, unsigned integer or float) |
| 字节序 | 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.
| 常量 | 值 | 描述 |
|---|---|---|
QAudioFormat::BigEndian
|
QSysInfo::BigEndian
|
samples are big endian byte order |
QAudioFormat::LittleEndian
|
QSysInfo::LittleEndian
|
samples are little endian byte order |
| 常量 | 值 | 描述 |
|---|---|---|
QAudioFormat::Unknown
|
0
|
不设置 |
QAudioFormat::SignedInt
|
1
|
samples are signed integers |
QAudioFormat::UnSignedInt
|
2
|
samples are unsigned intergers |
QAudioFormat::Float
|
3
|
samples are floats |
构建新的音频格式。
值的初始化如下:
codec()
= ""
构造新的音频格式使用 other .
销毁此音频格式。
Returns the current byteOrder value.
另请参阅 setByteOrder ().
返回当前通道计数值。
该函数在 Qt 4.7 引入。
另请参阅 setChannelCount ().
Returns the current codec value.
另请参阅 setCodec () 和 QAudioDeviceInfo::supportedCodecs ().
Returns true if all of the parameters are valid.
返回当前采样率 (以赫兹为单位)。
该函数在 Qt 4.7 引入。
另请参阅 setSampleRate ().
Returns the current sample size value.
另请参阅 setSampleSize ().
返回当前 SampleType 值。
另请参阅 setSampleType ().
设置 byteOrder to byteOrder .
另请参阅 byteOrder ().
将通道计数设为 channels .
该函数在 Qt 4.7 引入。
另请参阅 channelCount ().
将编解码器设为 codec .
另请参阅 codec () 和 QAudioDeviceInfo::supportedCodecs ().
Sets the sample rate to samplerate Hertz.
该函数在 Qt 4.7 引入。
另请参阅 sampleRate ().
Sets the sample size to the sampleSize 指定。
另请参阅 sampleSize ().
设置 sampleType to sampleType .
另请参阅 sampleType ().
返回 true,若此 QAudioFormat is not equal to the other QAudioFormat ;否则返回 false。
All elements of QAudioFormat are used for the comparison.
赋值 other 到此 QAudioFormat 实现。
返回 true,若此 QAudioFormat is equal to the other QAudioFormat ;否则返回 false。
All elements of QAudioFormat are used for the comparison.