Pulp 1.88.0
Cross-platform audio plugin framework
Loading...
Searching...
No Matches
pulp::midi::VirtualUmpEndpoint Class Reference

#include <ump_virtual_endpoint.hpp>

Public Member Functions

 VirtualUmpEndpoint (VirtualUmpEndpointConfig cfg)
const UmpEndpointInfo & info () const noexcept override
 Snapshot of the endpoint's static metadata.
void set_receive_callback (UmpReceiveCallback cb) override
 Register the receive callback.
bool send (const UmpPacket &packet) override
 send() writes a packet "out" of this endpoint.
bool is_open () const noexcept override
 True iff the endpoint is currently usable (port connected, virtual endpoint live).
bool deliver (const UmpPacket &packet, double timestamp_sec=0.0)
 Deliver a packet directly to the receive callback as if it arrived from elsewhere.
std::uint64_t sent_count () const noexcept
 Atomic counters useful for tests; never load-bearing for the real backend (CoreMIDI counters live elsewhere).
std::uint64_t delivered_count () const noexcept
void close ()
 Tear-down hook — marks is_open() false and detaches the callback.

Constructor & Destructor Documentation

◆ VirtualUmpEndpoint()

pulp::midi::VirtualUmpEndpoint::VirtualUmpEndpoint ( VirtualUmpEndpointConfig cfg)
explicit

Member Function Documentation

◆ close()

void pulp::midi::VirtualUmpEndpoint::close ( )

Tear-down hook — marks is_open() false and detaches the callback.

After close(), send() returns false and deliver() is a no-op. Idempotent.

◆ deliver()

bool pulp::midi::VirtualUmpEndpoint::deliver ( const UmpPacket & packet,
double timestamp_sec = 0.0 )

Deliver a packet directly to the receive callback as if it arrived from elsewhere.

This is the "into" side of the endpoint: a test partner uses it to feed packets without pretending to be the OS.

◆ delivered_count()

std::uint64_t pulp::midi::VirtualUmpEndpoint::delivered_count ( ) const
inlinenoexcept

◆ info()

const UmpEndpointInfo & pulp::midi::VirtualUmpEndpoint::info ( ) const
inlineoverridevirtualnoexcept

Snapshot of the endpoint's static metadata.

Implements pulp::midi::UmpEndpoint.

◆ is_open()

bool pulp::midi::VirtualUmpEndpoint::is_open ( ) const
inlineoverridevirtualnoexcept

True iff the endpoint is currently usable (port connected, virtual endpoint live).

Implements pulp::midi::UmpEndpoint.

◆ send()

bool pulp::midi::VirtualUmpEndpoint::send ( const UmpPacket & packet)
overridevirtual

send() writes a packet "out" of this endpoint.

If loopback is true the receive callback also fires. Returns false only if the endpoint advertises can_send = false.

Implements pulp::midi::UmpEndpoint.

◆ sent_count()

std::uint64_t pulp::midi::VirtualUmpEndpoint::sent_count ( ) const
inlinenoexcept

Atomic counters useful for tests; never load-bearing for the real backend (CoreMIDI counters live elsewhere).

◆ set_receive_callback()

void pulp::midi::VirtualUmpEndpoint::set_receive_callback ( UmpReceiveCallback cb)
overridevirtual

Register the receive callback.

Pass nullptr to detach. Calling this while the endpoint is open is permitted: the new callback takes effect for subsequent deliveries (callers that care about strict ordering should detach, drain, then re-attach).

On endpoints that lack a receive direction this is a no-op.

Implements pulp::midi::UmpEndpoint.


The documentation for this class was generated from the following file: