Package org.jfugue.player
Class Player
- java.lang.Object
-
- org.jfugue.player.Player
-
public class Player extends java.lang.Object
This is a player that is optimized for defining and playing music in a program. It specifically parses music with a StaccatoParser and converts the music to MIDI using a MidiParserListener. This Player uses a ManagedPlayer but does not expose any of the ManagedPlayer's ability to be managed.
-
-
Constructor Summary
Constructors Constructor Description Player()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
delayPlay(long millisToDelay, java.lang.String string)
void
delayPlay(long millisToDelay, java.lang.String... strings)
void
delayPlay(long millisToDelay, javax.sound.midi.Sequence sequence)
void
delayPlay(long millisToDelay, PatternProducer patternProducer)
void
delayPlay(long millisToDelay, PatternProducer... patternProducers)
ManagedPlayer
getManagedPlayer()
Returns the ManagedPlayer behind this Player.MidiParserListener
getMidiParserListener()
Returns the MidiParserListener used by this Player.javax.sound.midi.Sequence
getSequence(java.lang.String string)
javax.sound.midi.Sequence
getSequence(java.lang.String... strings)
javax.sound.midi.Sequence
getSequence(PatternProducer patternProducer)
javax.sound.midi.Sequence
getSequence(PatternProducer... patternProducers)
StaccatoParser
getStaccatoParser()
Returns the StaccatoParser used by this Player.void
play(java.lang.String string)
void
play(java.lang.String... strings)
void
play(javax.sound.midi.Sequence sequence)
This method plays a sequence by starting the sequence and waiting for the sequence to finish before continuing.void
play(PatternProducer patternProducer)
void
play(PatternProducer... patternProducers)
-
-
-
Method Detail
-
getSequence
public javax.sound.midi.Sequence getSequence(PatternProducer... patternProducers)
-
getSequence
public javax.sound.midi.Sequence getSequence(PatternProducer patternProducer)
-
getSequence
public javax.sound.midi.Sequence getSequence(java.lang.String... strings)
-
getSequence
public javax.sound.midi.Sequence getSequence(java.lang.String string)
-
play
public void play(PatternProducer... patternProducers)
-
play
public void play(PatternProducer patternProducer)
-
play
public void play(java.lang.String... strings)
-
play
public void play(java.lang.String string)
-
play
public void play(javax.sound.midi.Sequence sequence)
This method plays a sequence by starting the sequence and waiting for the sequence to finish before continuing. It also converts InvalidMidiDataException and MidiUnavailableException to RuntimeExceptions for easier end-user programming. If you want to create an application where you catch those exceptions, you may want to use ManagedPlayer directly.- Parameters:
sequence
-
-
delayPlay
public void delayPlay(long millisToDelay, PatternProducer... patternProducers)
-
delayPlay
public void delayPlay(long millisToDelay, PatternProducer patternProducer)
-
delayPlay
public void delayPlay(long millisToDelay, java.lang.String... strings)
-
delayPlay
public void delayPlay(long millisToDelay, java.lang.String string)
-
delayPlay
public void delayPlay(long millisToDelay, javax.sound.midi.Sequence sequence)
-
getManagedPlayer
public ManagedPlayer getManagedPlayer()
Returns the ManagedPlayer behind this Player. You can start, pause, stop, resume, and seek a ManagedPlayer.- See Also:
ManagedPlayer
-
getStaccatoParser
public StaccatoParser getStaccatoParser()
Returns the StaccatoParser used by this Player. The only thing you might want to do with this is set whether the parser throws an exception if an unknown token is found.- See Also:
StaccatoParser
-
getMidiParserListener
public MidiParserListener getMidiParserListener()
Returns the MidiParserListener used by this Player.- See Also:
MidiParserListener
-
-