Phonon  4.7.0
 All Classes Namespaces Functions Variables Enumerations Enumerator Properties Pages
Public Types | Public Slots | Signals | Public Member Functions | Properties | List of all members
Phonon::AudioDataOutput Class Reference

This class gives you the audio data (for visualizations). More...

#include <audiodataoutput.h>

Inheritance diagram for Phonon::AudioDataOutput:
Phonon::AbstractAudioOutput Phonon::MediaNode

Public Types

enum  Channel {
  LeftChannel, RightChannel, CenterChannel, LeftSurroundChannel,
  RightSurroundChannel, SubwooferChannel
}
 

Public Slots

void setDataSize (int size)
 

Signals

void dataReady (const QMap< Phonon::AudioDataOutput::Channel, QVector< qint16 > > &data)
 
void endOfMedia (int remainingSamples)
 

Public Member Functions

int dataSize () const
 
int sampleRate () const
 

Properties

int dataSize
 

Additional Inherited Members

- Protected Member Functions inherited from Phonon::AbstractAudioOutput
 AbstractAudioOutput (AbstractAudioOutputPrivate &dd, QObject *parent)
 
- Protected Attributes inherited from Phonon::MediaNode
MediaNodePrivate *const k_ptr
 

Detailed Description

This class gives you the audio data (for visualizations).

This class implements a special AbstractAudioOutput that gives your application the audio data. Don't expect realtime performance. But the latencies should be low enough to use the audio data for visualizations. You can also use the audio data for further processing (e.g. encoding and saving to a file).

Author
Matthias Kretz kretz.nosp@m.@kde.nosp@m..org

Member Enumeration Documentation

Specifies the channel the audio data belongs to.

Member Function Documentation

void Phonon::AudioDataOutput::dataReady ( const QMap< Phonon::AudioDataOutput::Channel, QVector< qint16 > > &  data)
signal

Emitted whenever another dataSize number of samples are ready.

Parameters
dataA mapping of Channel to a vector holding the audio data.
int Phonon::AudioDataOutput::dataSize ( ) const

Returns the currently used number of samples passed through the signal.

See Also
setDataSize
void Phonon::AudioDataOutput::endOfMedia ( int  remainingSamples)
signal

This signal is emitted before the last dataReady signal of a media is emitted.

If, for example, the playback of a media file has finished and the last audio data of that file is going to be passed with the next dataReady signal, and only the 28 first samples of the data vector are from that media file endOfMedia will be emitted right before dataReady with remainingSamples = 28.

Parameters
remainingSamplesThe number of samples in the next dataReady vector that belong to the media that was playing to this point.
int Phonon::AudioDataOutput::sampleRate ( ) const

Returns the sample rate in Hz. Common sample rates are 44100 Hz and 48000 Hz. AudioDataOutput will not do any sample rate conversion for you. If you need to convert the sample rate you might want to take a look at libsamplerate. For visualizations it is often enough to do simple interpolation or even drop/duplicate samples.

Returns
The sample rate as reported by the backend. If the backend is unavailable -1 is returned.
void Phonon::AudioDataOutput::setDataSize ( int  size)
slot

Sets the number of samples to be passed in one signal emission.

Defaults to 512 samples per emitted signal.

Parameters
sizethe number of samples

The documentation for this class was generated from the following file: