Class CoreMidiDestination
- java.lang.Object
-
- uk.co.xfactorylibrarians.coremidi4j.CoreMidiDestination
-
- All Implemented Interfaces:
AutoCloseable
,MidiDevice
public class CoreMidiDestination extends Object implements MidiDevice
Provides a working Java MIDI interface to a CoreMIDI device to which we can send messages.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface javax.sound.midi.MidiDevice
MidiDevice.Info
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
Closes the Core MIDI Device, which also closes all of its receiversMidiDevice.Info
getDeviceInfo()
Gets the MIDI Info objectint
getMaxReceivers()
Gets the maximum number of receivers that can be attached to this device.int
getMaxTransmitters()
Gets the maximum number of transmitters that can be attached to this device.long
getMicrosecondPosition()
Obtains the time in microseconds that has elapsed since this MIDI Device was opened.Receiver
getReceiver()
Creates and returns a MIDI Receiver for use with this DeviceList<Receiver>
getReceivers()
Gets a list of receivers connected to the devicelong
getStartTime()
Obtains the time in microseconds at which this MIDI Device was opened.Transmitter
getTransmitter()
Gets a transmitter for this device (which is also added to the internal listList<Transmitter>
getTransmitters()
Gets the list of transmitters registered with this MIDI deviceboolean
isOpen()
Checks to see if the MIDI Device is openvoid
open()
Opens the Core MIDI Device
-
-
-
Method Detail
-
getDeviceInfo
public MidiDevice.Info getDeviceInfo()
Gets the MIDI Info object- Specified by:
getDeviceInfo
in interfaceMidiDevice
- Returns:
- the MIDI Info object, which provides details about the interface
-
open
public void open() throws MidiUnavailableException
Opens the Core MIDI Device- Specified by:
open
in interfaceMidiDevice
- Throws:
MidiUnavailableException
- if the MIDI system cannot be accessed
-
close
public void close()
Closes the Core MIDI Device, which also closes all of its receivers- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceMidiDevice
-
isOpen
public boolean isOpen()
Checks to see if the MIDI Device is open- Specified by:
isOpen
in interfaceMidiDevice
- Returns:
- true if the device is open, otherwise false;
- See Also:
MidiDevice.isOpen()
-
getMicrosecondPosition
public long getMicrosecondPosition()
Obtains the time in microseconds that has elapsed since this MIDI Device was opened.- Specified by:
getMicrosecondPosition
in interfaceMidiDevice
- Returns:
- the time in microseconds that has elapsed since this MIDI Device was opened.
- See Also:
MidiDevice.getMicrosecondPosition()
-
getStartTime
public long getStartTime()
Obtains the time in microseconds at which this MIDI Device was opened.- Returns:
- the time in microseconds that was recorded when this device was opened.
-
getMaxReceivers
public int getMaxReceivers()
Gets the maximum number of receivers that can be attached to this device.- Specified by:
getMaxReceivers
in interfaceMidiDevice
- Returns:
- the maximum number of receivers that can be attached to this device. -1 is returned to indicate that the number is unlimited
- See Also:
MidiDevice.getMaxReceivers()
-
getMaxTransmitters
public int getMaxTransmitters()
Gets the maximum number of transmitters that can be attached to this device.- Specified by:
getMaxTransmitters
in interfaceMidiDevice
- Returns:
- the maximum number of transmitters that can be attached to this device. -1 is returned to indicate that the number is unlimited
- See Also:
MidiDevice.getMaxTransmitters()
-
getReceiver
public Receiver getReceiver() throws MidiUnavailableException
Creates and returns a MIDI Receiver for use with this Device- Specified by:
getReceiver
in interfaceMidiDevice
- Returns:
- the created receiver
- Throws:
MidiUnavailableException
- See Also:
MidiDevice.getReceiver()
-
getReceivers
public List<Receiver> getReceivers()
Gets a list of receivers connected to the device- Specified by:
getReceivers
in interfaceMidiDevice
- Returns:
- the list of receivers that have been created from this device that are still open
- See Also:
MidiDevice.getReceivers()
-
getTransmitter
public Transmitter getTransmitter() throws MidiUnavailableException
Gets a transmitter for this device (which is also added to the internal list- Specified by:
getTransmitter
in interfaceMidiDevice
- Returns:
- a transmitter for this device
- Throws:
MidiUnavailableException
- See Also:
MidiDevice.getTransmitter()
-
getTransmitters
public List<Transmitter> getTransmitters()
Gets the list of transmitters registered with this MIDI device- Specified by:
getTransmitters
in interfaceMidiDevice
- Returns:
- The list of transmitters registered with this MIDI device
- See Also:
MidiDevice.getTransmitters()
-
-