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.