QAudioFormat 類

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.

成員類型文檔編製

enum QAudioFormat:: Endian

常量 描述
QAudioFormat::BigEndian QSysInfo::BigEndian samples are big endian byte order
QAudioFormat::LittleEndian QSysInfo::LittleEndian samples are little endian byte order

enum QAudioFormat:: SampleType

常量 描述
QAudioFormat::Unknown 0 不設置
QAudioFormat::SignedInt 1 samples are signed integers
QAudioFormat::UnSignedInt 2 samples are unsigned intergers
QAudioFormat::Float 3 samples are floats

成員函數文檔編製

QAudioFormat:: QAudioFormat ()

構建新的音頻格式。

值的初始化如下:

QAudioFormat:: QAudioFormat (const QAudioFormat & other )

構造新的音頻格式使用 other .

QAudioFormat:: ~QAudioFormat ()

銷毀此音頻格式。

QAudioFormat::Endian QAudioFormat:: byteOrder () const

Returns the current byteOrder value.

另請參閱 setByteOrder ().

int QAudioFormat:: channelCount () const

返迴當前通道計數值。

該函數在 Qt 4.7 引入。

另請參閱 setChannelCount ().

QString QAudioFormat:: codec () const

Returns the current codec value.

另請參閱 setCodec () 和 QAudioDeviceInfo::supportedCodecs ().

bool QAudioFormat:: isValid () const

Returns true if all of the parameters are valid.

int QAudioFormat:: sampleRate () const

返迴當前采樣率 (以赫茲為單位)。

該函數在 Qt 4.7 引入。

另請參閱 setSampleRate ().

int QAudioFormat:: sampleSize () const

Returns the current sample size value.

另請參閱 setSampleSize ().

QAudioFormat::SampleType QAudioFormat:: sampleType () const

返迴當前 SampleType 值。

另請參閱 setSampleType ().

void QAudioFormat:: setByteOrder ( QAudioFormat::Endian byteOrder )

設置 byteOrder to byteOrder .

另請參閱 byteOrder ().

void QAudioFormat:: setChannelCount ( int channels )

將通道計數設為 channels .

該函數在 Qt 4.7 引入。

另請參閱 channelCount ().

void QAudioFormat:: setCodec (const QString & codec )

將編解碼器設為 codec .

另請參閱 codec () 和 QAudioDeviceInfo::supportedCodecs ().

void QAudioFormat:: setSampleRate ( int samplerate )

Sets the sample rate to samplerate Hertz.

該函數在 Qt 4.7 引入。

另請參閱 sampleRate ().

void QAudioFormat:: setSampleSize ( int sampleSize )

Sets the sample size to the sampleSize 指定。

另請參閱 sampleSize ().

void QAudioFormat:: setSampleType ( QAudioFormat::SampleType sampleType )

設置 sampleType to sampleType .

另請參閱 sampleType ().

bool QAudioFormat:: operator!= (const QAudioFormat & other ) const

返迴 true,若此 QAudioFormat is not equal to the other QAudioFormat ;否則返迴 false。

All elements of QAudioFormat are used for the comparison.

QAudioFormat & QAudioFormat:: operator= (const QAudioFormat & other )

賦值 other 到此 QAudioFormat 實現。

bool QAudioFormat:: operator== (const QAudioFormat & other ) const

返迴 true,若此 QAudioFormat is equal to the other QAudioFormat ;否則返迴 false。

All elements of QAudioFormat are used for the comparison.