StereoFrame Class

Class StereoFrame is declared in class QAudioBuffer.

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

Public Variables

T left
T right

Detailed Description

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.

For example:


  // 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);
  }

See also QAudioBuffer::S8U, QAudioBuffer::S8S, QAudioBuffer::S16S, QAudioBuffer::S16U, and QAudioBuffer::S32F.

Member Variable Documentation

T StereoFrame::left

This variable holds the left sample

T StereoFrame::right

This variable holds the right sample