Ardour
9.0-pre0-582-g084a23a80d
|
#include <port_engine.h>
Public Types | |
typedef std::shared_ptr< ProtoPort > | PortPtr |
typedef PortPtr const & | PortHandle |
Public Member Functions | |
PortEngine (PortManager &pm) | |
virtual | ~PortEngine () |
virtual void * | private_handle () const =0 |
virtual const std::string & | my_name () const =0 |
virtual uint32_t | port_name_size () const =0 |
virtual int | set_port_name (PortHandle port, const std::string &name)=0 |
virtual std::string | get_port_name (PortHandle port) const =0 |
virtual PortFlags | get_port_flags (PortHandle port) const =0 |
virtual int | get_port_property (PortHandle, const std::string &key, std::string &value, std::string &type) const |
virtual int | set_port_property (PortHandle, const std::string &key, const std::string &value, const std::string &type) |
virtual PortPtr | get_port_by_name (const std::string &name) const =0 |
virtual int | get_ports (const std::string &port_name_pattern, DataType type, PortFlags flags, std::vector< std::string > &ports) const =0 |
virtual DataType | port_data_type (PortHandle port) const =0 |
virtual PortPtr | register_port (const std::string &shortname, ARDOUR::DataType type, ARDOUR::PortFlags flags)=0 |
virtual void | unregister_port (PortHandle port)=0 |
virtual int | connect (const std::string &src, const std::string &dst)=0 |
virtual int | disconnect (const std::string &src, const std::string &dst)=0 |
virtual int | connect (PortHandle src, const std::string &dst)=0 |
virtual int | disconnect (PortHandle src, const std::string &dst)=0 |
virtual int | disconnect_all (PortHandle port)=0 |
virtual bool | connected (PortHandle port, bool process_callback_safe=true)=0 |
virtual bool | connected_to (PortHandle port, const std::string &name, bool process_callback_safe=true)=0 |
virtual bool | physically_connected (PortHandle port, bool process_callback_safe=true)=0 |
virtual bool | externally_connected (PortHandle port, bool process_callback_safe=true) |
virtual int | get_connections (PortHandle port, std::vector< std::string > &names, bool process_callback_safe=true)=0 |
virtual int | midi_event_get (pframes_t ×tamp, size_t &size, uint8_t const **buf, void *port_buffer, uint32_t event_index)=0 |
virtual int | midi_event_put (void *port_buffer, pframes_t timestamp, const uint8_t *buffer, size_t size)=0 |
virtual uint32_t | get_midi_event_count (void *port_buffer)=0 |
virtual void | midi_clear (void *port_buffer)=0 |
virtual bool | can_monitor_input () const =0 |
virtual int | request_input_monitoring (PortHandle port, bool yn)=0 |
virtual int | ensure_input_monitoring (PortHandle port, bool yn)=0 |
virtual bool | monitoring_input (PortHandle port)=0 |
virtual void | set_latency_range (PortHandle port, bool for_playback, LatencyRange r)=0 |
virtual LatencyRange | get_latency_range (PortHandle port, bool for_playback)=0 |
virtual bool | port_is_physical (PortHandle port) const =0 |
virtual void | get_physical_outputs (DataType type, std::vector< std::string > &names)=0 |
virtual void | get_physical_inputs (DataType type, std::vector< std::string > &names)=0 |
virtual ChanCount | n_physical_outputs () const =0 |
virtual ChanCount | n_physical_inputs () const =0 |
virtual void * | get_buffer (PortHandle port, pframes_t off)=0 |
virtual samplepos_t | sample_time_at_cycle_start ()=0 |
Protected Attributes | |
PortManager & | manager |
Definition at line 83 of file port_engine.h.
typedef PortPtr const& ARDOUR::PortEngine::PortHandle |
Definition at line 113 of file port_engine.h.
typedef std::shared_ptr<ProtoPort> ARDOUR::PortEngine::PortPtr |
Opaque handle to use as reference for Ports
The handle needs to be lifetime managed (i.e. a shared_ptr type) in order to allow RCU to provide lock-free cross-thread operations on ports and ports containers.
We could theoretically use a template (PortEngine<T>) and define PortHandle as T, but this complicates the desired inheritance pattern in which FooPortEngine handles things for the Foo API, rather than being a derivative of PortEngine<Foo>.
We use this to declare return values and members of structures.
Definition at line 107 of file port_engine.h.
|
inline |
Definition at line 86 of file port_engine.h.
|
inlinevirtual |
Definition at line 87 of file port_engine.h.
|
pure virtual |
Return true if the implementation can offer input monitoring.
Input monitoring involves the (selective) routing of incoming data to an outgoing data stream, without the data being passed to the CPU.
Only certain audio hardware can provide this, and only certain audio APIs can offer it.
Implemented in ARDOUR::PulseAudioBackend, ARDOUR::PortAudioBackend, ARDOUR::JACKAudioBackend, ARDOUR::DummyAudioBackend, ARDOUR::CoreAudioBackend, and ARDOUR::AlsaAudioBackend.
|
pure virtual |
Ensure that data written to the port named by src
will be readable from the port named by dst
src | name of source port to connect |
dst | name of destination (sink) port |
Implemented in ARDOUR::PulseAudioBackend, ARDOUR::PortAudioBackend, ARDOUR::JACKAudioBackend, ARDOUR::DummyAudioBackend, ARDOUR::CoreAudioBackend, and ARDOUR::AlsaAudioBackend.
|
pure virtual |
Ensure that data written to the port referenced by src
will be readable from the port named by dst
src | PortHandle of source port to connect |
dst | PortHandle of destination (sink) port |
Implemented in ARDOUR::JACKAudioBackend, ARDOUR::PulseAudioBackend, ARDOUR::PortAudioBackend, ARDOUR::DummyAudioBackend, ARDOUR::CoreAudioBackend, and ARDOUR::AlsaAudioBackend.
|
pure virtual |
Test if given port
is connected
port | PortHandle of port to test |
process_callback_safe | true if this method is not called from rt-context of backend callbacks |
port
has any connections to other ports. Return false otherwise. Implemented in ARDOUR::JACKAudioBackend, ARDOUR::PulseAudioBackend, ARDOUR::PortAudioBackend, ARDOUR::DummyAudioBackend, ARDOUR::CoreAudioBackend, and ARDOUR::AlsaAudioBackend.
|
pure virtual |
Test port connection
port | PortHandle of source port to test |
name | name of destination to test |
process_callback_safe | true if this method is not called from rt-context of backend callbacks |
port
is connected to the port named by name
. Return false otherwise. Implemented in ARDOUR::JACKAudioBackend, ARDOUR::PulseAudioBackend, ARDOUR::PortAudioBackend, ARDOUR::DummyAudioBackend, ARDOUR::CoreAudioBackend, and ARDOUR::AlsaAudioBackend.
|
pure virtual |
Remove any existing connection between the ports named by src
and dst
src | name of source port to dis-connect to disconnect from |
dst | name of destination (sink) port to disconnect |
Implemented in ARDOUR::PulseAudioBackend, ARDOUR::PortAudioBackend, ARDOUR::JACKAudioBackend, ARDOUR::DummyAudioBackend, ARDOUR::CoreAudioBackend, and ARDOUR::AlsaAudioBackend.
|
pure virtual |
Remove any existing connection between the port referenced by src
and the port named dst
src | PortHandle of source port to disconnect from |
dst | PortHandle of destination (sink) port to disconnect |
Implemented in ARDOUR::JACKAudioBackend, ARDOUR::PulseAudioBackend, ARDOUR::PortAudioBackend, ARDOUR::DummyAudioBackend, ARDOUR::CoreAudioBackend, and ARDOUR::AlsaAudioBackend.
|
pure virtual |
Remove all connections between the port referred to by port
and any other ports.
port | PortHandle of port to disconnect |
Implemented in ARDOUR::JACKAudioBackend, ARDOUR::PulseAudioBackend, ARDOUR::PortAudioBackend, ARDOUR::DummyAudioBackend, ARDOUR::CoreAudioBackend, and ARDOUR::AlsaAudioBackend.
|
pure virtual |
|
inlinevirtual |
Test if given port
is has external connections.
port | PortHandle of port to test |
process_callback_safe | true if this method is not called from rt-context of backend callbacks |
port
has any connections to external, not-ardour owned, ports. Reimplemented in ARDOUR::JACKAudioBackend.
Definition at line 301 of file port_engine.h.
|
pure virtual |
Return the address of the memory area where data for the port can be written (if the port has the PortFlag IsOutput set) or read (if the port has the PortFlag IsInput set).
The return value is untyped because buffers containing different data depending on the port type.
port | PortHandle |
off | memory offset |
Implemented in ARDOUR::PulseAudioBackend, ARDOUR::PortAudioBackend, ARDOUR::JACKAudioBackend, ARDOUR::DummyAudioBackend, ARDOUR::CoreAudioBackend, and ARDOUR::AlsaAudioBackend.
|
pure virtual |
Place the names of all ports connected to the port named by port
into names
.
port | PortHandle |
names | array or returned port-names |
process_callback_safe | true if this method is not called from rt-context of backend callbacks |
Implemented in ARDOUR::JACKAudioBackend, ARDOUR::PulseAudioBackend, ARDOUR::PortAudioBackend, ARDOUR::DummyAudioBackend, ARDOUR::CoreAudioBackend, and ARDOUR::AlsaAudioBackend.
|
pure virtual |
Return the latency range for the port referred to by port
. The playback range will be returned if for_playback
is true, otherwise the capture range will be returned.
port | The PortHandle to query |
for_playback | When true, playback (downstream) latency is queried, false for capture (upstream) latency. |
Implemented in ARDOUR::PulseAudioBackend, ARDOUR::PortAudioBackend, ARDOUR::JACKAudioBackend, ARDOUR::DummyAudioBackend, ARDOUR::CoreAudioBackend, and ARDOUR::AlsaAudioBackend.
|
pure virtual |
Query the number of MIDI events in the data at port_buffer
port_buffer | the midi-port buffer |
port_buffer
Implemented in ARDOUR::PulseAudioBackend, ARDOUR::PortAudioBackend, ARDOUR::JACKAudioBackend, ARDOUR::DummyAudioBackend, ARDOUR::CoreAudioBackend, and ARDOUR::AlsaAudioBackend.
|
pure virtual |
Store into names
the names of all ports with the IsInput and IsPhysical flags set, that handle data of type type
.
This can be used to discover inputs associated with hardware devices.
Implemented in ARDOUR::PulseAudioBackend, ARDOUR::PortAudioBackend, ARDOUR::DummyAudioBackend, ARDOUR::CoreAudioBackend, ARDOUR::AlsaAudioBackend, and ARDOUR::JACKAudioBackend.
|
pure virtual |
Store into names
the names of all ports with the IsOutput and IsPhysical flag set, that handle data of type type
.
This can be used to discover outputs associated with hardware devices.
type | Data-type to lookup |
names | return value to populate with names |
Implemented in ARDOUR::PulseAudioBackend, ARDOUR::PortAudioBackend, ARDOUR::DummyAudioBackend, ARDOUR::CoreAudioBackend, ARDOUR::AlsaAudioBackend, and ARDOUR::JACKAudioBackend.
|
pure virtual |
Return a reference to a port with the fullname name
.
name | Full port-name to lookup |
Implemented in ARDOUR::PulseAudioBackend, ARDOUR::PortAudioBackend, ARDOUR::DummyAudioBackend, ARDOUR::CoreAudioBackend, ARDOUR::AlsaAudioBackend, and ARDOUR::JACKAudioBackend.
|
pure virtual |
Query port-flags
port | PortHandle |
port
. If the port does not exist, return PortFlags (0) Implemented in ARDOUR::JACKAudioBackend, ARDOUR::PulseAudioBackend, ARDOUR::PortAudioBackend, ARDOUR::DummyAudioBackend, ARDOUR::CoreAudioBackend, and ARDOUR::AlsaAudioBackend.
|
pure virtual |
Query port name
port | PortHandle |
port
. If the port does not exist, return an empty string. Implemented in ARDOUR::JACKAudioBackend, ARDOUR::PulseAudioBackend, ARDOUR::PortAudioBackend, ARDOUR::DummyAudioBackend, ARDOUR::CoreAudioBackend, and ARDOUR::AlsaAudioBackend.
|
inlinevirtual |
Return the port-property value and type for a given key. (eg query a human readable port name)
The API follows jack_get_property():
key | The key of the property to retrieve |
value | Set to the value of the property if found |
type | The type of the property if set ( Type of data, either a MIME type or URI. If type is empty, the data is assumed to be a UTF-8 encoded string. |
subject
has no key
property.for available keys, see https://github.com/jackaudio/headers/blob/master/metadata.h https://github.com/drobilla/jackey/blob/master/jackey.h
Reimplemented in ARDOUR::JACKAudioBackend, ARDOUR::PulseAudioBackend, ARDOUR::PortAudioBackend, ARDOUR::DummyAudioBackend, ARDOUR::CoreAudioBackend, and ARDOUR::AlsaAudioBackend.
Definition at line 164 of file port_engine.h.
|
pure virtual |
Find the set of ports whose names, types and flags match specified values, place the names of each port into ports
.
port_name_pattern | match by given pattern. To avoid selecting by name, pass an empty string. |
type | filter by given type; pass DataType::NIL to match all types. |
flags | filter by flags, pass PortFlags (0) to avoid selecting by flags. |
ports | array filled with matching port-names |
Implemented in ARDOUR::PulseAudioBackend, ARDOUR::PortAudioBackend, ARDOUR::DummyAudioBackend, ARDOUR::CoreAudioBackend, ARDOUR::AlsaAudioBackend, and ARDOUR::JACKAudioBackend.
|
pure virtual |
Clear the buffer at port_buffer
of all MIDI events.
After a call to this method, an immediate, subsequent call to get_midi_event_count with the same port_buffer
argument must return zero.
port_buffer | the buffer to clear |
Implemented in ARDOUR::PulseAudioBackend, ARDOUR::PortAudioBackend, ARDOUR::JACKAudioBackend, ARDOUR::DummyAudioBackend, ARDOUR::CoreAudioBackend, and ARDOUR::AlsaAudioBackend.
|
pure virtual |
Retrieve a MIDI event from the data at port_buffer
. The event number to be retrieved is given by event_index
(a value of zero indicates that the first event in the port_buffer should be retrieved).
The data associated with the event will be copied into the buffer at buf
and the number of bytes written will be stored in size
. The timestamp of the event (which is always relative to the start of the current process cycle, in samples) will be stored in timestamp
.
timestamp | time in samples relative to the current cycle start |
size | number of bytes read into buf |
buf | raw MIDI data |
port_buffer | the midi-port buffer |
event_index | index of event to retrieve |
Implemented in ARDOUR::PulseAudioBackend, ARDOUR::PortAudioBackend, ARDOUR::JACKAudioBackend, ARDOUR::DummyAudioBackend, ARDOUR::CoreAudioBackend, and ARDOUR::AlsaAudioBackend.
|
pure virtual |
Place a MIDI event consisting of size
bytes copied from the data at buffer
into the port buffer referred to by port_buffer
. The MIDI event will be marked with a time given by timestamp
.
Events must be added monotonically to a port buffer. An attempt to add a non-monotonic event (e.g. out-of-order) will cause this method to return a failure status.
port_buffer | the midi-port buffer |
timestamp | time in samples relative to the current cycle start |
buffer | raw MIDI data to emplace |
size | number of bytes of buffer |
Implemented in ARDOUR::PulseAudioBackend, ARDOUR::PortAudioBackend, ARDOUR::JACKAudioBackend, ARDOUR::DummyAudioBackend, ARDOUR::CoreAudioBackend, and ARDOUR::AlsaAudioBackend.
|
pure virtual |
Query status of hardware monitoring for given port
port | PortHandle to test |
port
. Return false otherwise. Implemented in ARDOUR::PulseAudioBackend, ARDOUR::PortAudioBackend, ARDOUR::JACKAudioBackend, ARDOUR::DummyAudioBackend, ARDOUR::CoreAudioBackend, and ARDOUR::AlsaAudioBackend.
|
pure virtual |
Return the name of this process as used by the port manager when naming ports.
Implemented in ARDOUR::PulseAudioBackend, ARDOUR::PortAudioBackend, ARDOUR::JACKAudioBackend, ARDOUR::DummyAudioBackend, ARDOUR::CoreAudioBackend, and ARDOUR::AlsaAudioBackend.
|
pure virtual |
Implemented in ARDOUR::PulseAudioBackend, ARDOUR::PortAudioBackend, ARDOUR::JACKAudioBackend, ARDOUR::DummyAudioBackend, ARDOUR::CoreAudioBackend, and ARDOUR::AlsaAudioBackend.
|
pure virtual |
Implemented in ARDOUR::PulseAudioBackend, ARDOUR::PortAudioBackend, ARDOUR::JACKAudioBackend, ARDOUR::DummyAudioBackend, ARDOUR::CoreAudioBackend, and ARDOUR::AlsaAudioBackend.
|
pure virtual |
Test if given port
is connected to physical I/O ports.
port | PortHandle of source port to test |
process_callback_safe | true if this method is not called from rt-context of backend callbacks |
port
has any connections to ports marked with the PortFlag IsPhysical. Return false otherwise. Implemented in ARDOUR::JACKAudioBackend, ARDOUR::PulseAudioBackend, ARDOUR::PortAudioBackend, ARDOUR::DummyAudioBackend, ARDOUR::CoreAudioBackend, and ARDOUR::AlsaAudioBackend.
|
pure virtual |
Lookup data type of a port
port | PortHandle of the port to lookup. |
port
. DataType::NIL is returned if the port does not exist. Implemented in ARDOUR::JACKAudioBackend, ARDOUR::PulseAudioBackend, ARDOUR::PortAudioBackend, ARDOUR::DummyAudioBackend, ARDOUR::CoreAudioBackend, and ARDOUR::AlsaAudioBackend.
|
pure virtual |
Return true if the port referred to by port
has the IsPhysical flag set. Return false otherwise.
port | PortHandle to query |
Implemented in ARDOUR::JACKAudioBackend, ARDOUR::PulseAudioBackend, ARDOUR::PortAudioBackend, ARDOUR::DummyAudioBackend, ARDOUR::CoreAudioBackend, and ARDOUR::AlsaAudioBackend.
|
pure virtual |
Return the maximum size of a port name
Implemented in ARDOUR::PulseAudioBackend, ARDOUR::PortAudioBackend, ARDOUR::JACKAudioBackend, ARDOUR::DummyAudioBackend, ARDOUR::CoreAudioBackend, and ARDOUR::AlsaAudioBackend.
|
pure virtual |
Return a private, type-free pointer to any data that might be useful to a concrete implementation
Implemented in ARDOUR::PulseAudioBackend, ARDOUR::PortAudioBackend, ARDOUR::JACKAudioBackend, ARDOUR::DummyAudioBackend, ARDOUR::CoreAudioBackend, and ARDOUR::AlsaAudioBackend.
|
pure virtual |
Create a new port whose fullname will be the conjunction of my_name(), ":" and shortname
. The port will handle data specified by type
and will have the flags given by flags
. If successful,
shortname | Name of port to create |
type | type of port to create |
flags | flags of the port to create |
Implemented in ARDOUR::JACKAudioBackend, ARDOUR::PulseAudioBackend, ARDOUR::PortAudioBackend, ARDOUR::DummyAudioBackend, ARDOUR::CoreAudioBackend, and ARDOUR::AlsaAudioBackend.
|
pure virtual |
Increment or decrement the number of requests to monitor the input of the hardware channel represented by the port referred to by port
.
If the number of requests rises above zero, input monitoring will be enabled (if can_monitor_input() returns true for the implementation).
If the number of requests falls to zero, input monitoring will be disabled (if can_monitor_input() returns true for the implementation)
port | PortHandle |
yn | true to enable hardware monitoring, false to disable |
Implemented in ARDOUR::PulseAudioBackend, ARDOUR::PortAudioBackend, ARDOUR::JACKAudioBackend, ARDOUR::DummyAudioBackend, ARDOUR::CoreAudioBackend, and ARDOUR::AlsaAudioBackend.
|
pure virtual |
|
pure virtual |
Set the latency range for the port referred to by port
to r
. The playback range will be set if for_playback
is true, otherwise the capture range will be set.
port | PortHandle to operate on |
for_playback | When true, playback latency is set: How long will it be until the signal arrives at the edge of the process graph. When false the capture latency is set: ow long has it been since the signal arrived at the edge of the process graph. |
r | min/max latency for given port. |
Implemented in ARDOUR::PulseAudioBackend, ARDOUR::PortAudioBackend, ARDOUR::JACKAudioBackend, ARDOUR::DummyAudioBackend, ARDOUR::CoreAudioBackend, and ARDOUR::AlsaAudioBackend.
|
pure virtual |
Set/rename port
port | PortHandle to operate on |
name | new name to use for this port |
Implemented in ARDOUR::JACKAudioBackend, ARDOUR::PulseAudioBackend, ARDOUR::PortAudioBackend, ARDOUR::DummyAudioBackend, ARDOUR::CoreAudioBackend, and ARDOUR::AlsaAudioBackend.
|
inlinevirtual |
Set the port-property value and type for a given key
The API follows jack_set_property():
key | The key of the property. |
value | The value of the property. |
type | The type of the property. |
Reimplemented in ARDOUR::JACKAudioBackend, ARDOUR::PulseAudioBackend, ARDOUR::PortAudioBackend, ARDOUR::DummyAudioBackend, ARDOUR::CoreAudioBackend, and ARDOUR::AlsaAudioBackend.
Definition at line 175 of file port_engine.h.
|
pure virtual |
|
protected |
Definition at line 505 of file port_engine.h.