Package trclib.archive
Class TrcSongPlayer
java.lang.Object
trclib.archive.TrcSongPlayer
This class implements a song player that can parse a notated song in a string
buffer and play the notes on a Tone device.
-
Constructor Summary
ConstructorsConstructorDescriptionTrcSongPlayer
(String instanceName, TrcTone tone) Constructor: Create and initialize an instance of the object. -
Method Summary
Modifier and TypeMethodDescriptionvoid
pause()
This method is called to pause the player.void
This method plays the specified song.void
This method plays the specified song.void
This method plays the specified song.void
This method plays the specified song.void
resume()
This method is called to resume the player.void
rewind()
This method rewinds the song back to the beginning.void
stop()
This method stops the sound and disables the player task.toString()
This method returns the instance name.
-
Constructor Details
-
TrcSongPlayer
Constructor: Create and initialize an instance of the object.- Parameters:
instanceName
- specifies the instance name.tone
- specifies the Tone player.
-
-
Method Details
-
toString
This method returns the instance name. -
stop
public void stop()This method stops the sound and disables the player task. -
pause
public void pause()This method is called to pause the player. -
resume
public void resume()This method is called to resume the player. -
rewind
public void rewind()This method rewinds the song back to the beginning. -
playSong
This method plays the specified song.- Parameters:
song
- specifies the song to be played.barDuration
- specifies the bar duration in seconds.repeat
- specifies true to play the song repeatedly, false otherwise.pause
- specifies true to pause the song, false to start it immediately.
-
playSong
This method plays the specified song.- Parameters:
song
- specifies the song to be played.barDuration
- specifies the bar duration in seconds.pause
- specifies true to pause the song, false to start it immediately.event
- specifies the event to be notified on song completion.
-
playSong
This method plays the specified song.- Parameters:
song
- specifies the song to be played.barDuration
- specifies the bar duration in seconds.pause
- specifies true to pause the song, false to start it immediately.
-
playSong
This method plays the specified song.- Parameters:
song
- specifies the song to be played.barDuration
- Specifies the bar duration in seconds.
-