- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files
- Directories
- Examples

- Class List
- Class Hierarchy
- Class Members

Public Types | Public Slots | Signals | Public Member Functions | Properties

# AudioDataOutput Class Reference

Search for all occurrences

## 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@kde.org>

Definition at line 52 of file audiodataoutput.h.

`#include <audiodataoutput.h>`

Inheritance diagram for AudioDataOutput:
[legend]

List of all members.

## Public Types
enum | Channel { LeftChannel, RightChannel, CenterChannel, LeftSurroundChannel, RightSurroundChannel, SubwooferChannel }
| Specifies the channel the audio data belongs to. More...
## Public Slots
void | setDataSize (int size)
| Sets the number of samples to be passed in one signal emission.
## Signals
void | dataReady (const QMap< Phonon::AudioDataOutput::Channel, QVector< qint16 > > &data)
| Emitted whenever another dataSize number of samples are ready.
void | endOfMedia (int remainingSamples)
| This signal is emitted before the last dataReady signal of a media is emitted.
## Public Member Functions
int | dataSize () const
| Returns the currently used number of samples passed through the signal.
int | sampleRate () const
| Returns the sample rate in Hz.
## Properties
int | dataSize

## Member Enumeration Documentation

enum Channel

Search for all occurrences

Specifies the channel the audio data belongs to.

Enumerator:

  LeftChannel | Search for all occurrences
  RightChannel | Search for all occurrences
  CenterChannel | Search for all occurrences
  LeftSurroundChannel | Search for all occurrences
  RightSurroundChannel | Search for all occurrences
  SubwooferChannel | Search for all occurrences

Definition at line 63 of file audiodataoutput.h.

                {
                    LeftChannel,
                    RightChannel,
                    CenterChannel,
                    LeftSurroundChannel,
                    RightSurroundChannel,
                    SubwooferChannel
                };

## Member Function Documentation

int dataSize | ( |  | ) | const

Search for all occurrences

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

See also:
  setDataSize

int sampleRate | ( |  | ) | const

Search for all occurrences

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 setDataSize | ( | int | size | ) | `[slot]`

Search for all occurrences

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

Defaults to 512 samples per emitted signal.

Parameters:

  size | the number of samples

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

Search for all occurrences

Emitted whenever another dataSize number of samples are ready.

Parameters:

  data | A mapping of Channel to a vector holding the audio data.

void endOfMedia | ( | int | remainingSamples | ) | `[signal]`

Search for all occurrences

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:

  remainingSamples | The number of samples in the next dataReady vector that belong to the media that was playing to this point.

## Property Documentation

int dataSize `[read, write]`

Search for all occurrences

Definition at line 57 of file audiodataoutput.h.

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

- phonon/audiodataoutput.h

AudioDataOutput AudioDataOutput AudioDataOutput AudioDataOutput AudioDataOutput AudioDataOutput AudioDataOutput AudioDataOutput AudioDataOutput AudioDataOutput
AudioDataOutput AudioDataOutput AudioDataOutput AudioDataOutput AudioDataOutput AudioDataOutput AudioDataOutput AudioDataOutput AudioDataOutput AudioDataOutput