Qt 4.8
|
The QAudioFormat class stores audio parameter information. More...
#include <qaudioformat.h>
Public Types | |
enum | Endian { BigEndian = QSysInfo::BigEndian, LittleEndian = QSysInfo::LittleEndian } |
enum | SampleType { Unknown, SignedInt, UnSignedInt, Float } |
Public Functions | |
QAudioFormat::Endian | byteOrder () const |
Returns the current byteOrder value. More... | |
int | channelCount () const |
Returns the current channel count value. More... | |
int | channels () const |
Use channelCount() instead. More... | |
QString | codec () const |
Returns the current codec value. More... | |
int | frequency () const |
Use sampleRate() instead. More... | |
bool | isValid () const |
Returns true if all of the parameters are valid. More... | |
bool | operator!= (const QAudioFormat &other) const |
Returns true if this QAudioFormat is not equal to the other QAudioFormat; otherwise returns false. More... | |
QAudioFormat & | operator= (const QAudioFormat &other) |
Assigns other to this QAudioFormat implementation. More... | |
bool | operator== (const QAudioFormat &other) const |
Returns true if this QAudioFormat is equal to the other QAudioFormat; otherwise returns false. More... | |
QAudioFormat () | |
Construct a new audio format. More... | |
QAudioFormat (const QAudioFormat &other) | |
Construct a new audio format using other. More... | |
int | sampleRate () const |
Returns the current sample rate in Hertz. More... | |
int | sampleSize () const |
Returns the current sample size value. More... | |
QAudioFormat::SampleType | sampleType () const |
Returns the current SampleType value. More... | |
void | setByteOrder (QAudioFormat::Endian byteOrder) |
Sets the byteOrder to byteOrder. More... | |
void | setChannelCount (int channelCount) |
Sets the channel count to channels. More... | |
void | setChannels (int channels) |
Use setChannelCount() instead. More... | |
void | setCodec (const QString &codec) |
Sets the codec to codec. More... | |
void | setFrequency (int frequency) |
Use setSampleRate() instead. More... | |
void | setSampleRate (int sampleRate) |
Sets the sample rate to samplerate Hertz. More... | |
void | setSampleSize (int sampleSize) |
Sets the sample size to the sampleSize specified. More... | |
void | setSampleType (QAudioFormat::SampleType sampleType) |
Sets the sampleType to sampleType. More... | |
~QAudioFormat () | |
Destroy this audio format. More... | |
Properties | |
QSharedDataPointer< QAudioFormatPrivate > | d |
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.
Definition at line 60 of file qaudioformat.h.
enum QAudioFormat::Endian |
Enumerator | |
---|---|
BigEndian | |
LittleEndian |
Definition at line 64 of file qaudioformat.h.
Enumerator | |
---|---|
Unknown | |
SignedInt | |
UnSignedInt | |
Float |
Definition at line 63 of file qaudioformat.h.
QAudioFormat::QAudioFormat | ( | ) |
Construct a new audio format.
Values are initialized as follows:
codec()
= "" Definition at line 158 of file qaudioformat.cpp.
QAudioFormat::QAudioFormat | ( | const QAudioFormat & | other | ) |
QAudioFormat::~QAudioFormat | ( | ) |
QAudioFormat::Endian QAudioFormat::byteOrder | ( | ) | const |
Returns the current byteOrder value.
Definition at line 382 of file qaudioformat.cpp.
Referenced by QAudioOutputPrivate::freeBlocks(), operator<<(), QAudioDeviceInfoInternal::QAudioDeviceInfoInternal(), setByteOrder(), QAudioInputPrivate::setFormat(), QAudioOutputPrivate::setFormat(), QAudioDeviceInfoInternal::testSettings(), and toAudioStreamBasicDescription().
int QAudioFormat::channelCount | ( | ) | const |
int QAudioFormat::channels | ( | ) | const |
Use channelCount() instead.
Definition at line 324 of file qaudioformat.cpp.
Referenced by QAudioOutputPrivate::freeBlocks(), QAudioInputPrivate::freeBlocks(), QAudioInputPrivate::open(), QAudioOutputPrivate::open(), operator<<(), QAudioInputPrivate::processedUSecs(), QAudioDeviceInfoInternal::QAudioDeviceInfoInternal(), QtMultimediaInternal::QAudioOutputBuffer::QAudioOutputBuffer(), setChannelCount(), setChannels(), QAudioDeviceInfoInternal::testSettings(), and toAudioStreamBasicDescription().
QString QAudioFormat::codec | ( | ) | const |
Returns the current codec value.
Definition at line 364 of file qaudioformat.cpp.
Referenced by operator<<(), QAudioDeviceInfoInternal::QAudioDeviceInfoInternal(), setCodec(), and QAudioDeviceInfoInternal::testSettings().
int QAudioFormat::frequency | ( | ) | const |
Use sampleRate() instead.
Definition at line 274 of file qaudioformat.cpp.
Referenced by QAudioOutputPrivate::freeBlocks(), QAudioInputPrivate::freeBlocks(), QAudioDeviceInfo::nearestFormat(), QAudioInputPrivate::open(), QAudioOutputPrivate::open(), operator<<(), QAudioInputPrivate::processedUSecs(), QAudioOutputPrivate::processedUSecs(), QAudioDeviceInfoInternal::QAudioDeviceInfoInternal(), QtMultimediaInternal::QAudioOutputBuffer::QAudioOutputBuffer(), setFrequency(), QAudioDeviceInfoInternal::testSettings(), and toAudioStreamBasicDescription().
bool QAudioFormat::isValid | ( | ) | const |
Returns true if all of the parameters are valid.
Definition at line 223 of file qaudioformat.cpp.
Referenced by QAudioOutputPrivate::freeBlocks(), QAudioInputPrivate::freeBlocks(), QAudioInputPrivate::open(), QAudioOutputPrivate::open(), and QAudioDeviceInfoInternal::QAudioDeviceInfoInternal().
bool QAudioFormat::operator!= | ( | const QAudioFormat & | other | ) | const |
Returns true if this QAudioFormat is not equal to the other QAudioFormat; otherwise returns false.
All elements of QAudioFormat are used for the comparison.
Definition at line 214 of file qaudioformat.cpp.
QAudioFormat & QAudioFormat::operator= | ( | const QAudioFormat & | other | ) |
bool QAudioFormat::operator== | ( | const QAudioFormat & | other | ) | const |
Returns true if this QAudioFormat is equal to the other QAudioFormat; otherwise returns false.
All elements of QAudioFormat are used for the comparison.
Definition at line 197 of file qaudioformat.cpp.
int QAudioFormat::sampleRate | ( | ) | const |
int QAudioFormat::sampleSize | ( | ) | const |
Returns the current sample size value.
Definition at line 342 of file qaudioformat.cpp.
Referenced by QAudioOutputPrivate::freeBlocks(), QAudioInputPrivate::freeBlocks(), QAudioDeviceInfo::nearestFormat(), operator<<(), QAudioInputPrivate::processedUSecs(), QAudioDeviceInfoInternal::QAudioDeviceInfoInternal(), QtMultimediaInternal::QAudioOutputBuffer::QAudioOutputBuffer(), QAudioInputPrivate::setFormat(), QAudioOutputPrivate::setFormat(), setSampleSize(), QAudioDeviceInfoInternal::testSettings(), and toAudioStreamBasicDescription().
QAudioFormat::SampleType QAudioFormat::sampleType | ( | ) | const |
Returns the current SampleType value.
Definition at line 400 of file qaudioformat.cpp.
Referenced by QAudioDeviceInfo::nearestFormat(), operator<<(), QAudioDeviceInfoInternal::QAudioDeviceInfoInternal(), QAudioInputPrivate::setFormat(), QAudioOutputPrivate::setFormat(), setSampleType(), QAudioDeviceInfoInternal::testSettings(), and toAudioStreamBasicDescription().
void QAudioFormat::setByteOrder | ( | QAudioFormat::Endian | byteOrder | ) |
Sets the byteOrder to byteOrder.
Definition at line 373 of file qaudioformat.cpp.
Referenced by QAudioDeviceInfoInternal::preferredFormat(), QAudioDeviceInfoInternal::QAudioDeviceInfoInternal(), and toQAudioFormat().
void QAudioFormat::setChannelCount | ( | int | channels | ) |
Sets the channel count to channels.
Definition at line 285 of file qaudioformat.cpp.
void QAudioFormat::setChannels | ( | int | channels | ) |
Use setChannelCount() instead.
Definition at line 299 of file qaudioformat.cpp.
Referenced by QAudioDeviceInfoInternal::preferredFormat(), QAudioDeviceInfoInternal::QAudioDeviceInfoInternal(), and toQAudioFormat().
void QAudioFormat::setCodec | ( | const QString & | codec | ) |
Sets the codec to codec.
Definition at line 353 of file qaudioformat.cpp.
Referenced by QAudioDeviceInfo::nearestFormat(), QAudioDeviceInfoInternal::preferredFormat(), QAudioDeviceInfoInternal::QAudioDeviceInfoInternal(), and toQAudioFormat().
void QAudioFormat::setFrequency | ( | int | frequency | ) |
Use setSampleRate() instead.
Definition at line 249 of file qaudioformat.cpp.
Referenced by QAudioDeviceInfo::nearestFormat(), QAudioDeviceInfoInternal::preferredFormat(), QAudioDeviceInfoInternal::QAudioDeviceInfoInternal(), and toQAudioFormat().
void QAudioFormat::setSampleRate | ( | int | samplerate | ) |
void QAudioFormat::setSampleSize | ( | int | sampleSize | ) |
Sets the sample size to the sampleSize specified.
Definition at line 333 of file qaudioformat.cpp.
Referenced by QAudioDeviceInfo::nearestFormat(), QAudioDeviceInfoInternal::preferredFormat(), QAudioDeviceInfoInternal::QAudioDeviceInfoInternal(), and toQAudioFormat().
void QAudioFormat::setSampleType | ( | QAudioFormat::SampleType | sampleType | ) |
Sets the sampleType to sampleType.
Definition at line 391 of file qaudioformat.cpp.
Referenced by QAudioDeviceInfo::nearestFormat(), QAudioDeviceInfoInternal::preferredFormat(), QAudioDeviceInfoInternal::QAudioDeviceInfoInternal(), and toQAudioFormat().
|
private |
Definition at line 99 of file qaudioformat.h.
Referenced by byteOrder(), channelCount(), channels(), codec(), frequency(), isValid(), operator=(), operator==(), sampleRate(), sampleSize(), sampleType(), setByteOrder(), setChannelCount(), setChannels(), setCodec(), setFrequency(), setSampleRate(), setSampleSize(), and setSampleType().