KDE 4.2 PyKDE API Reference
  • KDE's Python API
  • Overview
  • PyKDE Home
  • Sitemap
  • Contact Us
 

AudioDataOutput Class Reference

from PyKDE4.phonon import *

Namespace: Phonon::Experimental

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).

The class supports different data formats. One of the most common formats is to read vectors of integers (which will only use 16 Bit), but you can also request floats which some backends use internally.

Author:
Matthias Kretz <kretz@kde.org>


Enumerations

Channel { LeftChannel, RightChannel, CenterChannel, LeftSurroundChannel, RightSurroundChannel, SubwooferChannel }
Format { IntegerFormat, FloatFormat }

Signals

 dataReady (QMap> data)
 dataReady (QMap> data)
 endOfMedia (int remainingSamples)

Methods

 __init__ (self, Phonon.Experimental.AudioDataOutput other)
 dataReady (self, QMap> data)
 dataReady (self, QMap> data)
int dataSize (self)
 endOfMedia (self, int remainingSamples)
Phonon.Experimental.AudioDataOutput.Format format (self)
int sampleRate (self)
 setDataSize (self, int size)
 setFormat (self, Phonon.Experimental.AudioDataOutput.Format format)

Method Documentation

__init__ (  self,
Phonon.Experimental.AudioDataOutput  other
)
dataReady (  self,
QMap>  data
)

Emitted whenever another dataSize number of samples are ready and format is set to IntegerFormat.

If format is set to FloatFormat the signal is not emitted at all.

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

Signal syntax:
QObject.connect(source, SIGNAL("dataReady(const QMap>&)"), target_slot)
dataReady (  self,
QMap>  data
)

Emitted whenever another dataSize number of samples are ready and format is set to FloatFormat.

If format is set to IntegerFormat the signal is not emitted at all.

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

Signal syntax:
QObject.connect(source, SIGNAL("dataReady(const QMap>&)"), target_slot)
int dataSize (   self )

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

See also:
setDataSize

endOfMedia (  self,
int  remainingSamples
)

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.

Signal syntax:
QObject.connect(source, SIGNAL("endOfMedia(int)"), target_slot)
Phonon.Experimental.AudioDataOutput.Format format (   self )

Returns the currently used format.

See also:
setFormat

int sampleRate (   self )

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.

setDataSize (  self,
int  size
)

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

setFormat (  self,
Phonon.Experimental.AudioDataOutput.Format  format
)

Requests the dataformat you'd like to receive. Only one of the signals of this class will be emitted when new data is ready.

The default format is IntegerFormat.

See also:
format()


Enumeration Documentation

Channel

Specifies the channel the audio data belongs to.

Enumerator:
LeftChannel 
RightChannel 
CenterChannel 
LeftSurroundChannel 
RightSurroundChannel 
SubwooferChannel 

Format

Requests 16 bit signed integers.

See also:
dataReady(const QVector<qint16> &)

Enumerator:
IntegerFormat = 1
FloatFormat = 2

  • Full Index

Modules

  • akonadi
  • dnssd
  • kdecore
  • kdeui
  • khtml
  • kio
  • knewstuff
  • kparts
  • kutils
  • nepomuk
  • phonon
  • plasma
  • solid
  • soprano
This documentation is maintained by Simon Edwards.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal