LibMuse 6.0.3
com.choosemuse.libmuse.ReaderMuse Class Referenceabstract

Public Member Functions

abstract void run ()
 
abstract void runInRealTimespan ()
 
abstract long currentTime ()
 
abstract void playback ()
 
abstract void setPlaybackSettings (ReaderMusePlaybackSettings settings)
 
abstract ReaderMusePlaybackSettings getPlaybackSettings ()
 
abstract void setReaderListener (ReaderListener listener)
 
abstract void setPlaybackListener (ReaderPlaybackListener listener)
 
abstract Muse asMuse ()
 

Detailed Description

A Muse associated with a MuseFileReader .

This interface can be used to play back packets from a .muse file so that they can be handled the same way that you would handle data from an actual Muse . Details of the parsing are abstracted and you will simply receive data packets with the data that is read.

When you use this class, register MuseDataListener for the data packets you would like to receive by calling ReaderMuse.asMuse() then Muse.registerDataListener().

See also
ReaderMuseBuilder
ReaderMusePlaybackSettings
ReaderPlaybackListener

Member Function Documentation

§ asMuse()

abstract Muse com.choosemuse.libmuse.ReaderMuse.asMuse ( )
abstract

Downcast to Muse Note that most of the API of the returned Muse is stubbed and will cause assert failures if called in debug mode. The methods that are implemented are:

  • isLowEnergy / is_low_energy
  • enableDataTransmission / enable_data_transmission
  • register*
  • unregister*

Note that the only listener that will ever receive packets from a ReaderMuse is MuseDataListener .

§ currentTime()

abstract long com.choosemuse.libmuse.ReaderMuse.currentTime ( )
abstract

Corresponds to the timestamp field for the last packet read.

This does not change within a given listener's body.

Returns
The timestamp of the last packet read.

§ getPlaybackSettings()

abstract ReaderMusePlaybackSettings com.choosemuse.libmuse.ReaderMuse.getPlaybackSettings ( )
abstract

Returns the settings that will be used when playing back a file with this ReaderMuse .

Returns
The settings that will be used to play back the file.

§ playback()

abstract void com.choosemuse.libmuse.ReaderMuse.playback ( )
abstract

Play back the MuseFile and call each listener for each packet as appropriate.

The speed of the playback is controlled by the playback settings. Simulated playback settings require the ReaderMuse to be constructed with an EventLoop to simulate the time between packets. Calling playback without an EventLoop will not playback the file and will log a warning.

This only works once; the file is not rewound on subsequent calls. If you want to play a file again, create another ReaderMuse

See also
ReaderMusePlaybackSettings

§ run()

abstract void com.choosemuse.libmuse.ReaderMuse.run ( )
abstract

Run through all packets in the file, calling each listener for each packet as appropriate.

This only works once; the file is not rewound on subsequent calls. If you want to play a file again, create another ReaderMuse

Deprecated:
Use playback() with the playback setting ReaderMusePlaybackSettings.AS_FAST_AS_POSSIBLE_WITH_SAVED_TIMESTAMP to replicate this behaviour.

§ runInRealTimespan()

abstract void com.choosemuse.libmuse.ReaderMuse.runInRealTimespan ( )
abstract

Run through all packets in the file, calling each listener for each packet as appropriate in 1:1 timespan

This only works once; the file is not rewound on subsequent calls. If you want to play a file again, create another ReaderMuse

Deprecated:
Use playback()with the playback setting ReaderMusePlaybackSettings.SIMULATED_WITH_SAVED_TIMESTAMP to replicate this behaviour.

§ setPlaybackListener()

abstract void com.choosemuse.libmuse.ReaderMuse.setPlaybackListener ( ReaderPlaybackListener  listener)
abstract

Set a listener to receive events related to playback. For example when playback has finished successfully or was interrupted due to error.

Parameters
listenerThe playback listener to receive callbacks.

§ setPlaybackSettings()

abstract void com.choosemuse.libmuse.ReaderMuse.setPlaybackSettings ( ReaderMusePlaybackSettings  settings)
abstract

Sets the settings to use when playing back a file with this ReaderMuse .

Parameters
settingsThe settings to use for playback.

§ setReaderListener()

abstract void com.choosemuse.libmuse.ReaderMuse.setReaderListener ( ReaderListener  listener)
abstract

Set a listener to receive annotations, version, and configuration packets.

Parameters
listenerThe listener for annotation, version and configuration packets.

The documentation for this class was generated from the following file: