QtFM::FmMusic Class
The FmMusic type plays chip music: VGM, VGZ, DRO and IMF files. More…
| Header | #include <QtFMQml/qfmqml.h> |
|---|---|
| CMake | target_link_libraries(app PRIVATE Nt::FMQml) |
| Module | Nt FM QML Types |
| Inherits | QObject |
List of all members, including inherited members
Public Functions
| FmMusic(QObject *parent = nullptr) | |
| QUrl | source() const |
| void | setSource(const QUrl &source) |
| bool | loops() const |
| void | setLoops(bool loops) |
| double | gain() const |
| void | setGain(double dB) |
| double | position() const |
| double | duration() const |
| bool | isPlaying() const |
| QString | error() const |
| void | play() |
| void | pause() |
| void | stop() |
Signals
| void | sourceChanged() |
| void | loopsChanged() |
| void | gainChanged() |
| void | positionChanged() |
| void | durationChanged() |
| void | playingChanged() |
| void | errorChanged() |
| void | finished() |
Detailed Description
property FmMusic music: FmMusic {
source: Qt.application.arguments.length > 1 ? Qt.application.arguments[1] : ""
loops: false
}
See also QtFM::MusicPlayer.
Differences from Qt
The engine has one music player: playing an FmMusic stops any other.
Member Function Documentation
QtFM::FmMusic::FmMusic(QObject *parent = nullptr)
Constructs a music element with parent.
double QtFM::FmMusic::duration() const
Returns the length in seconds, known once the music has been played.
void QtFM::FmMusic::durationChanged()
This signal is emitted when duration() changes.
QString QtFM::FmMusic::error() const
Returns why the music could not be loaded, or an empty string.
void QtFM::FmMusic::errorChanged()
This signal is emitted when error() changes.
void QtFM::FmMusic::finished()
This signal is emitted when music that does not loop ends.
double QtFM::FmMusic::gain() const
Returns the gain in decibels.
void QtFM::FmMusic::gainChanged()
This signal is emitted when gain() changes.
bool QtFM::FmMusic::isPlaying() const
Returns true if the music plays.
bool QtFM::FmMusic::loops() const
Returns true if the music loops; true by default.
void QtFM::FmMusic::loopsChanged()
This signal is emitted when loops() changes.
void QtFM::FmMusic::pause()
Pauses the music.
void QtFM::FmMusic::play()
Starts or resumes the music.
void QtFM::FmMusic::playingChanged()
This signal is emitted when isPlaying() changes.
double QtFM::FmMusic::position() const
Returns the position in seconds.
void QtFM::FmMusic::positionChanged()
This signal is emitted when position() changes.
void QtFM::FmMusic::setGain(double dB)
Sets the gain property to dB.
See also gain().
void QtFM::FmMusic::setLoops(bool loops)
Sets the loops property to loops.
See also loops().
void QtFM::FmMusic::setSource(const QUrl &source)
Sets the source property to source.
See also source().
QUrl QtFM::FmMusic::source() const
Returns the url of the music file.
void QtFM::FmMusic::sourceChanged()
This signal is emitted when source() changes.
void QtFM::FmMusic::stop()
Stops the music and returns to its start.