QAudioBuffer¶
The QAudioBuffer
class represents a collection of audio samples with a specific format and sample rate. More…

Synopsis¶
Functions¶
def
byteCount
()def
duration
()def
format
()def
frameCount
()def
isValid
()def
sampleCount
()def
startTime
()def
swap
(other)
Detailed Description¶
QAudioBuffer
is used by the QAudioDecoder
class to hand decoded audio data over to the application. An audio buffer contains data in a certain QAudioFormat
that can be queried using format()
. It is also tagged with timing and duration information.
To access the data stored inside the buffer, use the data()
or constData()
methods.
Audio buffers are explicitly shared, in most cases, you should call detach()
before modifying the data.
- class PySide6.QtMultimedia.QAudioBuffer¶
PySide6.QtMultimedia.QAudioBuffer(other)
PySide6.QtMultimedia.QAudioBuffer(data, format[, startTime=-1])
PySide6.QtMultimedia.QAudioBuffer(numFrames, format[, startTime=-1])
- Parameters
data –
PySide6.QtCore.QByteArray
numFrames – int
startTime – int
format –
PySide6.QtMultimedia.QAudioFormat
Create a new, empty, invalid buffer.
- PySide6.QtMultimedia.QAudioBuffer.byteCount()¶
- Return type
qsizetype
Returns the size of this buffer, in bytes.
- PySide6.QtMultimedia.QAudioBuffer.duration()¶
- Return type
int
Returns the duration of audio in this buffer, in microseconds.
This depends on the format()
, and the frameCount()
.
- PySide6.QtMultimedia.QAudioBuffer.format()¶
- Return type
Returns the format
of this buffer.
Several properties of this format influence how the duration()
or byteCount()
are calculated from the frameCount()
.
- PySide6.QtMultimedia.QAudioBuffer.frameCount()¶
- Return type
qsizetype
Returns the number of complete audio frames in this buffer.
An audio frame is an interleaved set of one sample per channel for the same instant in time.
- PySide6.QtMultimedia.QAudioBuffer.isValid()¶
- Return type
bool
Returns true if this is a valid buffer. A valid buffer has more than zero frames in it and a valid format.
- PySide6.QtMultimedia.QAudioBuffer.sampleCount()¶
- Return type
qsizetype
Returns the number of samples in this buffer.
If the format of this buffer has multiple channels, then this count includes all channels. This means that a stereo buffer with 1000 samples in total will have 500 left samples and 500 right samples (interleaved), and this function will return 1000.
See also
- PySide6.QtMultimedia.QAudioBuffer.startTime()¶
- Return type
int
Returns the time in a stream that this buffer starts at (in microseconds).
If this buffer is not part of a stream, this will return -1.
- PySide6.QtMultimedia.QAudioBuffer.swap(other)¶
- Parameters
© 2021 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 the GNU 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.