19 #ifndef __libbackend_pulse_audiobackend_h__
20 #define __libbackend_pulse_audiobackend_h__
31 #include <pulse/pulseaudio.h>
39 #define MaxPulseMidiEventSize (256)
43 class PulseAudioBackend;
153 int _start (
bool for_latency_measurement);
278 std::function<void()>
f;
AudioBackendInfo & info() const
int set_port_name(PortEngine::PortHandle, const std::string &)
uint32_t port_name_size() const
virtual void unregister_port(PortEngine::PortHandle)
bool physically_connected(PortEngine::PortHandle, bool process_callback_safe)
int disconnect(const std::string &src, const std::string &dst)
PortEngine::PortPtr get_port_by_name(const std::string &) const
int get_ports(const std::string &port_name_pattern, DataType type, PortFlags flags, std::vector< std::string > &) const
int connect(const std::string &src, const std::string &dst)
ChanCount n_physical_outputs() const
PortFlags get_port_flags(PortEngine::PortHandle) const
bool connected_to(PortEngine::PortHandle, const std::string &, bool process_callback_safe)
bool connected(PortEngine::PortHandle, bool process_callback_safe)
int get_connections(PortEngine::PortHandle, std::vector< std::string > &, bool process_callback_safe)
std::string get_port_name(PortEngine::PortHandle) const
ChanCount n_physical_inputs() const
void get_physical_outputs(DataType type, std::vector< std::string > &)
void get_physical_inputs(DataType type, std::vector< std::string > &)
DataType port_data_type(PortEngine::PortHandle) const
int disconnect_all(PortEngine::PortHandle)
bool port_is_physical(PortEngine::PortHandle) const
int get_port_property(PortEngine::PortHandle, const std::string &key, std::string &value, std::string &type) const
int set_port_property(PortEngine::PortHandle, const std::string &key, const std::string &value, const std::string &type)
PortEngine::PortPtr register_port(const std::string &shortname, ARDOUR::DataType, ARDOUR::PortFlags)
PortPtr const & PortHandle
std::shared_ptr< ProtoPort > PortPtr
int connect(PortEngine::PortHandle ph, const std::string &other)
struct pa_context * p_context
void set_latency_range(PortHandle, bool for_playback, LatencyRange)
samplepos_t sample_time()
uint32_t systemic_output_latency() const
void get_physical_outputs(DataType type, std::vector< std::string > &results)
bool can_change_buffer_size_when_running() const
PortFlags get_port_flags(PortEngine::PortHandle ph) const
std::string control_app_name() const
std::vector< DeviceStatus > enumerate_midi_devices() const
static void stream_operation_cb(pa_stream *, int, void *)
std::vector< pthread_t > _threads
uint32_t systemic_midi_output_latency(std::string const) const
uint32_t get_midi_event_count(void *port_buffer)
int set_sample_rate(float)
static void context_state_cb(pa_context *, void *)
int set_device_name(const std::string &)
bool _operation_succeeded
ChanCount n_physical_outputs() const
uint64_t _last_process_start
std::string get_port_name(PortEngine::PortHandle ph) const
bool monitoring_input(PortHandle)
int disconnect(PortEngine::PortHandle ph, const std::string &other)
bool physically_connected(PortEngine::PortHandle ph, bool process_callback_safe)
uint32_t systemic_input_latency() const
void * private_handle() const
int disconnect(const std::string &src, const std::string &dst)
PortEngine::PortPtr get_port_by_name(std::string const &name) const
int create_process_thread(std::function< void()> func)
bool can_change_sample_rate_when_running() const
DataType port_data_type(PortEngine::PortHandle ph) const
uint32_t port_name_size() const
int get_ports(const std::string &port_name_pattern, DataType type, PortFlags flags, std::vector< std::string > &results) const
int set_midi_device_enabled(std::string const, bool)
int set_buffer_size(uint32_t)
std::string device_name() const
PortEngine::PortPtr register_port(const std::string &shortname, ARDOUR::DataType type, ARDOUR::PortFlags flags)
struct pa_stream * p_stream
static void * pulse_process_thread(void *)
static void stream_xrun_cb(pa_stream *, void *)
samplepos_t sample_time_at_cycle_start()
bool connected(PortEngine::PortHandle ph, bool process_callback_safe)
LatencyRange get_latency_range(PortHandle, bool for_playback)
int disconnect_all(PortEngine::PortHandle ph)
uint32_t process_thread_count()
static void stream_request_cb(pa_stream *, size_t, void *)
int ensure_input_monitoring(PortHandle, bool)
std::vector< DeviceStatus > enumerate_devices() const
size_t raw_buffer_size(DataType t)
int midi_event_get(pframes_t ×tamp, size_t &size, uint8_t const **buf, void *port_buffer, uint32_t event_index)
bool can_measure_systemic_latency() const
void get_physical_inputs(DataType type, std::vector< std::string > &results)
float sample_rate() const
BackendPort * port_factory(std::string const &name, ARDOUR::DataType dt, ARDOUR::PortFlags flags)
uint32_t buffer_size() const
void launch_control_app()
std::string midi_option() const
int join_process_threads()
int set_interleaved(bool yn)
int set_systemic_midi_output_latency(std::string const, uint32_t)
bool can_monitor_input() const
ChanCount n_physical_inputs() const
std::string _instance_name
int request_input_monitoring(PortHandle, bool)
samplecnt_t _processed_samples
int _start(bool for_latency_measurement)
int register_system_ports()
int set_port_name(PortEngine::PortHandle ph, const std::string &name)
struct pa_threaded_mainloop * p_mainloop
size_t _samples_per_period
int set_systemic_output_latency(uint32_t)
bool port_is_physical(PortEngine::PortHandle ph) const
static void stream_latency_update_cb(pa_stream *, void *)
int set_systemic_midi_input_latency(std::string const, uint32_t)
static void stream_state_cb(pa_stream *, void *)
void * main_process_thread()
bool connected_to(PortEngine::PortHandle ph, const std::string &other, bool process_callback_safe)
int midi_event_put(void *port_buffer, pframes_t timestamp, const uint8_t *buffer, size_t size)
std::vector< uint32_t > available_buffer_sizes(const std::string &device) const
bool midi_device_enabled(std::string const) const
int set_port_property(PortEngine::PortHandle ph, const std::string &key, const std::string &value, const std::string &type)
PulseAudioBackend(AudioEngine &e, AudioBackendInfo &info)
std::vector< std::string > enumerate_midi_options() const
int get_port_property(PortEngine::PortHandle ph, const std::string &key, std::string &value, std::string &type) const
void midi_clear(void *port_buffer)
void unregister_port(PortHandle ph)
int sync_pulse(pa_operation *)
uint32_t systemic_midi_input_latency(std::string const) const
pframes_t samples_since_cycle_start()
int connect(const std::string &src, const std::string &dst)
std::vector< float > available_sample_rates(const std::string &device) const
void close_pulse(bool unlock=false)
uint32_t _systemic_audio_output_latency
ARDOUR::DSPLoadCalculator _dsp_load_calc
bool can_set_systemic_midi_latencies() const
static const size_t _max_buffer_size
int set_midi_option(const std::string &)
int get_connections(PortEngine::PortHandle ph, std::vector< std::string > &results, bool process_callback_safe)
void * get_buffer(PortHandle, pframes_t)
int set_systemic_input_latency(uint32_t)
const std::string & my_name() const
const Sample * const_buffer() const
void * get_buffer(pframes_t nframes)
PulseAudioPort(PulseAudioBackend &b, const std::string &, PortFlags)
const uint8_t * const_data() const
pframes_t timestamp() const
const uint8_t * data() const
PulseMidiEvent(const PulseMidiEvent &other)
PulseMidiEvent(const pframes_t timestamp, const uint8_t *data, size_t size)
void * get_buffer(pframes_t nframes)
PulseMidiPort(PulseAudioBackend &b, const std::string &, PortFlags)
const PulseMidiBuffer * const_buffer() const
Temporal::samplecnt_t samplecnt_t
std::vector< std::shared_ptr< PulseMidiEvent > > PulseMidiBuffer
Temporal::samplepos_t samplepos_t
#define MaxPulseMidiEventSize
ThreadData(PulseAudioBackend *e, std::function< void()> fp, size_t stacksz)
PulseAudioBackend * engine