6.0.0-rc4Source

QtFM::FmMusic Class

The FmMusic type plays chip music: VGM, VGZ, DRO and IMF files. More…

Header#include <QtFMQml/qfmqml.h>
CMaketarget_link_libraries(app PRIVATE Nt::FMQml)
ModuleNt FM QML Types
InheritsQObject

List of all members, including inherited members

Public Functions

FmMusic(QObject *parent = nullptr)
QUrlsource() const
voidsetSource(const QUrl &source)
boolloops() const
voidsetLoops(bool loops)
doublegain() const
voidsetGain(double dB)
doubleposition() const
doubleduration() const
boolisPlaying() const
QStringerror() const
voidplay()
voidpause()
voidstop()

Signals

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

[explicit] 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.

[signal] 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.

[signal] void QtFM::FmMusic::errorChanged()

This signal is emitted when error() changes.

[signal] 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.

[signal] 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.

[signal] 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.

[signal] void QtFM::FmMusic::playingChanged()

This signal is emitted when isPlaying() changes.

double QtFM::FmMusic::position() const

Returns the position in seconds.

[signal] 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.

[signal] void QtFM::FmMusic::sourceChanged()

This signal is emitted when source() changes.

void QtFM::FmMusic::stop()

Stops the music and returns to its start.