|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectplayer.SequencePlayer
public class SequencePlayer
Sequence Player to create and play MIDI music sequences.
Field Summary | |
---|---|
private int |
_bpm
Tempo (beats per minute) |
private static int[] |
_offsets
Half note steps from C in an octave |
private javax.sound.midi.Sequence |
_sequence
Music sequence |
private int |
_ticksPerDefaultNote
Default note duration |
private int |
_ticksPerQuarterNote
Definition of a tick |
private javax.sound.midi.Track |
_track
Track within music sequence |
static int |
END_OF_TRACK
End of track marker |
private javax.sound.midi.Sequencer |
sequencer
|
private javax.sound.midi.Synthesizer |
synthesizer
|
Constructor Summary | |
---|---|
SequencePlayer(int ticksPerQuarterNote,
int instrument)
Create a new SequencePlayer to create and play music. |
Method Summary | |
---|---|
int |
addNote(Note note,
int start)
Add a note to the MIDI sequence with a default velocity of 64 for middle volume |
int |
addNote(Note note,
int start,
int velocity)
Add a note to the MIDI sequence. |
java.lang.String |
getInstruments()
Get a string containing all of the instruments supported by the SequencePlayer. |
int |
getTempo()
|
int |
getTicksPerDefaultNote()
|
int |
getTicksPerQuarterNote()
|
void |
play()
Play the created Sequence. |
void |
setTempo(int bpm)
Set the tempo - can't change the tempo in the middle of a sequence, the last tempo set will be used for the whole sequence. |
void |
setTicksPerDefaultNote(int ticksPerDefaultNote)
|
void |
stop()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int END_OF_TRACK
private javax.sound.midi.Sequence _sequence
private javax.sound.midi.Track _track
private int _bpm
private int _ticksPerDefaultNote
private int _ticksPerQuarterNote
private static int[] _offsets
private javax.sound.midi.Sequencer sequencer
private javax.sound.midi.Synthesizer synthesizer
Constructor Detail |
---|
public SequencePlayer(int ticksPerQuarterNote, int instrument) throws javax.sound.midi.InvalidMidiDataException, javax.sound.midi.MidiUnavailableException
ticksPerQuarterNote
- - tick definitioninstrument
- - MIDI instrument
javax.sound.midi.InvalidMidiDataException
- - thrown if MIDI isn't working
javax.sound.midi.MidiUnavailableException
Method Detail |
---|
public int addNote(Note note, int start)
note
- - the note to schedule in the sequencestart
- - the tick at which this note should start playing
public int addNote(Note note, int start, int velocity)
note
- - the note to schedule in the sequencestart
- - the tick at which this note should start playingvelocity
- - the volume (0-127)
public java.lang.String getInstruments()
public void play()
public void stop()
public int getTicksPerDefaultNote()
public void setTicksPerDefaultNote(int ticksPerDefaultNote)
ticksPerDefaultNote
- the _ticksPerDefaultNote to setpublic int getTempo()
public void setTempo(int bpm)
bpm
- - beats per minutepublic int getTicksPerQuarterNote()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |