int
PortAudioBackend::set_driver (const std::string& name)
{
- _pcmio->set_host_api (name);
+ DEBUG_AUDIO (string_compose ("Portaudio: set_driver %1 \n", name));
+ if (!_pcmio->set_host_api (name)) {
+ DEBUG_AUDIO (string_compose ("Portaudio: Unable to set_driver %1 \n", name));
+ return -1;
+ }
return 0;
}
+std::string
+PortAudioBackend::driver_name () const
+{
+ std::string driver_name = _pcmio->get_host_api ();
+ DEBUG_AUDIO (string_compose ("Portaudio: driver_name %1 \n", driver_name));
+ return driver_name;
+}
+
bool
PortAudioBackend::use_separate_input_and_output_devices () const
{
bool is_realtime () const;
bool requires_driver_selection() const;
+ std::string driver_name () const;
std::vector<std::string> enumerate_drivers () const;
int set_driver (const std::string&);
, _cur_sample_rate (0)
, _cur_input_latency (0)
, _cur_output_latency (0)
+ , _host_api_index(-1)
{
}
}
}
-void
+bool
PortAudioIO::set_host_api (const std::string& host_api_name)
{
- _host_api_index = get_host_api_index_from_name (host_api_name);
+ PaHostApiIndex new_index = get_host_api_index_from_name (host_api_name);
- if (_host_api_index < 0) {
- DEBUG_AUDIO ("Error setting host API\n");
+ if (new_index < 0) {
+ DEBUG_AUDIO ("Portaudio: Error setting host API\n");
+ return false;
}
+ _host_api_index = new_index;
+ _host_api_name = host_api_name;
+ return true;
}
PaHostApiIndex
bool initialize_pa ();
- void host_api_list (std::vector<std::string>&);
- void set_host_api (const std::string& host_api_name);
+ void host_api_list (std::vector<std::string>&);
+ bool set_host_api (const std::string& host_api_name);
+ std::string get_host_api () const { return _host_api_name; }
PaHostApiIndex get_host_api_index_from_name (const std::string& name);
PaDeviceIndex get_default_input_device ();
std::map<int, paDevice *> _output_devices;
PaHostApiIndex _host_api_index;
+ std::string _host_api_name;
};