QtMobility Reference Documentation

QFeedbackFileEffect Class Reference

The QFeedbackFileEffect class allows to play feedback from a file. More...

 #include <QFeedbackFileEffect>

Inherits: QFeedbackEffect.

This class was introduced in Qt Mobility 1.1.

Properties

Public Functions

QFeedbackFileEffect ( QObject * parent = 0 )
~QFeedbackFileEffect ()
bool isLoaded () const
void load ()
void setLoaded ( bool )
void setSource ( const QUrl & )
QUrl source () const
void unload ()

Reimplemented Public Functions

virtual int duration () const
virtual State state () const

Static Public Members

QStringList supportedMimeTypes ()

Reimplemented Protected Functions

virtual void setState ( State newState )

Additional Inherited Members

Detailed Description

The QFeedbackFileEffect class allows to play feedback from a file.

Several different mime types may be supported on a system, including both haptic data files, and audio files.

The files containing haptics data are usually suffixed .ifr. The feedback is usually varying in intensity(), and is for that reason often referred to as a "haptic tune". They are created, for instance, from music files where the feedback is based on a specific feature in the audio data. For example, you could have a phone vibrating along with the bass of a rock song.

Although Qt Mobility does not let you record .ifr files, it lets you play them back using the QFeedbackFileEffect class. Setting up a QFeedbackFileEffect and starting it is done as follows:

 QFeedbackFileEffect hapticTune;
 hapticTune.setSource(QUrl::fromLocalFile("mySavedRumble.ifr"));
 hapticTune.load();
 hapticTune.start();

As with other QFeedbackEffects, QFeedbackFileEffect is at any given time in one of four states: Loading, Running, Paused, or Stopped. You request state changes with start(), pause(), and stop().

You can load() and unload() the file at will to free resources or be as fast as possible. The file must be loaded before it can be started, and it cannot be unloaded while playing. After the file is loaded, you can query its duration(). Some mime types may not support duration information - in these cases, 0 will be returned.

QFeedbackFileEffect reports errors through the error() signal.

See also QFeedbackHapticsEffect.

Property Documentation

loaded : bool

This property holds reports if the file has been successfully loaded.

This property was introduced in Qt Mobility 1.1.

Access functions:

bool isLoaded () const
void setLoaded ( bool )

source : QUrl

This property holds the url of the file that is loaded.

Setting that property will automatically unload the previous file (if any) and load the new one. Some backends may not support all URL schemes - for example, they may only support local files.

You can only change the source of an effect when it is stopped.

This property was introduced in Qt Mobility 1.1.

Access functions:

QUrl source () const
void setSource ( const QUrl & )

Member Function Documentation

QFeedbackFileEffect::QFeedbackFileEffect ( QObject * parent = 0 )

Constructs the QFeedbackFileEffect class, and passes parent to QObject's constructor.

QFeedbackFileEffect::~QFeedbackFileEffect ()

Stops the feedback and unloads the file if necessary.

int QFeedbackFileEffect::duration () const [virtual]

Reimplemented from QFeedbackEffect::duration().

This function was introduced in Qt Mobility 1.1.

void QFeedbackFileEffect::load ()

Makes sure that the file associated with the feedback object is loaded. It will be automatically loaded when the setSource() or start() functions are called.

This function was introduced in Qt Mobility 1.1.

void QFeedbackFileEffect::setState ( State newState ) [virtual protected]

Reimplemented from QFeedbackEffect::setState().

This function was introduced in Qt Mobility 1.1.

See also state().

State QFeedbackFileEffect::state () const [virtual]

Reimplemented from QFeedbackEffect::state().

This function was introduced in Qt Mobility 1.1.

See also setState().

QStringList QFeedbackFileEffect::supportedMimeTypes () [static]

returns the MIME types supported for playing effects from file.

void QFeedbackFileEffect::unload ()

makes sure that the file associated with the feedback object is unloaded. It will be automatically unloaded when the setSource function is called with another file or the object is destroyed.

This function was introduced in Qt Mobility 1.1.

X

Thank you for giving your feedback.

Make sure it is related to this specific page. For more general bugs and requests, please use the Qt Bug Tracker.