Ardour  9.0-pre0-582-g084a23a80d
ARDOUR::PortAudioIO Class Reference

#include <portaudio_io.h>

Classes

struct  paDevice
 

Public Types

enum  StandardDevices { DeviceNone = -2 , DeviceDefault = -1 }
 

Public Member Functions

 PortAudioIO (void)
 
 ~PortAudioIO (void)
 
void host_api_list (std::vector< std::string > &)
 
bool set_host_api (const std::string &host_api_name)
 
std::string get_host_api () const
 
PaHostApiTypeId get_current_host_api_type () const
 
PaHostApiIndex get_host_api_index_from_name (const std::string &name)
 
PaDeviceIndex get_default_input_device () const
 
PaDeviceIndex get_default_output_device () const
 
bool update_devices ()
 
void input_device_list (std::map< int, std::string > &devices) const
 
void output_device_list (std::map< int, std::string > &devices) const
 
int available_sample_rates (int device_id, std::vector< float > &sample_rates)
 
int available_buffer_sizes (int device_id, std::vector< uint32_t > &buffer_sizes)
 
std::string control_app_name (int device_id) const
 
void launch_control_app (int device_id)
 
PaErrorCode open_blocking_stream (int device_input, int device_output, double sample_rate, uint32_t samples_per_period)
 
PaErrorCode open_callback_stream (int device_input, int device_output, double sample_rate, uint32_t samples_per_period, PaStreamCallback *callback, void *data)
 
PaErrorCode start_stream (void)
 
PaErrorCode close_stream (void)
 
uint32_t n_playback_channels (void) const
 
uint32_t n_capture_channels (void) const
 
std::string get_input_channel_name (int device_id, uint32_t channel) const
 
std::string get_output_channel_name (int device_id, uint32_t channel) const
 
double sample_rate (void) const
 
uint32_t capture_latency (void) const
 
uint32_t playback_latency (void) const
 
double stream_time (void) const
 
int next_cycle (uint32_t n_samples)
 
int get_capture_channel (uint32_t chn, float *input, uint32_t n_samples)
 
int set_playback_channel (uint32_t chn, const float *input, uint32_t n_samples)
 
float * get_capture_buffer ()
 
float * get_playback_buffer ()
 

Private Member Functions

void clear_device_lists ()
 
void add_none_devices ()
 
void add_default_devices ()
 
void add_devices ()
 
std::string get_host_api_name_from_index (PaHostApiIndex index)
 
bool get_output_stream_params (int device_output, PaStreamParameters &outputParam) const
 
bool get_input_stream_params (int device_input, PaStreamParameters &inputParam) const
 
bool set_sample_rate_and_latency_from_stream ()
 
bool allocate_buffers_for_blocking_api (uint32_t samples_per_period)
 
PaErrorCode pre_stream_open (int device_input, PaStreamParameters &inputParam, int device_output, PaStreamParameters &outputParam, uint32_t sample_rate, uint32_t samples_per_period)
 
void reset_stream_dependents ()
 

Static Private Member Functions

static bool pa_initialize ()
 
static bool pa_deinitialize ()
 
static bool & pa_initialized ()
 
static void get_default_sample_rates (std::vector< float > &)
 
static void get_default_buffer_sizes (std::vector< uint32_t > &)
 

Private Attributes

uint32_t _capture_channels
 
uint32_t _playback_channels
 
PaStream * _stream
 
float * _input_buffer
 
float * _output_buffer
 
double _cur_sample_rate
 
uint32_t _cur_input_latency
 
uint32_t _cur_output_latency
 
std::map< int, paDevice * > _input_devices
 
std::map< int, paDevice * > _output_devices
 
PaHostApiIndex _host_api_index
 
std::string _host_api_name
 

Detailed Description

Definition at line 32 of file portaudio_io.h.

Member Enumeration Documentation

◆ StandardDevices

Enumerator
DeviceNone 
DeviceDefault 

Definition at line 37 of file portaudio_io.h.

Constructor & Destructor Documentation

◆ PortAudioIO()

ARDOUR::PortAudioIO::PortAudioIO ( void  )

◆ ~PortAudioIO()

ARDOUR::PortAudioIO::~PortAudioIO ( void  )

Member Function Documentation

◆ add_default_devices()

void ARDOUR::PortAudioIO::add_default_devices ( )
private

◆ add_devices()

void ARDOUR::PortAudioIO::add_devices ( )
private

◆ add_none_devices()

void ARDOUR::PortAudioIO::add_none_devices ( )
private

◆ allocate_buffers_for_blocking_api()

bool ARDOUR::PortAudioIO::allocate_buffers_for_blocking_api ( uint32_t  samples_per_period)
private

◆ available_buffer_sizes()

int ARDOUR::PortAudioIO::available_buffer_sizes ( int  device_id,
std::vector< uint32_t > &  buffer_sizes 
)

◆ available_sample_rates()

int ARDOUR::PortAudioIO::available_sample_rates ( int  device_id,
std::vector< float > &  sample_rates 
)

◆ capture_latency()

uint32_t ARDOUR::PortAudioIO::capture_latency ( void  ) const
inline

Definition at line 96 of file portaudio_io.h.

◆ clear_device_lists()

void ARDOUR::PortAudioIO::clear_device_lists ( )
private

◆ close_stream()

PaErrorCode ARDOUR::PortAudioIO::close_stream ( void  )

◆ control_app_name()

std::string ARDOUR::PortAudioIO::control_app_name ( int  device_id) const

◆ get_capture_buffer()

float* ARDOUR::PortAudioIO::get_capture_buffer ( )
inline

Definition at line 104 of file portaudio_io.h.

◆ get_capture_channel()

int ARDOUR::PortAudioIO::get_capture_channel ( uint32_t  chn,
float *  input,
uint32_t  n_samples 
)

◆ get_current_host_api_type()

PaHostApiTypeId ARDOUR::PortAudioIO::get_current_host_api_type ( ) const

◆ get_default_buffer_sizes()

static void ARDOUR::PortAudioIO::get_default_buffer_sizes ( std::vector< uint32_t > &  )
staticprivate

◆ get_default_input_device()

PaDeviceIndex ARDOUR::PortAudioIO::get_default_input_device ( ) const

◆ get_default_output_device()

PaDeviceIndex ARDOUR::PortAudioIO::get_default_output_device ( ) const

◆ get_default_sample_rates()

static void ARDOUR::PortAudioIO::get_default_sample_rates ( std::vector< float > &  )
staticprivate

◆ get_host_api()

std::string ARDOUR::PortAudioIO::get_host_api ( ) const
inline

Definition at line 44 of file portaudio_io.h.

◆ get_host_api_index_from_name()

PaHostApiIndex ARDOUR::PortAudioIO::get_host_api_index_from_name ( const std::string &  name)

◆ get_host_api_name_from_index()

std::string ARDOUR::PortAudioIO::get_host_api_name_from_index ( PaHostApiIndex  index)
private

◆ get_input_channel_name()

std::string ARDOUR::PortAudioIO::get_input_channel_name ( int  device_id,
uint32_t  channel 
) const

◆ get_input_stream_params()

bool ARDOUR::PortAudioIO::get_input_stream_params ( int  device_input,
PaStreamParameters &  inputParam 
) const
private

◆ get_output_channel_name()

std::string ARDOUR::PortAudioIO::get_output_channel_name ( int  device_id,
uint32_t  channel 
) const

◆ get_output_stream_params()

bool ARDOUR::PortAudioIO::get_output_stream_params ( int  device_output,
PaStreamParameters &  outputParam 
) const
private

◆ get_playback_buffer()

float* ARDOUR::PortAudioIO::get_playback_buffer ( )
inline

Definition at line 105 of file portaudio_io.h.

◆ host_api_list()

void ARDOUR::PortAudioIO::host_api_list ( std::vector< std::string > &  )

◆ input_device_list()

void ARDOUR::PortAudioIO::input_device_list ( std::map< int, std::string > &  devices) const

◆ launch_control_app()

void ARDOUR::PortAudioIO::launch_control_app ( int  device_id)

◆ n_capture_channels()

uint32_t ARDOUR::PortAudioIO::n_capture_channels ( void  ) const
inline

Definition at line 90 of file portaudio_io.h.

◆ n_playback_channels()

uint32_t ARDOUR::PortAudioIO::n_playback_channels ( void  ) const
inline

Definition at line 89 of file portaudio_io.h.

◆ next_cycle()

int ARDOUR::PortAudioIO::next_cycle ( uint32_t  n_samples)

◆ open_blocking_stream()

PaErrorCode ARDOUR::PortAudioIO::open_blocking_stream ( int  device_input,
int  device_output,
double  sample_rate,
uint32_t  samples_per_period 
)

◆ open_callback_stream()

PaErrorCode ARDOUR::PortAudioIO::open_callback_stream ( int  device_input,
int  device_output,
double  sample_rate,
uint32_t  samples_per_period,
PaStreamCallback *  callback,
void *  data 
)

◆ output_device_list()

void ARDOUR::PortAudioIO::output_device_list ( std::map< int, std::string > &  devices) const

◆ pa_deinitialize()

static bool ARDOUR::PortAudioIO::pa_deinitialize ( )
staticprivate

◆ pa_initialize()

static bool ARDOUR::PortAudioIO::pa_initialize ( )
staticprivate

◆ pa_initialized()

static bool& ARDOUR::PortAudioIO::pa_initialized ( )
staticprivate

◆ playback_latency()

uint32_t ARDOUR::PortAudioIO::playback_latency ( void  ) const
inline

Definition at line 97 of file portaudio_io.h.

◆ pre_stream_open()

PaErrorCode ARDOUR::PortAudioIO::pre_stream_open ( int  device_input,
PaStreamParameters &  inputParam,
int  device_output,
PaStreamParameters &  outputParam,
uint32_t  sample_rate,
uint32_t  samples_per_period 
)
private

◆ reset_stream_dependents()

void ARDOUR::PortAudioIO::reset_stream_dependents ( )
private

◆ sample_rate()

double ARDOUR::PortAudioIO::sample_rate ( void  ) const
inline

Definition at line 95 of file portaudio_io.h.

◆ set_host_api()

bool ARDOUR::PortAudioIO::set_host_api ( const std::string &  host_api_name)

◆ set_playback_channel()

int ARDOUR::PortAudioIO::set_playback_channel ( uint32_t  chn,
const float *  input,
uint32_t  n_samples 
)

◆ set_sample_rate_and_latency_from_stream()

bool ARDOUR::PortAudioIO::set_sample_rate_and_latency_from_stream ( )
private

◆ start_stream()

PaErrorCode ARDOUR::PortAudioIO::start_stream ( void  )

◆ stream_time()

double ARDOUR::PortAudioIO::stream_time ( void  ) const
inline

Definition at line 98 of file portaudio_io.h.

◆ update_devices()

bool ARDOUR::PortAudioIO::update_devices ( )

Member Data Documentation

◆ _capture_channels

uint32_t ARDOUR::PortAudioIO::_capture_channels
private

Definition at line 140 of file portaudio_io.h.

◆ _cur_input_latency

uint32_t ARDOUR::PortAudioIO::_cur_input_latency
private

Definition at line 149 of file portaudio_io.h.

◆ _cur_output_latency

uint32_t ARDOUR::PortAudioIO::_cur_output_latency
private

Definition at line 150 of file portaudio_io.h.

◆ _cur_sample_rate

double ARDOUR::PortAudioIO::_cur_sample_rate
private

Definition at line 148 of file portaudio_io.h.

◆ _host_api_index

PaHostApiIndex ARDOUR::PortAudioIO::_host_api_index
private

Definition at line 167 of file portaudio_io.h.

◆ _host_api_name

std::string ARDOUR::PortAudioIO::_host_api_name
private

Definition at line 168 of file portaudio_io.h.

◆ _input_buffer

float* ARDOUR::PortAudioIO::_input_buffer
private

Definition at line 145 of file portaudio_io.h.

◆ _input_devices

std::map<int, paDevice *> ARDOUR::PortAudioIO::_input_devices
private

Definition at line 164 of file portaudio_io.h.

◆ _output_buffer

float* ARDOUR::PortAudioIO::_output_buffer
private

Definition at line 146 of file portaudio_io.h.

◆ _output_devices

std::map<int, paDevice *> ARDOUR::PortAudioIO::_output_devices
private

Definition at line 165 of file portaudio_io.h.

◆ _playback_channels

uint32_t ARDOUR::PortAudioIO::_playback_channels
private

Definition at line 141 of file portaudio_io.h.

◆ _stream

PaStream* ARDOUR::PortAudioIO::_stream
private

Definition at line 143 of file portaudio_io.h.


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