Movatterモバイル変換


[0]ホーム

URL:


We bake cookies in your browser for a better experience. Using this site means that you consent.Read More

Menu

Qt Documentation

QAudioFormat Class

TheQAudioFormat class stores audio parameter information.More...

Header:#include <QAudioFormat>
Since: Qt 4.6

Public Types

enumEndian { BigEndian, LittleEndian }
enumSampleType { Unknown, SignedInt, UnSignedInt, Float }

Public Functions

QAudioFormat()
QAudioFormat(const QAudioFormat & other)
~QAudioFormat()
QAudioFormat::EndianbyteOrder() const
intchannelCount() const
QStringcodec() const
boolisValid() const
intsampleRate() const
intsampleSize() const
QAudioFormat::SampleTypesampleType() const
voidsetByteOrder(QAudioFormat::Endian byteOrder)
voidsetChannelCount(int channels)
voidsetCodec(const QString & codec)
voidsetSampleRate(int samplerate)
voidsetSampleSize(int sampleSize)
voidsetSampleType(QAudioFormat::SampleType sampleType)
booloperator!=(const QAudioFormat & other) const
QAudioFormat &operator=(const QAudioFormat & other)
booloperator==(const QAudioFormat & other) const

Detailed Description

TheQAudioFormat 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 thecodec() 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
Sample RateSamples 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 inQAudioDeviceInfo. This class also lets you query available parameter values for a device, so that you can set the parameters yourself. See theQAudioDeviceInfo 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(constQAudioFormat & other)

Construct a new audio format usingother.

QAudioFormat::~QAudioFormat()

Destroy this audio format.

QAudioFormat::Endian QAudioFormat::byteOrder() const

Returns the current byteOrder value.

See alsosetByteOrder().

int QAudioFormat::channelCount() const

Returns the current channel count value.

This function was introduced in Qt 4.7.

See alsosetChannelCount().

QString QAudioFormat::codec() const

Returns the current codec value.

See alsosetCodec() andQAudioDeviceInfo::supportedCodecs().

bool QAudioFormat::isValid() const

Returns true if all of the parameters are valid.

int QAudioFormat::sampleRate() const

Returns the current sample rate in Hertz.

This function was introduced in Qt 4.7.

See alsosetSampleRate().

int QAudioFormat::sampleSize() const

Returns the current sample size value.

See alsosetSampleSize().

QAudioFormat::SampleType QAudioFormat::sampleType() const

Returns the currentSampleType value.

See alsosetSampleType().

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

Sets thebyteOrder tobyteOrder.

See alsobyteOrder().

void QAudioFormat::setChannelCount(int channels)

Sets the channel count tochannels.

This function was introduced in Qt 4.7.

See alsochannelCount().

void QAudioFormat::setCodec(constQString & codec)

Sets the codec tocodec.

See alsocodec() andQAudioDeviceInfo::supportedCodecs().

void QAudioFormat::setSampleRate(int samplerate)

Sets the sample rate tosamplerate Hertz.

This function was introduced in Qt 4.7.

See alsosampleRate().

void QAudioFormat::setSampleSize(int sampleSize)

Sets the sample size to thesampleSize specified.

See alsosampleSize().

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

Sets thesampleType tosampleType.

See alsosampleType().

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

Returns true if thisQAudioFormat is not equal to theotherQAudioFormat; otherwise returns false.

All elements ofQAudioFormat are used for the comparison.

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

Assignsother to thisQAudioFormat implementation.

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

Returns true if thisQAudioFormat is equal to theotherQAudioFormat; otherwise returns false.

All elements ofQAudioFormat are used for the comparison.

© 2016 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of theGNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.


[8]ページ先頭

©2009-2025 Movatter.jp