StereoFrame 类

( QAudioBuffer::StereoFrame )

The StereoFrame class provides a simple wrapper for a stereo audio frame. 更多...

头: #include <StereoFrame>
qmake: QT += multimedia

公共函数

StereoFrame ()
StereoFrame (T leftSample , T rightSample )
T average () const
void clear ()
StereoFrame<T> & operator= (const StereoFrame<T> & other )

公共变量

T left
T right
typedef S16S
typedef S16U
typedef S32F
typedef S8S
typedef S8U

详细描述

The StereoFrame class provides a simple wrapper for a stereo audio frame.

This templatized structure lets you treat a block of individual samples as an interleaved stereo stream frame. This is most useful when used with the templatized data() functions of QAudioBuffer . Generally the data is accessed as a pointer, so no copying should occur.

There are some predefined instantiations of this template for working with common stereo sample depths in a convenient way.

This frame structure has left and right members for accessing individual channel data.

例如:

// Assuming 'buffer' is an unsigned 16 bit stereo buffer..
QAudioBuffer::S16U *frames = buffer->data<QAudioBuffer::S16U>();
for (int i=0; i < buffer->frameCount(); i++) {
    qSwap(frames[i].left, frames[i].right);
}
					

另请参阅 QAudioBuffer::S8U , QAudioBuffer::S8S , QAudioBuffer::S16S , QAudioBuffer::S16U ,和 QAudioBuffer::S32F .

成员函数文档编制

StereoFrame:: StereoFrame ()

Constructs a new frame with the "silent" value for this sample format (0 for signed formats and floats, 0x8* for unsigned formats).

StereoFrame:: StereoFrame ( T leftSample , T rightSample )

Constructs a new frame with the supplied leftSample and rightSample 值。

T StereoFrame:: average () const

Returns the arithmetic average of the left and right samples.

void StereoFrame:: clear ()

Sets the values of this frame to the "silent" value.

StereoFrame < T > &StereoFrame:: operator= (const StereoFrame < T > & other )

赋值 other to this frame.

成员变量文档编制

T StereoFrame:: left

This variable holds the left sample

T StereoFrame:: right

This variable holds the right sample

相关非成员

typedef QAudioBuffer:: S16S

This is a predefined specialization for a signed stereo 16 bit sample. Each channel is a signed short .

typedef QAudioBuffer:: S16U

This is a predefined specialization for an unsigned stereo 16 bit sample. Each channel is an unsigned short .

typedef QAudioBuffer:: S32F

This is a predefined specialization for an 32 bit float sample. Each channel is a float .

typedef QAudioBuffer:: S8S

This is a predefined specialization for a signed stereo 8 bit sample. Each channel is a signed char .

typedef QAudioBuffer:: S8U

This is a predefined specialization for an unsigned stereo 8 bit sample. Each channel is an unsigned char .