Home · All Namespaces · All Classes · Grouped Classes · Modules · Functions codeless banner

QSoundControl Class Reference
[QtBaseModule]

The QSoundControl class extends the functionality of the QSound class. More...

    #include <QSoundControl>

Inherits QObject.

Public Types

Public Functions

Signals

Additional Inherited Members


Detailed Description

The QSoundControl class extends the functionality of the QSound class.

The QSoundControl class can be used to control the volume, priority and provide the status for a QSound object.

Construct a QSoundControl object with an exising QSound object.

    QSoundControl *control = new QSoundControl( new QSound( "test.wav" ) );

The control may now be used to alter the behavior of the sound object.

    control->setVolume( 50 );
    control->setPriority( QSoundControl::RingTone );

In additon the control may be used to listen for when the sound object finishes playback.

    connect( control, SIGNAL(done()), this, SLOT(doSomething()) );

The control object does not take owenership of the sound object. Care must be taken to ensure the sound object remains valid for the life of the control object.

    delete control->sound();
    delete control;

See also QSound.


Member Type Documentation

enum QSoundControl::Priority

This enum type specifies the different priorities available for QSound objects.

ConstantValueDescription
QSoundControl::Default0This is the lowest priority.
QSoundControl::RingTone1This is the highest priority. Sounds with this priority will be played in preference to all other sounds.


Member Function Documentation

QSoundControl::QSoundControl ( QSound * sound, QObject * parent = 0 )

Constructs a sound control for the given sound object and a parent. Ownership of the sound object is not taken.

void QSoundControl::done ()   [signal]

This signal is emitted when the sound object finishes playing. For looped sound object this signal will only be emitted once all loops have played through.

Priority QSoundControl::priority () const

Returns the current priority of the sound object.

See also setPriority().

void QSoundControl::setPriority ( Priority priority )

Sets the priority of the sound object to priority.

See also priority().

void QSoundControl::setVolume ( int volume )

Adjusts the volume of the sound object to volume. The given value should be between 0 and 100.

See also volume().

QSound * QSoundControl::sound () const

Returns the sound object the control is associated with.

int QSoundControl::volume () const

Returns the current volume of the sound object.

See also setVolume().


Copyright © 2009 Trolltech Trademarks
Qt Extended 4.4.3