The QFeedbackFileEffect class allows to play feedback from a file. More...
#include <QFeedbackFileEffect>
Inherits: QFeedbackEffect.
This class was introduced in Qt Mobility 1.1.
QFeedbackFileEffect ( QObject * parent = 0 ) | |
~QFeedbackFileEffect () | |
bool | isLoaded () const |
void | load () |
void | setLoaded ( bool ) |
void | setSource ( const QUrl & ) |
QUrl | source () const |
void | unload () |
virtual int | duration () const |
virtual State | state () const |
QStringList | supportedMimeTypes () |
virtual void | setState ( State newState ) |
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.
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 ) |
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 & ) |
Constructs the QFeedbackFileEffect class, and passes parent to QObject's constructor.
Stops the feedback and unloads the file if necessary.
Reimplemented from QFeedbackEffect::duration().
This function was introduced in Qt Mobility 1.1.
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.
Reimplemented from QFeedbackEffect::setState().
This function was introduced in Qt Mobility 1.1.
See also state().
Reimplemented from QFeedbackEffect::state().
This function was introduced in Qt Mobility 1.1.
See also setState().
returns the MIME types supported for playing effects from file.
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.