Home · All Classes · Modules

QAudioFormat Class Reference
[QtMultimedia module]

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

Types

Methods

Special Methods


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 bits)
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.


Type Documentation

QAudioFormat.Endian

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

QAudioFormat.SampleType

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


Method Documentation

QAudioFormat.__init__ (self)

Construct a new audio format.

Values are initialized as follows:

QAudioFormat.__init__ (self, QAudioFormat)

Construct a new audio format using other.

Endian QAudioFormat.byteOrder (self)

Returns the current byteOrder value.

See also setByteOrder().

int QAudioFormat.channels (self)

Returns the current channel value.

See also setChannels().

QString QAudioFormat.codec (self)

Returns the current codec value.

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

int QAudioFormat.frequency (self)

Returns the current frequency value.

See also setFrequency().

bool QAudioFormat.isValid (self)

Returns true if all of the parameters are valid.

int QAudioFormat.sampleSize (self)

Returns the current sample size value.

See also setSampleSize().

SampleType QAudioFormat.sampleType (self)

Returns the current SampleType value.

See also setSampleType().

QAudioFormat.setByteOrder (self, Endian)

Sets the byteOrder to byteOrder.

See also byteOrder().

QAudioFormat.setChannels (self, int)

Sets the channels to channels.

See also channels().

QAudioFormat.setCodec (self, QString)

Sets the codec to codec.

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

QAudioFormat.setFrequency (self, int)

Sets the frequency to frequency.

See also frequency().

QAudioFormat.setSampleSize (self, int)

Sets the sample size to the sampleSize specified.

See also sampleSize().

QAudioFormat.setSampleType (self, SampleType)

Sets the sampleType to sampleType.

See also sampleType().

bool QAudioFormat.__eq__ (self, QAudioFormat)

bool QAudioFormat.__ne__ (self, QAudioFormat)


PyQt 4.7.3 for X11Copyright © Riverbank Computing Ltd and Nokia 2010Qt 4.6.2