Loading...
Searching...
No Matches
universal_midi_packets::Endpoints Class Reference

Endpoints known to the system. More...

Inheritance diagram for universal_midi_packets::Endpoints:

Public Member Functions

std::vector< EndpointIdgetEndpoints () const
 Fetch endpoint ids.
void getEndpoints (std::vector< EndpointId > &) const
 Fetch endpoint ids into the provided buffer.
std::optional< EndpointgetEndpoint (const EndpointId &) const
 Fetches information about a particular endpoint, or nullopt if the information is unavailable.
std::optional< StaticDeviceInfogetStaticDeviceInfo (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< BackendgetBackend () 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.

Detailed Description

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.

Constructor & Destructor Documentation

◆ ~Endpoints()

universal_midi_packets::Endpoints::~Endpoints ( )
override

Member Function Documentation

◆ getEndpoints() [1/2]

std::vector< EndpointId > universal_midi_packets::Endpoints::getEndpoints ( ) const

Fetch endpoint ids.

◆ getEndpoints() [2/2]

void universal_midi_packets::Endpoints::getEndpoints ( std::vector< EndpointId > & ) const

Fetch endpoint ids into the provided buffer.

◆ getEndpoint()

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.

◆ getStaticDeviceInfo()

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.

◆ addListener()

void universal_midi_packets::Endpoints::addListener ( EndpointsListener & )

Adds a listener that will receive notifications when endpoints are added, removed, or otherwise changed.

◆ removeListener()

void universal_midi_packets::Endpoints::removeListener ( EndpointsListener & )

Removes a listener that was previously added with addListener().

◆ makeSession()

Session universal_midi_packets::Endpoints::makeSession ( const String & name) const

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.

◆ getBackend()

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.

◆ isVirtualMidiBytestreamServiceActive()

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.

◆ isVirtualMidiUmpServiceActive()

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.

◆ setVirtualMidiBytestreamServiceActive()

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.

◆ setVirtualMidiUmpServiceActive()

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.

linkedin facebook pinterest youtube rss twitter instagram facebook-blank rss-blank linkedin-blank pinterest youtube twitter instagram