public class InputModel extends Object implements AutoCloseable, ParsedTrack
Modifier and Type | Method and Description |
---|---|
void |
addInputDeviceListener(Consumer<? super MidiDevice.Info> listener)
Adds a listener to notify when the input device has changed.
|
void |
addInputListener(Consumer<? super Event> listener)
Adds a listener to notify when the user has pressed a key
|
void |
close() |
static InputModel |
create(OutputModel outputModel)
Constructs a new
InputModel with the specified initial state. |
Iterable<EventPair<NoteEvent>> |
getNotePairs(long low,
long high)
Gets the note event pairs overlapping with the specified interval
|
Iterable<EventPair<PedalEvent>> |
getPedalPairs(long low,
long high)
Gets the pedal event pairs overlapping with the specified interval
|
void |
setInputDevice(MidiDevice input)
Reconnects the input to a different MIDI input device.
|
public static InputModel create(OutputModel outputModel) throws MidiUnavailableException
InputModel
with the specified initial state.
After construction, the input model is not connected to any actual devices. It is expected that the consumer will change the input device.
outputModel
- the output model to coordinate withInputModel
. The caller is responsible
for releasing the resource.MidiUnavailableException
- if the MIDI system is unavailable.public void setInputDevice(MidiDevice input) throws MidiUnavailableException
input
- the new input MIDI device to reconnect toMidiUnavailableException
- if the MIDI system is unavailable.public void addInputDeviceListener(Consumer<? super MidiDevice.Info> listener)
listener
- the listener to addpublic void addInputListener(Consumer<? super Event> listener)
listener
- the listener to addpublic void close()
close
in interface AutoCloseable
public Iterable<EventPair<NoteEvent>> getNotePairs(long low, long high)
ParsedTrack
getNotePairs
in interface ParsedTrack
low
- the lower inclusive bound to return events for in microsecondshigh
- the upper inclusive bound to return events for in microsecondspublic Iterable<EventPair<PedalEvent>> getPedalPairs(long low, long high)
ParsedTrack
getPedalPairs
in interface ParsedTrack
low
- the lower inclusive bound to return events for in microsecondshigh
- the upper inclusive bound to return events for in microsecondsCopyright © 2015 Kreatious LLC. All rights reserved.