Endpoints known to the system. More...
Public Member Functions | |
std::vector< EndpointId > | getEndpoints () const |
Fetch endpoint ids. | |
void | getEndpoints (std::vector< EndpointId > &) const |
Fetch endpoint ids into the provided buffer. | |
std::optional< Endpoint > | getEndpoint (const EndpointId &) const |
Fetches information about a particular endpoint, or nullopt if the information is unavailable. | |
std::optional< StaticDeviceInfo > | getStaticDeviceInfo (const EndpointId &) const |
Fetches static information about a particular endpoint, or nullopt if the endpoint is unavailable, which might happen if the endpoint has been disconnected. | |
void | addListener (EndpointsListener &) |
Adds a listener that will receive notifications when endpoints are added, removed, or otherwise changed. | |
void | removeListener (EndpointsListener &) |
Removes a listener that was previously added with addListener(). | |
Session | makeSession (const String &name) const |
Creates a session to manage connections to endpoints. | |
std::optional< Backend > | getBackend () const |
Returns the technology that is being used to communicate with MIDI devices on this platform. | |
bool | isVirtualMidiBytestreamServiceActive () const |
Creating a virtual legacy port will only succeed if this function returns true. | |
bool | isVirtualMidiUmpServiceActive () const |
Creating a virtual UMP endpoint will only succeed if this function returns true. | |
void | setVirtualMidiBytestreamServiceActive (bool) |
By default, Android MIDI services are initially disabled, but can be enabled by calling this function, passing true. | |
void | setVirtualMidiUmpServiceActive (bool) |
By default, Android MIDI services are initially disabled, but can be enabled by calling this function, passing true. | |
~Endpoints () override |
Additional Inherited Members | |
Static Public Member Functions inherited from DeletedAtShutdown | |
static void | deleteAll () |
Deletes all extant objects. | |
Protected Member Functions inherited from DeletedAtShutdown | |
DeletedAtShutdown () | |
Creates a DeletedAtShutdown object. | |
virtual | ~DeletedAtShutdown () |
Destructor. |
Endpoints known to the system.
Use this to locate hardware and software devices that are capable of sending and receiving MIDI messages.
Call makeSession() to create a session that manages connections to those devices.
|
override |
std::vector< EndpointId > universal_midi_packets::Endpoints::getEndpoints | ( | ) | const |
Fetch endpoint ids.
void universal_midi_packets::Endpoints::getEndpoints | ( | std::vector< EndpointId > & | ) | const |
Fetch endpoint ids into the provided buffer.
std::optional< Endpoint > universal_midi_packets::Endpoints::getEndpoint | ( | const EndpointId & | ) | const |
Fetches information about a particular endpoint, or nullopt if the information is unavailable.
Currently, this function may return nullopt on Android for UMP devices that are connected but not opened.
If you're displaying endpoint names in a user-facing list, it's probably a good idea to use the Endpoint name if getEndpoint() returns a value. Otherwise, you can use the StaticDeviceInformation name if getStaticDeviceInformation() returns a value. If both functions return nullopt, this implies that the device is unknown/disconnected.
std::optional< StaticDeviceInfo > universal_midi_packets::Endpoints::getStaticDeviceInfo | ( | const EndpointId & | ) | const |
Fetches static information about a particular endpoint, or nullopt if the endpoint is unavailable, which might happen if the endpoint has been disconnected.
void universal_midi_packets::Endpoints::addListener | ( | EndpointsListener & | ) |
Adds a listener that will receive notifications when endpoints are added, removed, or otherwise changed.
void universal_midi_packets::Endpoints::removeListener | ( | EndpointsListener & | ) |
Removes a listener that was previously added with addListener().
Creates a session to manage connections to endpoints.
It's possible for this function to fail, in which case Session::isAlive() will return false.
References name.
std::optional< Backend > universal_midi_packets::Endpoints::getBackend | ( | ) | const |
Returns the technology that is being used to communicate with MIDI devices on this platform.
This is mainly relevant on Windows, where there are several different MIDI implementations.
The intended use of this getter is to allow programs to detect whether the Windows MIDI Services (WMS) are active and running. If initialisation of WMS failed, the implementation will fall back to an earlier, more limited implementation. Programs may wish to detect this situation so that they can direct users to install the WMS SDK.
If no MIDI technology is available, this returns nullopt.
bool universal_midi_packets::Endpoints::isVirtualMidiBytestreamServiceActive | ( | ) | const |
Creating a virtual legacy port will only succeed if this function returns true.
On platforms that support virtual MIDI connections (macOS, iOS, ALSA, Windows MIDI Services), this will normally return true. On platforms that don't support virtual MIDI (older Windows MIDI APIs), this will always return false. On Android, this will return false until the virtual MIDI service has started, and will return true while the service is running. You can listen for virtualMidiServiceActiveChanged() to take actions (e.g. creating or destroying virtual ports) when the service status changes.
bool universal_midi_packets::Endpoints::isVirtualMidiUmpServiceActive | ( | ) | const |
Creating a virtual UMP endpoint will only succeed if this function returns true.
On recent platforms that support virtual MIDI connections (recent macOS and iOS, recent ALSA, Windows MIDI Services), this will normally return true. On platforms that don't support virtual MIDI (older Windows MIDI APIs), this will always return false. On Android, this will return false until the virtual MIDI service has started, and will return true while the service is running. You can listen for virtualMidiServiceActiveChanged() to take actions (e.g. creating or destroying virtual ports) when the service status changes.
void universal_midi_packets::Endpoints::setVirtualMidiBytestreamServiceActive | ( | bool | ) |
By default, Android MIDI services are initially disabled, but can be enabled by calling this function, passing true.
This function is not synchronous, so the service will start or stop at some point after this function has returned. To find out when the service state changes, listen for virtualMidiServiceActiveChanged() and check the result of isVirtualMidiBytestreamServiceActive().
On platforms other than Android, this call does nothing.
void universal_midi_packets::Endpoints::setVirtualMidiUmpServiceActive | ( | bool | ) |
By default, Android MIDI services are initially disabled, but can be enabled by calling this function, passing true.
This function is not synchronous, so the service will start or stop at some point after this function has returned. To find out when the service state changes, listen for virtualMidiServiceActiveChanged() and check the result of isVirtualMidiUmpServiceActive(). On Android versions that don't support virtual UMP (API level < 35), this call does nothing.
On platforms other than Android, this call does nothing.