AudioDataOutput Class Reference

AudioDataOutput Class Reference

#include <audiodataoutput.h>

Class 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

Definition at line 52 of file audiodataoutput.h.

+ Inheritance diagram for AudioDataOutput:

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. More...
 
- Public Slots inherited from QObject
void deleteLater ()
 

Signals

void dataReady (const QMap< Phonon::AudioDataOutput::Channel, QVector< qint16 > > &data)
 Emitted whenever another dataSize number of samples are ready. More...
 
void endOfMedia (int remainingSamples)
 This signal is emitted before the last dataReady signal of a media is emitted. More...
 
- Signals inherited from QObject
void destroyed (QObject *=0)
 

Public Member Functions

int dataSize () const
 Returns the currently used number of samples passed through the signal. More...
 
int sampleRate () const
 Returns the sample rate in Hz. More...
 
- Public Member Functions inherited from AbstractAudioOutput
 ~AbstractAudioOutput ()
 
- Public Member Functions inherited from QObject
Q_INVOKABLE QObject (QObject *parent=0)
 
virtual ~QObject ()
 
virtual bool event (QEvent *)
 
virtual bool eventFilter (QObject *, QEvent *)
 
QString objectName () const
 
void setObjectName (const QString &name)
 
bool isWidgetType () const
 
bool signalsBlocked () const
 
bool blockSignals (bool b)
 
QThreadthread () const
 
void moveToThread (QThread *thread)
 
int startTimer (int interval)
 
void killTimer (int id)
 
template<typename T >
findChild (const QString &aName=QString()) const
 
template<typename T >
QList< T > findChildren (const QString &aName=QString()) const
 
template<typename T >
QList< T > findChildren (const QRegExp &re) const
 
const QObjectListchildren () const
 
void setParent (QObject *)
 
void installEventFilter (QObject *)
 
void removeEventFilter (QObject *)
 
bool connect (const QObject *sender, const char *signal, const char *member, Qt::ConnectionType type=Qt::AutoConnection) const
 
bool disconnect (const char *signal=0, const QObject *receiver=0, const char *member=0)
 
bool disconnect (const QObject *receiver, const char *member=0)
 
void dumpObjectTree ()
 
void dumpObjectInfo ()
 
bool setProperty (const char *name, const QVariant &value)
 
QVariant property (const char *name) const
 
QList< QByteArraydynamicPropertyNames () const
 
void setUserData (uint id, QObjectUserData *data)
 
QObjectUserDatauserData (uint id) const
 
QObjectparent () const
 
bool inherits (const char *classname) const
 
- Public Member Functions inherited from MediaNode
virtual ~MediaNode ()
 
bool isValid () const
 Tells whether the backend provides an implementation of this class. More...
 
QList< PathinputPaths () const
 
QList< PathoutputPaths () const
 

Properties

int dataSize
 
- Properties inherited from QObject
QString objectName
 

Additional Inherited Members

- Static Public Member Functions inherited from QObject
static bool connect (const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection)
 
static bool connect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method, Qt::ConnectionType type=Qt::AutoConnection)
 
static bool disconnect (const QObject *sender, const char *signal, const QObject *receiver, const char *member)
 
static bool disconnect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &member)
 
static uint registerUserData ()
 
- Protected Member Functions inherited from AbstractAudioOutput
 AbstractAudioOutput (AbstractAudioOutputPrivate &dd, QObject *parent)
 
- Protected Member Functions inherited from QObject
QObjectsender () const
 
int senderSignalIndex () const
 
int receivers (const char *signal) const
 
virtual void timerEvent (QTimerEvent *)
 
virtual void childEvent (QChildEvent *)
 
virtual void customEvent (QEvent *)
 
virtual void connectNotify (const char *signal)
 
virtual void disconnectNotify (const char *signal)
 
 QObject (QObjectPrivate &dd, QObject *parent=0)
 
- Protected Member Functions inherited from MediaNode
 MediaNode (MediaNodePrivate &dd)
 
- Protected Attributes inherited from QObject
QScopedPointer< QObjectDatad_ptr
 
- Protected Attributes inherited from MediaNode
MediaNodePrivate *const k_ptr
 
- Static Protected Attributes inherited from QObject
static const QMetaObject staticQtMetaObject
 

Member Enumeration Documentation

enum Channel

Specifies the channel the audio data belongs to.

Enumerator
LeftChannel 
RightChannel 
CenterChannel 
LeftSurroundChannel 
RightSurroundChannel 
SubwooferChannel 

Definition at line 63 of file audiodataoutput.h.

Member Function Documentation

int dataSize ( ) const

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

See also
setDataSize
int 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 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
void 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.
void 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.

Property Documentation

int dataSize
readwrite

Definition at line 57 of file audiodataoutput.h.


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