java.lang.Object
provided.abcMusic.player.impl.ASequencePlayer
provided.abcMusic.player.impl.SequencePlayer
- All Implemented Interfaces:
ISequencePlayer
A basic sequence player to create and play MIDI music sequences.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate Sequencer
MIDI sequencer objectprivate Synthesizer
MIDI synthesizer objectFields inherited from class provided.abcMusic.player.impl.ASequencePlayer
logger
Fields inherited from interface provided.abcMusic.player.ISequencePlayer
END_OF_TRACK
-
Constructor Summary
ConstructorsConstructorDescriptionSequencePlayer(int ticksPerQuarterNote, int instrument)
Create a new SequencePlayer to create and play music. -
Method Summary
Modifier and TypeMethodDescriptionboolean
init(int ticksPerQuarterNote, int instrument)
Initialize the SequencePlayer as per the supplied ticksPerQuarterNote and instrument this SequencePlayer was instantiated with.void
play(ISequencePlayerStatus statusCmd)
Play the created Sequence.void
stop()
Stop playing music and close resources.Methods inherited from class provided.abcMusic.player.impl.ASequencePlayer
addNote, addNote, getSequence, getTempo, getTicksPerDefaultNote, getTicksPerQuarterNote, initBase, initTrack, setTempo, setTicksPerDefaultNote
-
Field Details
-
_sequencer
MIDI sequencer object -
_synthesizer
MIDI synthesizer object
-
-
Constructor Details
-
SequencePlayer
public SequencePlayer(int ticksPerQuarterNote, int instrument)Create a new SequencePlayer to create and play music.- Parameters:
ticksPerQuarterNote
- - tick definitioninstrument
- - MIDI instrument
-
-
Method Details
-
init
public boolean init(int ticksPerQuarterNote, int instrument)Initialize the SequencePlayer as per the supplied ticksPerQuarterNote and instrument this SequencePlayer was instantiated with. This method is called by the constructor to initialize the player upon instantiation and can be called again to reinitialize the SequencePlayer.- Parameters:
ticksPerQuarterNote
- - tick definitioninstrument
- - MIDI instrument- Returns:
- - true if properly initialized, false otherwise
-
play
Play the created Sequence.- Parameters:
statusCmd
- The finished() method of this command is called when the track finishes being played, i.e. a normal termination. There is no notification if play is forcibly stopped.
-
stop
public void stop()Stop playing music and close resources.
-