内容表

上一话题

QAudio

下一话题

QAudioDecoder

QAudioBuffer

QAudioBuffer class represents a collection of audio samples with a specific format and sample rate. 更多

Inheritance diagram of PySide2.QtMultimedia.QAudioBuffer

概要

详细描述

class QAudioBuffer

QAudioBuffer(other)

QAudioBuffer(data, format[, startTime=-1])

QAudioBuffer(numFrames, format[, startTime=-1])

param format

QAudioFormat

param other

QAudioBuffer

param startTime

qint64

param data

QByteArray

param numFrames

int

创建新的、空无效缓冲。

PySide2.QtMultimedia.QAudioBuffer. byteCount ( )
返回类型

int

Returns the size of this buffer, in bytes.

PySide2.QtMultimedia.QAudioBuffer. constData ( )
返回类型

void

Returns a pointer to this buffer’s data. You can only read it.

This method is preferred over the const version of data() to prevent unnecessary copying.

There is also a templatized version of this function that allows you to retrieve a specific type of read-only pointer to the data. Note that there is no checking done on the format of the audio buffer - this is simply a convenience function.

// With a 16bit sample buffer:
const quint16 *data = buffer->constData<quint16>();
											
PySide2.QtMultimedia.QAudioBuffer. data ( )
返回类型

void

Returns a pointer to this buffer’s data. You can only read it.

You should use the constData() function rather than this to prevent accidental deep copying.

There is also a templatized version of this function that allows you to retrieve a specific type of read-only pointer to the data. Note that there is no checking done on the format of the audio buffer - this is simply a convenience function.

// With a 16bit sample const buffer:
const quint16 *data = buffer->data<quint16>();
											
PySide2.QtMultimedia.QAudioBuffer. duration ( )
返回类型

qint64

Returns the duration of audio in this buffer, in microseconds.

This depends on the format() ,和 frameCount() .

PySide2.QtMultimedia.QAudioBuffer. format ( )
返回类型

QAudioFormat

返回 format of this buffer.

Several properties of this format influence how the duration() or byteCount() are calculated from the frameCount() .

PySide2.QtMultimedia.QAudioBuffer. frameCount ( )
返回类型

int

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.

PySide2.QtMultimedia.QAudioBuffer. isValid ( )
返回类型

bool

Returns true if this is a valid buffer. A valid buffer has more than zero frames in it and a valid format.

PySide2.QtMultimedia.QAudioBuffer. sampleCount ( )
返回类型

int

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.

另请参阅

frameCount()

PySide2.QtMultimedia.QAudioBuffer. startTime ( )
返回类型

qint64

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.