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

Represents a virtual device that allows this program to advertise itself to other MIDI-aware applications on the system. More...

Public Member Functions

 VirtualEndpoint ()
 Creates an invalid virtual endpoint that doesn't correspond to any virtual device.
 ~VirtualEndpoint ()
 VirtualEndpoint (VirtualEndpoint &&) noexcept
VirtualEndpointoperator= (VirtualEndpoint &&) noexcept
 VirtualEndpoint (const VirtualEndpoint &)=delete
VirtualEndpointoperator= (const VirtualEndpoint &)=delete
EndpointId getId () const
 Retrieves the unique id of this endpoint.
bool setBlock (uint8_t index, const Block &newBlock)
 Sets new properties for the block at the given zero-based index.
bool setName (const String &)
 Assigns a new name to this endpoint, and sends a notification to connected endpoints.
bool isAlive () const
 Returns true if this object represents an endpoint that is currently alive, or false if the endpoint is not alive.
 operator bool () const

Detailed Description

Represents a virtual device that allows this program to advertise itself to other MIDI-aware applications on the system.

Creating a VirtualEndpoint will install a new endpoint on the system. This endpoint will be visible when enumerating endpoints using the Endpoints singleton. If you're displaying a list of endpoints in your UI, it's probably a good idea to omit any virtual endpoints created by the current application in order to avoid confusion.

After creating a VirtualEndpoint, it can be opened like any other connection, by calling Session::connectInput() and Session::connectOutput(), passing the EndpointId for the virtual endpoint.

Constructor & Destructor Documentation

◆ VirtualEndpoint() [1/3]

universal_midi_packets::VirtualEndpoint::VirtualEndpoint ( )

Creates an invalid virtual endpoint that doesn't correspond to any virtual device.

isAlive() will return false for a default-constructed VirtualEndpoint.

Referenced by operator=(), operator=(), VirtualEndpoint(), and VirtualEndpoint().

◆ ~VirtualEndpoint()

universal_midi_packets::VirtualEndpoint::~VirtualEndpoint ( )

◆ VirtualEndpoint() [2/3]

universal_midi_packets::VirtualEndpoint::VirtualEndpoint ( VirtualEndpoint && )
noexcept

References VirtualEndpoint().

◆ VirtualEndpoint() [3/3]

universal_midi_packets::VirtualEndpoint::VirtualEndpoint ( const VirtualEndpoint & )
delete

References VirtualEndpoint().

Member Function Documentation

◆ operator=() [1/2]

VirtualEndpoint & universal_midi_packets::VirtualEndpoint::operator= ( VirtualEndpoint && )
noexcept

References VirtualEndpoint().

◆ operator=() [2/2]

VirtualEndpoint & universal_midi_packets::VirtualEndpoint::operator= ( const VirtualEndpoint & )
delete

References VirtualEndpoint().

◆ getId()

EndpointId universal_midi_packets::VirtualEndpoint::getId ( ) const

Retrieves the unique id of this endpoint.

Pass this ID to Session::connectInput() and/or Session::connectOutput in order to send and receive messages through the virtual endpoint.

Note that this ID is not guaranteed to be stable - creating the 'same' virtual device across several program invocations may produce a different ID each time.

To fetch the current details of this device, you can pass this ID to Endpoints::getEndpoint().

References getId().

Referenced by getId().

◆ setBlock()

bool universal_midi_packets::VirtualEndpoint::setBlock ( uint8_t index,
const Block & newBlock )

Sets new properties for the block at the given zero-based index.

The number of function blocks on an endpoint may not change.

Returns true on success, or false otherwise.

This may fail for several reasons, including:

  • attempting to modify an endpoint with static function blocks
  • attempting to update a block index that doesn't exist on this endpoint
  • attempting to set a block with invalid properties, e.g. the sum of the start index and number of included groups is greater than 16
  • platform-specific reasons, e.g. macOS doesn't currently allow changing the number of spanned groups in a block

References setBlock().

Referenced by setBlock().

◆ setName()

bool universal_midi_packets::VirtualEndpoint::setName ( const String & )

Assigns a new name to this endpoint, and sends a notification to connected endpoints.

References setName().

Referenced by setName().

◆ isAlive()

bool universal_midi_packets::VirtualEndpoint::isAlive ( ) const

Returns true if this object represents an endpoint that is currently alive, or false if the endpoint is not alive.

This can happen because the endpoint failed to open, or if the session holding the endpoint was closed.

This function returns false for a default-constructed instance.

References isAlive().

Referenced by isAlive(), and operator bool().

◆ operator bool()

universal_midi_packets::VirtualEndpoint::operator bool ( ) const
explicit

References isAlive().

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