Package trclib.archive
Class TrcSong
java.lang.Object
trclib.archive.TrcSong
This class implements a song object that contains a song name, an array list of notated sections and a sequencing
array specifying the order of the sections. It also keeps track of the next note position of the song and provides
a getNextNote() method to retrieve the next note to play.
-
Constructor Summary
ConstructorsConstructorDescriptionConstructor: Create an instance of the object.Constructor: Create an instance of the object.Constructor: Create an instance of the object.Constructor: Create an instance of the object. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addSection
(String name, String section) This method adds a notated section to the song.double
This method returns the current volume of the song.This method retrieves the next note of the song to be played.void
rewind()
This method rewinds the note pointer back to the beginning of the song.void
setCurrentVolume
(double vol) This method sets the current volume of the song.void
setSequence
(String sequence) This method sets the sequencing of the song.void
setStartVolume
(double vol) This method sets the start volume of the song.toString()
This method returns the song name.
-
Constructor Details
-
TrcSong
Constructor: Create an instance of the object.- Parameters:
name
- specifies the name of the song.startVolume
- specifies the starting volume.
-
TrcSong
Constructor: Create an instance of the object.- Parameters:
name
- specifies the name of the song.
-
TrcSong
Constructor: Create an instance of the object.- Parameters:
name
- specifies the name of the song.startVolume
- specifies the starting volume.sections
- specifies an array of notated song sections.sequence
- specifies the song sequence array.
-
TrcSong
Constructor: Create an instance of the object.- Parameters:
name
- specifies the name of the song.sections
- specifies an array of notated song sections.sequence
- specifies the song sequence array.
-
-
Method Details
-
toString
This method returns the song name. -
addSection
This method adds a notated section to the song.- Parameters:
name
- specifies the section name.section
- specifies the string that contains notated notes of the section.
-
setSequence
This method sets the sequencing of the song.- Parameters:
sequence
- specifies the string that contains the sequence of section names.
-
getNextNote
This method retrieves the next note of the song to be played.- Returns:
- next notated note or null if no more note.
-
getCurrentVolume
public double getCurrentVolume()This method returns the current volume of the song.- Returns:
- current volume of the song.
-
setCurrentVolume
public void setCurrentVolume(double vol) This method sets the current volume of the song.- Parameters:
vol
- specifies the current volume of the song.
-
setStartVolume
public void setStartVolume(double vol) This method sets the start volume of the song.- Parameters:
vol
- specifies the start volume of the song.
-
rewind
public void rewind()This method rewinds the note pointer back to the beginning of the song.
-