Home · All Classes · All Functions · Overviews

QAudioFormat Class Reference
[
QtMultimedia module]

The QAudioFormat class stores audio parameter information. More...

 #include <QAudioFormat>

This class is not part of the Qt GUI Framework Edition.

This class was introduced in Qt 4.6.


Public Types

enum Endian { BigEndian, LittleEndian }
enum SampleType { Unknown, SignedInt, UnSignedInt, Float }

Public Functions

QAudioFormat ()
QAudioFormat ( const QAudioFormat & other )
~QAudioFormat ()
QAudioFormat::Endian byteOrder () const
int channels () const
QString codec () const
int frequency () const
bool isValid () const
int sampleSize () const
QAudioFormat::SampleType sampleType () const
void setByteOrder ( QAudioFormat::Endian byteOrder )
void setChannels ( int channels )
void setCodec ( const QString & codec )
void setFrequency ( int frequency )
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

Detailed Description

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.

ParameterDescription
FrequencySamples per second of audio data in Hertz.
Number of channelsThe number of audio channels (typically one for mono or two for stereo)
Sample sizeHow much data is stored in each sample (typically 8 or 16)
Sample typeNumerical representation of sample (typically signed integer, unsigned integer or float)
Byte orderByte 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.


Member Type Documentation

enum QAudioFormat::Endian

ConstantValueDescription
QAudioFormat::BigEndianQSysInfo::BigEndiansamples are big endian byte order
QAudioFormat::LittleEndianQSysInfo::LittleEndiansamples are little endian byte order

enum QAudioFormat::SampleType

ConstantValueDescription
QAudioFormat::Unknown0Not Set
QAudioFormat::SignedInt1samples are signed integers
QAudioFormat::UnSignedInt2samples are unsigned intergers
QAudioFormat::Float3samples are floats


Member Function Documentation

QAudioFormat::QAudioFormat ()

Construct a new audio format.

Values are initialized as follows:

QAudioFormat::QAudioFormat ( const QAudioFormat & other )

Construct a new audio format using other.

QAudioFormat::~QAudioFormat ()

Destroy this audio format.

QAudioFormat::Endian QAudioFormat::byteOrder () const

Returns the current byteOrder value.

See also setByteOrder().

int QAudioFormat::channels () const

Returns the current channel value.

See also setChannels().

QString QAudioFormat::codec () const

Returns the current codec value.

See also setCodec() and QAudioDeviceInfo::supportedCodecs().

int QAudioFormat::frequency () const

Returns the current frequency value.

See also setFrequency().

bool QAudioFormat::isValid () const

Returns true if all of the parameters are valid.

int QAudioFormat::sampleSize () const

Returns the current sampleSize value.

See also setSampleSize().

QAudioFormat::SampleType QAudioFormat::sampleType () const

Returns the current SampleType value.

See also setSampleType().

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

Sets the byteOrder to byteOrder.

See also byteOrder().

void QAudioFormat::setChannels ( int channels )

Sets the channels to channels.

See also channels().

void QAudioFormat::setCodec ( const QString & codec )

Sets the codec to codec.

See also codec() and QAudioDeviceInfo::supportedCodecs().

void QAudioFormat::setFrequency ( int frequency )

Sets the frequency to frequency.

See also frequency().

void QAudioFormat::setSampleSize ( int sampleSize )

Sets the sampleSize to sampleSize.

See also sampleSize().

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

Sets the sampleType to sampleType.

See also sampleType().

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.

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

Assigns other to this QAudioFormat implementation.

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.


Copyright © 2009 Nokia Corporation and/or its subsidiary(-ies) Trademarks
Qt 4.6.0