StereoFrame 結構

模闆 <typename T> 結構 QAudioBuffer ::StereoFrame

StereoFrame 類提供立體聲音頻幀簡單包裹器。 更多...

公共函數

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

公共變量

T left
T right

詳細描述

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 ( T leftSample , T rightSample )

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

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 < T > &StereoFrame:: operator= (const StereoFrame < T > & other )

賦值 other 到此幀。

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.

成員變量文檔編製

T StereoFrame:: left

This variable holds the left sample

T StereoFrame:: right

This variable holds the right sample