public class SequencerImpl extends Object implements Sequencer
Sequencer
implementationSequencer.SyncMode
MidiDevice.Info
LOOP_CONTINUOUSLY
Constructor and Description |
---|
SequencerImpl()
Constructor
|
Modifier and Type | Method and Description |
---|---|
int[] |
addControllerEventListener(ControllerEventListener listener,
int[] controllers)
|
boolean |
addMetaEventListener(MetaEventListener listener)
Add
EventListener for MetaMessage |
void |
close()
Close the
MidiDevice . |
MidiDevice.Info |
getDeviceInfo()
Get the device information
|
int |
getLoopCount()
Get the count of loop.
|
long |
getLoopEndPoint()
Get the end point(ticks) of loop.
|
long |
getLoopStartPoint()
Get start point(ticks) of loop.
|
Sequencer.SyncMode |
getMasterSyncMode()
Get the
Sequencer.SyncMode for master. |
Sequencer.SyncMode[] |
getMasterSyncModes()
Get the available
Sequencer.SyncMode for master. |
int |
getMaxReceivers()
Get the number of the
Receiver s. |
int |
getMaxTransmitters()
Get the number of the
Transmitter s. |
long |
getMicrosecondLength()
Get the
Sequence length in microseconds. |
long |
getMicrosecondPosition()
Get the current microsecond position.
|
Receiver |
getReceiver()
Get the default
Receiver . |
List<Receiver> |
getReceivers()
Get the all of
Receiver s. |
Sequence |
getSequence()
Get the
Sequence |
Sequencer.SyncMode |
getSlaveSyncMode()
Get the
Sequencer.SyncMode for slave. |
Sequencer.SyncMode[] |
getSlaveSyncModes()
Get the available
Sequencer.SyncMode for slave. |
float |
getTempoFactor()
Get the tempo factor.
|
float |
getTempoInBPM()
Get the tempo in the Beats per minute.
|
float |
getTempoInMPQ()
Get the tempos in the microseconds per quarter note.
|
long |
getTickLength()
Get the
Sequence length in ticks. |
long |
getTickPosition()
Get the current tick position.
|
boolean |
getTrackMute(int track)
Get if the track is mute on the playback.
|
boolean |
getTrackSolo(int track)
Get if the track is solo on the playback.
|
Transmitter |
getTransmitter()
Get the default
Transmitter . |
List<Transmitter> |
getTransmitters()
Get the all of
Transmitter s. |
boolean |
isOpen()
Check if the
MidiDevice opened. |
boolean |
isRecording()
Get if the
Sequencer is recording. |
boolean |
isRunning()
Get if the
Sequencer is playing OR recording. |
void |
open()
Open the
MidiDevice . |
void |
recordDisable(Track track)
Set the
Track to disable recording |
void |
recordEnable(Track track,
int channel)
Set the
Track to enable recording on the specified channel. |
int[] |
removeControllerEventListener(ControllerEventListener listener,
int[] controllers)
Remove
EventListener for ShortMessage.CONTROL_CHANGE |
void |
removeMetaEventListener(MetaEventListener listener)
Remove
EventListener for MetaMessage |
void |
setLoopCount(int count)
Set count of loop.
|
void |
setLoopEndPoint(long tick)
Set end point(ticks) of loop.
|
void |
setLoopStartPoint(long tick)
Set start point(ticks) of loop.
|
void |
setMasterSyncMode(Sequencer.SyncMode sync)
Set the
Sequencer.SyncMode for master. |
void |
setMicrosecondPosition(long microseconds)
Set the current microsecond position.
|
void |
setSequence(InputStream stream)
Load a
Sequence from stream. |
void |
setSequence(Sequence sequence)
|
void |
setSlaveSyncMode(Sequencer.SyncMode sync)
Set the
Sequencer.SyncMode for slave. |
void |
setTempoFactor(float factor)
Set the tempo factor.
|
void |
setTempoInBPM(float bpm)
Set the tempo in the Beats per minute.
|
void |
setTempoInMPQ(float mpq)
Set the tempos in the microseconds per quarter note.
|
void |
setTickPosition(long tick)
Set the current tick position.
|
void |
setTrackMute(int track,
boolean mute)
Set the track to mute on the playback.
|
void |
setTrackSolo(int track,
boolean solo)
Set track to solo on the playback.
|
void |
start()
Start playing (starting at current sequencer position)
|
void |
startRecording()
Start recording (starting at current sequencer position)
|
void |
stop()
Stop playing AND recording.
|
void |
stopRecording()
Stop recording.
|
@NonNull public MidiDevice.Info getDeviceInfo()
MidiDevice
getDeviceInfo
in interface MidiDevice
public void open() throws MidiUnavailableException
MidiDevice
MidiDevice
. This method must be called at getting the new instance.open
in interface MidiDevice
MidiUnavailableException
public void close()
MidiDevice
MidiDevice
. This method must be called at finishing to use the instance.close
in interface MidiDevice
public boolean isOpen()
MidiDevice
MidiDevice
opened.isOpen
in interface MidiDevice
public int getMaxReceivers()
MidiDevice
Receiver
s.getMaxReceivers
in interface MidiDevice
Receiver
s.public int getMaxTransmitters()
MidiDevice
Transmitter
s.getMaxTransmitters
in interface MidiDevice
Transmitter
s.@NonNull public Receiver getReceiver() throws MidiUnavailableException
MidiDevice
Receiver
.getReceiver
in interface MidiDevice
Receiver
.MidiUnavailableException
@NonNull public List<Receiver> getReceivers()
MidiDevice
Receiver
s.getReceivers
in interface MidiDevice
Receiver
s.@NonNull public Transmitter getTransmitter() throws MidiUnavailableException
MidiDevice
Transmitter
.getTransmitter
in interface MidiDevice
Transmitter
.MidiUnavailableException
@NonNull public List<Transmitter> getTransmitters()
MidiDevice
Transmitter
s.getTransmitters
in interface MidiDevice
Transmitter
s.@NonNull public int[] addControllerEventListener(@NonNull ControllerEventListener listener, @NonNull int[] controllers)
Sequencer
addControllerEventListener
in interface Sequencer
listener
- event listenercontrollers
- controller codes@NonNull public int[] removeControllerEventListener(@NonNull ControllerEventListener listener, @NonNull int[] controllers)
Sequencer
EventListener
for ShortMessage.CONTROL_CHANGE
removeControllerEventListener
in interface Sequencer
listener
- event listenercontrollers
- controller codespublic boolean addMetaEventListener(@NonNull MetaEventListener listener)
Sequencer
EventListener
for MetaMessage
addMetaEventListener
in interface Sequencer
listener
- event listenerpublic void removeMetaEventListener(@NonNull MetaEventListener listener)
Sequencer
EventListener
for MetaMessage
removeMetaEventListener
in interface Sequencer
listener
- event listenerpublic int getLoopCount()
Sequencer
getLoopCount
in interface Sequencer
Sequencer.LOOP_CONTINUOUSLY
: play loops eternallypublic void setLoopCount(int count)
Sequencer
setLoopCount
in interface Sequencer
count
- Sequencer.LOOP_CONTINUOUSLY
: play loops eternallypublic long getLoopStartPoint()
Sequencer
getLoopStartPoint
in interface Sequencer
public void setLoopStartPoint(long tick)
Sequencer
setLoopStartPoint
in interface Sequencer
tick
- 0: start of Sequence
public long getLoopEndPoint()
Sequencer
getLoopEndPoint
in interface Sequencer
public void setLoopEndPoint(long tick)
Sequencer
setLoopEndPoint
in interface Sequencer
tick
- -1: end of Sequence
@NonNull public Sequencer.SyncMode getMasterSyncMode()
Sequencer
Sequencer.SyncMode
for master.getMasterSyncMode
in interface Sequencer
Sequencer.SyncMode
for master.public void setMasterSyncMode(@NonNull Sequencer.SyncMode sync)
Sequencer
Sequencer.SyncMode
for master.setMasterSyncMode
in interface Sequencer
sync
- the Sequencer.SyncMode
for master.@NonNull public Sequencer.SyncMode[] getMasterSyncModes()
Sequencer
Sequencer.SyncMode
for master.getMasterSyncModes
in interface Sequencer
Sequencer.SyncMode
for master.public long getMicrosecondPosition()
Sequencer
getMicrosecondPosition
in interface MidiDevice
getMicrosecondPosition
in interface Sequencer
public void setMicrosecondPosition(long microseconds)
Sequencer
setMicrosecondPosition
in interface Sequencer
microseconds
- the current microsecond positionpublic long getMicrosecondLength()
Sequencer
Sequence
length in microseconds.getMicrosecondLength
in interface Sequencer
Sequence
length in microsecondspublic Sequence getSequence()
Sequencer
Sequence
getSequence
in interface Sequencer
Sequence
public void setSequence(@NonNull InputStream stream) throws IOException, InvalidMidiDataException
Sequencer
Sequence
from stream.setSequence
in interface Sequencer
stream
- sequence sourceIOException
InvalidMidiDataException
public void setSequence(@Nullable Sequence sequence) throws InvalidMidiDataException
Sequencer
setSequence
in interface Sequencer
sequence
- the Sequence
InvalidMidiDataException
@NonNull public Sequencer.SyncMode getSlaveSyncMode()
Sequencer
Sequencer.SyncMode
for slave.getSlaveSyncMode
in interface Sequencer
Sequencer.SyncMode
for slave.public void setSlaveSyncMode(@NonNull Sequencer.SyncMode sync)
Sequencer
Sequencer.SyncMode
for slave.setSlaveSyncMode
in interface Sequencer
sync
- the Sequencer.SyncMode
for slave.@NonNull public Sequencer.SyncMode[] getSlaveSyncModes()
Sequencer
Sequencer.SyncMode
for slave.getSlaveSyncModes
in interface Sequencer
Sequencer.SyncMode
for slave.public float getTempoFactor()
Sequencer
getTempoFactor
in interface Sequencer
public void setTempoFactor(float factor)
Sequencer
Sequence
's tempo.setTempoFactor
in interface Sequencer
factor
- public float getTempoInBPM()
Sequencer
getTempoInBPM
in interface Sequencer
public void setTempoInBPM(float bpm)
Sequencer
setTempoInBPM
in interface Sequencer
bpm
- the tempo in the Beats per minutepublic float getTempoInMPQ()
Sequencer
getTempoInMPQ
in interface Sequencer
public void setTempoInMPQ(float mpq)
Sequencer
setTempoInMPQ
in interface Sequencer
mpq
- the tempos in the microseconds per quarter notepublic long getTickLength()
Sequencer
Sequence
length in ticks.getTickLength
in interface Sequencer
Sequence
length in tickspublic long getTickPosition()
Sequencer
getTickPosition
in interface Sequencer
public void setTickPosition(long tick)
Sequencer
setTickPosition
in interface Sequencer
tick
- the current tick positionpublic boolean getTrackMute(int track)
Sequencer
getTrackMute
in interface Sequencer
track
- the track numberpublic void setTrackMute(int track, boolean mute)
Sequencer
setTrackMute
in interface Sequencer
track
- the track numbermute
- true to set mute the trackpublic boolean getTrackSolo(int track)
Sequencer
getTrackSolo
in interface Sequencer
track
- the track numberpublic void setTrackSolo(int track, boolean solo)
Sequencer
setTrackSolo
in interface Sequencer
track
- the track numbersolo
- true to set solo the trackpublic void recordDisable(@Nullable Track track)
Sequencer
Track
to disable recordingrecordDisable
in interface Sequencer
track
- the Track
to disable recordingpublic void recordEnable(@NonNull Track track, int channel)
Sequencer
Track
to enable recording on the specified channel.recordEnable
in interface Sequencer
track
- the Track
channel
- the channel, 0-15public void startRecording()
Sequencer
Current Sequence
's events are sent to the all Transmitter
.
Received events art also sent to the all Transmitter
.
startRecording
in interface Sequencer
public boolean isRecording()
Sequencer
Sequencer
is recording.isRecording
in interface Sequencer
Sequencer
is recordingpublic void stopRecording()
Sequencer
stopRecording
in interface Sequencer
public void start()
Sequencer
public boolean isRunning()
Sequencer
Sequencer
is playing OR recording.