Ardour  9.0-pre0-349-gc9645723de
ARDOUR::AsyncMIDIPort Class Reference

#include <async_midi_port.h>

Inheritance diagram for ARDOUR::AsyncMIDIPort:
[legend]

Public Member Functions

 AsyncMIDIPort (std::string const &, PortFlags)
 
 ~AsyncMIDIPort ()
 
bool flush_at_cycle_start () const
 
void set_flush_at_cycle_start (bool en)
 
void cycle_start (pframes_t nframes)
 
void cycle_end (pframes_t nframes)
 
void parse (samplecnt_t timestamp)
 
int write (const MIDI::byte *msg, size_t msglen, MIDI::timestamp_t timestamp)
 
int read (MIDI::byte *buf, size_t bufsize)
 
void drain (int check_interval_usecs, int total_usecs_to_wait)
 
void clear ()
 
CrossThreadChannelxthread ()
 
int selectable () const
 
void set_timer (std::function< samplecnt_t(void)> &)
 
- Public Member Functions inherited from ARDOUR::MidiPort
 ~MidiPort ()
 
DataType type () const
 
void cycle_start (pframes_t nframes)
 
void cycle_end (pframes_t nframes)
 
void cycle_split ()
 
void flush_buffers (pframes_t nframes)
 
void transport_stopped ()
 
void realtime_locate (bool)
 
void reset ()
 
void require_resolve ()
 
bool input_active () const
 
void set_input_active (bool yn)
 
Bufferget_buffer (pframes_t nframes)
 
MidiBufferget_midi_buffer (pframes_t nframes)
 
void set_trace (std::weak_ptr< MIDI::Parser > trace_parser)
 
std::shared_ptr< MIDI::Parsertrace_parser () const
 
void set_inbound_filter (MidiFilter)
 
int add_shadow_port (std::string const &, MidiFilter)
 
std::shared_ptr< MidiPortshadow_port () const
 
void read_and_parse_entire_midi_buffer_with_no_speed_adjustment (pframes_t nframes, MIDI::Parser &parser, samplepos_t now)
 
- Public Member Functions inherited from ARDOUR::Port
 Port (const Port &)=delete
 
Portoperator= (const Port &)=delete
 
virtual ~Port ()
 
std::string name () const
 
std::string pretty_name (bool fallback_to_name=false) const
 
bool set_pretty_name (const std::string &)
 
int set_name (std::string const &)
 
PortFlags flags () const
 
bool receives_input () const
 
bool sends_output () const
 
bool connected () const
 
int disconnect_all ()
 
int get_connections (std::vector< std::string > &) const
 
bool connected_to (std::string const &) const
 
int connect (std::string const &)
 
int disconnect (std::string const &)
 
bool connected_to (Port *) const
 
virtual int connect (Port *)
 
int disconnect (Port *)
 
void request_input_monitoring (bool)
 
void ensure_input_monitoring (bool)
 
bool monitoring_input () const
 
int reestablish ()
 
int reconnect ()
 
bool last_monitor () const
 
void set_last_monitor (bool yn)
 
PortEngine::PortHandle port_handle ()
 
void get_connected_latency_range (LatencyRange &range, bool playback) const
 
void collect_latency_from_backend (LatencyRange &range, bool playback) const
 
void set_private_latency_range (LatencyRange &range, bool playback)
 
const LatencyRangeprivate_latency_range (bool playback) const
 
void set_public_latency_range (LatencyRange const &range, bool playback) const
 
LatencyRange public_latency_range (bool playback) const
 
virtual void reinit (bool)
 
virtual void set_buffer_size (pframes_t)
 
bool has_ext_connection () const
 
bool physically_connected () const
 
bool in_cycle () const
 
uint32_t externally_connected () const
 
uint32_t internally_connected () const
 
void increment_external_connections ()
 
void decrement_external_connections ()
 
void increment_internal_connections ()
 
void decrement_internal_connections ()
 
virtual XMLNodeget_state () const
 
virtual int set_state (const XMLNode &, int version)
 
- Public Member Functions inherited from MIDI::Port
 Port (std::string const &, Flags)
 
 Port (const XMLNode &)
 
virtual ~Port ()
 
virtual XMLNodeget_state () const
 
virtual void set_state (const XMLNode &)
 
int midimsg (byte *msg, size_t len, timestamp_t timestamp)
 
bool clock (timestamp_t timestamp)
 
Channelchannel (channel_t chn)
 
Parserparser ()
 
const char * name () const
 
bool ok () const
 
virtual bool centrally_parsed () const
 
void set_centrally_parsed (bool yn)
 
bool receives_input () const
 
bool sends_output () const
 

Static Public Member Functions

static void set_process_thread (pthread_t)
 
static pthread_t get_process_thread ()
 
static bool is_process_thread ()
 
- Static Public Member Functions inherited from ARDOUR::Port
static void set_connecting_blocked (bool yn)
 
static bool connecting_blocked ()
 
static void set_varispeed_ratio (double s)
 
static bool set_engine_ratio (double session, double engine)
 
static void set_cycle_samplecnt (pframes_t n)
 
static samplecnt_t port_offset ()
 
static void set_global_port_buffer_offset (pframes_t off)
 
static void increment_global_port_buffer_offset (pframes_t n)
 
static pframes_t cycle_nframes ()
 
static double speed_ratio ()
 
static double engine_ratio ()
 
static double resample_ratio ()
 
static uint32_t resampler_quality ()
 
static uint32_t resampler_latency ()
 
static bool can_varispeed ()
 
static bool setup_resampler (uint32_t q=17)
 

Private Member Functions

int create_port ()
 
void jack_halted ()
 
void make_connections ()
 
void init (std::string const &, Flags)
 
void flush_output_fifo (pframes_t)
 

Private Attributes

bool _currently_in_cycle
 
MIDI::timestamp_t _last_write_timestamp
 
bool _flush_at_cycle_start
 
bool have_timer
 
std::function< samplecnt_t(void)> timer
 
PBD::RingBuffer< Evoral::Event< double > > output_fifo
 
EventRingBuffer< MIDI::timestamp_tinput_fifo
 
Glib::Threads::Mutex output_fifo_lock
 
CrossThreadChannel _xthread
 
std::string _connections
 
PBD::ScopedConnection connect_connection
 
PBD::ScopedConnection halt_connection
 

Static Private Attributes

static pthread_t _process_thread
 

Additional Inherited Members

- Public Types inherited from ARDOUR::MidiPort
typedef std::function< bool(MidiBuffer &, MidiBuffer &)> MidiFilter
 
- Public Types inherited from MIDI::Port
enum  Flags { IsInput = 0x1 , IsOutput = 0x2 }
 
- Public Attributes inherited from ARDOUR::Port
PBD::Signal< void(bool)> MonitorInputChanged
 
PBD::Signal< void(std::shared_ptr< Port >, std::shared_ptr< Port >, bool)> ConnectedOrDisconnected
 
- Static Public Attributes inherited from ARDOUR::Port
static PBD::Signal< void()> PortDrop
 
static PBD::Signal< void()> PortSignalDrop
 
static PBD::Signal< void()> ResamplerQualityChanged
 
static std::string state_node_name
 
- Static Public Attributes inherited from MIDI::Port
static std::string state_node_name
 
- Protected Member Functions inherited from ARDOUR::MidiPort
 MidiPort (const std::string &name, PortFlags)
 
- Protected Member Functions inherited from ARDOUR::Port
 Port (std::string const &, DataType, PortFlags)
 
- Protected Member Functions inherited from MIDI::Port
void init (std::string const &, Flags)
 
- Protected Attributes inherited from ARDOUR::Port
PortEngine::PortPtr _port_handle
 
LatencyRange _private_playback_latency
 
LatencyRange _private_capture_latency
 
- Protected Attributes inherited from MIDI::Port
bool _ok
 
std::string _tagname
 
Channel_channel [16]
 
Parser_parser
 
Flags _flags
 
bool _centrally_parsed
 
- Static Protected Attributes inherited from ARDOUR::Port
static bool _connecting_blocked
 
static pframes_t _cycle_nframes
 
static pframes_t _global_port_buffer_offset
 
static double _speed_ratio
 
static double _engine_ratio
 
static double _resample_ratio
 

Detailed Description

Definition at line 43 of file async_midi_port.h.

Constructor & Destructor Documentation

◆ AsyncMIDIPort()

ARDOUR::AsyncMIDIPort::AsyncMIDIPort ( std::string const &  ,
PortFlags   
)

◆ ~AsyncMIDIPort()

ARDOUR::AsyncMIDIPort::~AsyncMIDIPort ( )

Member Function Documentation

◆ clear()

void ARDOUR::AsyncMIDIPort::clear ( )
inline

Definition at line 64 of file async_midi_port.h.

◆ create_port()

int ARDOUR::AsyncMIDIPort::create_port ( )
private

◆ cycle_end()

void ARDOUR::AsyncMIDIPort::cycle_end ( pframes_t  nframes)
virtual

Reimplemented from ARDOUR::Port.

◆ cycle_start()

void ARDOUR::AsyncMIDIPort::cycle_start ( pframes_t  nframes)
virtual

Reimplemented from ARDOUR::Port.

◆ drain()

void ARDOUR::AsyncMIDIPort::drain ( int  ,
int   
)
virtual

block until the output FIFO used by non-process threads is empty, checking every check_interval_usecs usecs for current status. Not to be called by a thread that executes any part of a JACK process callback (will simply return immediately in that situation).

Reimplemented from MIDI::Port.

◆ flush_at_cycle_start()

bool ARDOUR::AsyncMIDIPort::flush_at_cycle_start ( ) const
inline

Definition at line 49 of file async_midi_port.h.

◆ flush_output_fifo()

void ARDOUR::AsyncMIDIPort::flush_output_fifo ( pframes_t  )
private

◆ get_process_thread()

static pthread_t ARDOUR::AsyncMIDIPort::get_process_thread ( )
inlinestatic

Definition at line 77 of file async_midi_port.h.

◆ init()

void ARDOUR::AsyncMIDIPort::init ( std::string const &  ,
Flags   
)
private

◆ is_process_thread()

static bool ARDOUR::AsyncMIDIPort::is_process_thread ( )
static

◆ jack_halted()

void ARDOUR::AsyncMIDIPort::jack_halted ( )
private

◆ make_connections()

void ARDOUR::AsyncMIDIPort::make_connections ( )
private

◆ parse()

void ARDOUR::AsyncMIDIPort::parse ( samplecnt_t  timestamp)
virtual

Implements MIDI::Port.

◆ read()

int ARDOUR::AsyncMIDIPort::read ( MIDI::byte buf,
size_t  bufsize 
)
virtual

Read raw bytes from a port.

Parameters
bufmemory to store read data in
bufsizesize of buf
Returns
number of bytes successfully read, negative if error

Implements MIDI::Port.

◆ selectable()

int ARDOUR::AsyncMIDIPort::selectable ( ) const
inlinevirtual

Get the file descriptor for port.

Returns
File descriptor, or -1 if not selectable.

Implements MIDI::Port.

Definition at line 73 of file async_midi_port.h.

◆ set_flush_at_cycle_start()

void ARDOUR::AsyncMIDIPort::set_flush_at_cycle_start ( bool  en)
inline

Definition at line 50 of file async_midi_port.h.

◆ set_process_thread()

static void ARDOUR::AsyncMIDIPort::set_process_thread ( pthread_t  )
static

◆ set_timer()

void ARDOUR::AsyncMIDIPort::set_timer ( std::function< samplecnt_t(void)> &  )

◆ write()

int ARDOUR::AsyncMIDIPort::write ( const MIDI::byte msg,
size_t  msglen,
MIDI::timestamp_t  timestamp 
)
virtual

Write a message to port.

Parameters
msgRaw MIDI message to send
msglenSize of msg
timestampTime stamp in samples of this message (relative to cycle start)
Returns
number of bytes successfully written

Implements MIDI::Port.

◆ xthread()

CrossThreadChannel& ARDOUR::AsyncMIDIPort::xthread ( )
inline

Definition at line 68 of file async_midi_port.h.

Member Data Documentation

◆ _connections

std::string ARDOUR::AsyncMIDIPort::_connections
private

Channel used to signal to the MidiControlUI that input has arrived

Definition at line 95 of file async_midi_port.h.

◆ _currently_in_cycle

bool ARDOUR::AsyncMIDIPort::_currently_in_cycle
private

Definition at line 81 of file async_midi_port.h.

◆ _flush_at_cycle_start

bool ARDOUR::AsyncMIDIPort::_flush_at_cycle_start
private

Definition at line 83 of file async_midi_port.h.

◆ _last_write_timestamp

MIDI::timestamp_t ARDOUR::AsyncMIDIPort::_last_write_timestamp
private

Definition at line 82 of file async_midi_port.h.

◆ _process_thread

pthread_t ARDOUR::AsyncMIDIPort::_process_thread
staticprivate

Definition at line 104 of file async_midi_port.h.

◆ _xthread

CrossThreadChannel ARDOUR::AsyncMIDIPort::_xthread
private

Definition at line 89 of file async_midi_port.h.

◆ connect_connection

PBD::ScopedConnection ARDOUR::AsyncMIDIPort::connect_connection
private

Definition at line 96 of file async_midi_port.h.

◆ halt_connection

PBD::ScopedConnection ARDOUR::AsyncMIDIPort::halt_connection
private

Definition at line 97 of file async_midi_port.h.

◆ have_timer

bool ARDOUR::AsyncMIDIPort::have_timer
private

Definition at line 84 of file async_midi_port.h.

◆ input_fifo

EventRingBuffer<MIDI::timestamp_t> ARDOUR::AsyncMIDIPort::input_fifo
private

Definition at line 87 of file async_midi_port.h.

◆ output_fifo

PBD::RingBuffer< Evoral::Event<double> > ARDOUR::AsyncMIDIPort::output_fifo
private

Definition at line 86 of file async_midi_port.h.

◆ output_fifo_lock

Glib::Threads::Mutex ARDOUR::AsyncMIDIPort::output_fifo_lock
private

Definition at line 88 of file async_midi_port.h.

◆ timer

std::function<samplecnt_t (void)> ARDOUR::AsyncMIDIPort::timer
private

Definition at line 85 of file async_midi_port.h.


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