|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jfugue.Player
public class Player
Prepares a pattern to be turned into music by the Renderer. This class also handles saving the sequence derived from a pattern as a MIDI file.
MidiRenderer
,
Pattern
Constructor Summary | |
---|---|
Player()
Instantiates a new Player object, which is used for playing music. |
|
Player(javax.sound.midi.Sequencer sequencer)
Creates a new Player instance using a Sequencer that you have provided. |
Method Summary | |
---|---|
void |
allNotesOff()
Stops all notes from playing on all MIDI channels. |
void |
close()
Closes MIDI resources - be sure to call this after play() has returned. |
javax.sound.midi.Sequence |
getSequence(Pattern pattern)
Returns the sequence containing the MIDI data from the given pattern. |
javax.sound.midi.Sequencer |
getSequencer()
Returns the sequencer containing the MIDI data from a pattern that has been parsed. |
Pattern |
loadMidi(java.io.File file)
Parses a MIDI file and returns a Pattern. |
void |
play(Anticipator anticipator,
Pattern pattern,
long offset)
|
void |
play(Anticipator anticipator,
javax.sound.midi.Sequence sequence,
javax.sound.midi.Sequence sequence2,
long offset)
|
void |
play(MicrotoneHelper microtone,
Pattern pattern)
Plays a pattern that contains microtone identifiers. |
void |
play(Pattern pattern)
Plays a pattern by setting up a Renderer and feeding the pattern to it. |
void |
play(Rhythm rhythm)
Plays a pattern by setting up a Renderer and feeding the pattern to it. |
void |
play(javax.sound.midi.Sequence sequence)
Plays a MIDI Sequence |
void |
play(java.lang.String musicString)
Plays a string of music. |
void |
play(java.net.URL url)
Plays a URL that contains a MIDI sequence. |
void |
playMidiDirectly(java.io.File file)
Plays a MIDI file, without doing any conversions to MusicStrings. |
void |
saveMidi(Pattern pattern,
java.io.File file)
Saves the MIDI data from a pattern into a file. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Player()
public Player(javax.sound.midi.Sequencer sequencer)
sequencer
- The Sequencer to send the MIDI eventsMethod Detail |
---|
public void play(Pattern pattern)
pattern
- the pattern to playMidiRenderer
public void play(Rhythm rhythm)
pattern
- the pattern to playMidiRenderer
public void play(javax.sound.midi.Sequence sequence)
sequence
- the Sequence to play
JFugueException
- if there is a problem playing the musicMidiRenderer
public void play(java.lang.String musicString)
musicString
- the MusicString (JFugue-formatted string) to playpublic void playMidiDirectly(java.io.File file) throws java.io.IOException, javax.sound.midi.InvalidMidiDataException
file
- the MIDI file to play
java.io.IOException
javax.sound.midi.InvalidMidiDataException
public void play(java.net.URL url) throws java.io.IOException, javax.sound.midi.InvalidMidiDataException
url
- the URL to play
java.io.IOException
javax.sound.midi.InvalidMidiDataException
public void play(MicrotoneHelper microtone, Pattern pattern)
microtone
- the MicrotoneHelper that contains the microtone definitionspattern
- the pattern to playMicrotoneHelper
public void play(Anticipator anticipator, Pattern pattern, long offset)
public void play(Anticipator anticipator, javax.sound.midi.Sequence sequence, javax.sound.midi.Sequence sequence2, long offset)
public void close()
public void saveMidi(Pattern pattern, java.io.File file) throws java.io.IOException
pattern
- the pattern to savefile
- the File to save the pattern to. Should include file extension, such as .mid
java.io.IOException
public Pattern loadMidi(java.io.File file) throws java.io.IOException, javax.sound.midi.InvalidMidiDataException
MidiParser parser = new MidiParser(); MusicStringRenderer renderer = new MusicStringRenderer(); parser.addParserListener(renderer); parser.parse(sequence);
filename
- The name of the MIDI file
java.io.IOException
- If there is a problem opening the MIDI file
javax.sound.midi.InvalidMidiDataException
- If there is a problem obtaining MIDI resourcespublic void allNotesOff()
public javax.sound.midi.Sequencer getSequencer()
public javax.sound.midi.Sequence getSequence(Pattern pattern)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |