Viadeo Twitter Google Bookmarks ! Facebook Digg del.icio.us MySpace Yahoo MyWeb Blinklist Netvouz Reddit Simpy StumbleUpon Bookmarks Windows Live Favorites 
Logo Documentation Qt ·  Page d'accueil  ·  Toutes les classes  ·  Classes principales  ·  Annotées  ·  Classes groupées  ·  Modules  ·  Fonctions  · 

StereoSample Class

(QAudioBuffer::StereoSample)

The StereoSample class provides a simple wrapper for a stereo audio sample. More...

 #include <QAudioBuffer>

Public Functions

StereoSample()
StereoSample(T leftSample, T rightSample)
T average() const
void clear()
StereoSample & operator=(const StereoSample & other)

Public Variables

T left
T right

Related Non-Members

typedef S16S
typedef S16U
typedef S32F
typedef S8S
typedef S8U

Detailed Description

The StereoSample class provides a simple wrapper for a stereo audio sample.

This templatized structure lets you treat a block of individual samples as an interleaved stereo stream. 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 structure has left and right members for accessing individual channel data.

For example:

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

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

Member Function Documentation

StereoSample::StereoSample()

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

StereoSample::StereoSample(T leftSample, T rightSample)

Constructs a new sample with the supplied leftSample and rightSample values.

T StereoSample::average() const

Returns the arithmetic average of the left and right samples.

void StereoSample::clear()

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

StereoSample & StereoSample::operator=(const StereoSample & other)

Assigns other to this sample.

Member Variable Documentation

T StereoSample::left

This variable holds the left sample.

T StereoSample::right

This variable holds the right sample.

Related Non-Members

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.

Cette page est une traduction d'une page de la documentation de Qt, écrite par Nokia Corporation and/or its subsidiary(-ies). Les éventuels problèmes résultant d'une mauvaise traduction ne sont pas imputables à Nokia. Qt 5.0-snapshot
Copyright © 2012 Developpez LLC. Tous droits réservés Developpez LLC. Aucune reproduction, même partielle, ne peut être faite de ce site et de l'ensemble de son contenu : textes, documents et images sans l'autorisation expresse de Developpez LLC. Sinon, vous encourez selon la loi jusqu'à 3 ans de prison et jusqu'à 300 000 E de dommages et intérêts. Cette page est déposée à la SACD.
Vous avez déniché une erreur ? Un bug ? Une redirection cassée ? Ou tout autre problème, quel qu'il soit ? Ou bien vous désirez participer à ce projet de traduction ? N'hésitez pas à nous contacter ou par MP !
 
 
 
 
Partenaires

Hébergement Web