Phonon  4.7.0
 All Classes Namespaces Functions Variables Enumerations Enumerator Properties Pages
Public Member Functions | Protected Attributes | Friends | Related Functions | List of all members
Phonon::Path Class Reference

Connection object providing convenient effect insertion. More...

#include <phonon/Path>

Public Member Functions

 ~Path ()
 
 Path ()
 
 Path (const Path &)
 
bool isValid () const
 
EffectinsertEffect (const EffectDescription &desc, Effect *insertBefore=0)
 
bool insertEffect (Effect *newEffect, Effect *insertBefore=0)
 
bool removeEffect (Effect *effect)
 
QList< Effect * > effects () const
 
bool reconnect (MediaNode *source, MediaNode *sink)
 
bool disconnect ()
 
Pathoperator= (const Path &p)
 
bool operator== (const Path &p) const
 
bool operator!= (const Path &p) const
 
MediaNodesource () const
 
MediaNodesink () const
 

Protected Attributes

QExplicitlySharedDataPointer
< PathPrivate > 
d
 

Friends

class FactoryPrivate
 
class PathPrivate
 

Related Functions

(Note that these are not member functions.)

PHONON_EXPORT Path createPath (MediaNode *source, MediaNode *sink)
 

Detailed Description

Connection object providing convenient effect insertion.

MediaObject *media = new MediaObject;
AudioOutput *output = new AudioOutput(Phonon::MusicCategory);
Path path = Phonon::createPath(media, output);
Q_ASSERT(path.isValid()); // for this simple case the path should always be
//valid - there are unit tests to ensure it
// insert an effect
if (!effectList.isEmpty()) {
Effect *effect = path.insertEffect(effectList.first());
}
Author
Matthias Kretz kretz.nosp@m.@kde.nosp@m..org
Thierry Bastian thier.nosp@m.ry.b.nosp@m.astia.nosp@m.n@tr.nosp@m.ollte.nosp@m.ch.c.nosp@m.om

Constructor & Destructor Documentation

Phonon::Path::~Path ( )

Destroys this reference to the Path. If the path was valid the connection is not broken as both the source and the sink MediaNodes still keep a reference to the Path.

See Also
disconnect
Phonon::Path::Path ( )

Creates an invalid path.

You can still make it a valid path by calling reconnect. To create a path you should use createPath, though.

See Also
createPath
isValid
Phonon::Path::Path ( const Path rhs)

Constructs a copy of the given path.

This constructor is fast thanks to explicit sharing.

Member Function Documentation

bool Phonon::Path::disconnect ( )

Disconnects the path from the MediaNodes it was connected to. This invalidates the path (isValid returns false then).

QList< Effect * > Phonon::Path::effects ( ) const

Returns a list of Effect objects that are currently used as effects. The order in the list determines the order the signal is sent through the effects.

Returns
A list with all current effects.
See Also
insertEffect
removeEffect
Effect * Phonon::Path::insertEffect ( const EffectDescription desc,
Effect insertBefore = 0 
)

Creates and inserts an effect into the path.

You may insert effects of the same class as often as you like, but if you insert the same object, the call will fail.

Parameters
descThe EffectDescription object for the effect to be inserted.
insertBeforeIf you already inserted an effect you can tell with this parameter in which order the data gets processed. If this is 0 the effect is appended at the end of the processing list. If the effect has not been inserted before the method will do nothing and return false.
Returns
Returns a pointer to the effect object if it could be inserted at the specified position. If 0 is returned the effect was not inserted.
See Also
removeEffect
effects
bool Phonon::Path::insertEffect ( Effect newEffect,
Effect insertBefore = 0 
)

Inserts an effect into the path.

You may insert effects of the same class as often as you like, but if you insert the same object, the call will fail.

Parameters
newEffectAn Effect object.
insertBeforeIf you already inserted an effect you can tell with this parameter in which order the data gets processed. If this is 0 the effect is appended at the end of the processing list. If the effect has not been inserted before the method will do nothing and return false.
Returns
Returns whether the effect could be inserted at the specified position. If false is returned the effect was not inserted.
See Also
removeEffect
effects
bool Phonon::Path::isValid ( ) const

Returns whether the path object connects two MediaNodes or not.

Returns
true when the path connects two MediaNodes
false when the path is disconnected
bool Phonon::Path::operator!= ( const Path p) const

Returns true if this Path is not equal to p; otherwise returns false;

Path & Phonon::Path::operator= ( const Path p)

Assigns p to this Path and returns a reference to this Path.

This operation is fast thanks to explicit sharing.

bool Phonon::Path::operator== ( const Path p) const

Returns true if this Path is equal to p; otherwise returns false;

bool Phonon::Path::reconnect ( MediaNode source,
MediaNode sink 
)

Tries to change the MediaNodes the path is connected to.

If reconnect fails the old connection is kept.

bool Phonon::Path::removeEffect ( Effect effect)

Removes an effect from the path.

If the effect gets deleted while it is still connected the effect will be removed automatically.

Parameters
effectThe effect to be removed.
Returns
Returns whether the call was successful. If it returns false the effect could not be found in the path, meaning it has not been inserted before.
See Also
insertEffect
effects
MediaNode * Phonon::Path::sink ( ) const

Returns the sink MediaNode used by the path.

MediaNode * Phonon::Path::source ( ) const

Returns the source MediaNode used by the path.

Friends And Related Function Documentation

PHONON_EXPORT Path createPath ( MediaNode source,
MediaNode sink 
)
related

Creates a new Path connecting two MediaNodes.

The implementation will automatically select the right format and media type. E.g. connecting a MediaObject and AudioOutput will create a Path object connecting the audio. This might be represented as PCM or perhaps even AC3 depending on the AudioOutput object.

Parameters
sourceThe MediaNode to connect an output from
sinkThe MediaNode to connect to.

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