mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-16 19:56:31 +01:00
Add "None" devices to PortaudioBackend
This allows for disabling either input or output, but not both
This commit is contained in:
parent
440e6cd591
commit
08d6dd153e
2 changed files with 29 additions and 5 deletions
|
|
@ -22,6 +22,7 @@
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <glibmm.h>
|
#include <glibmm.h>
|
||||||
|
|
||||||
#include "portaudio_io.h"
|
#include "portaudio_io.h"
|
||||||
|
|
||||||
#ifdef WITH_ASIO
|
#ifdef WITH_ASIO
|
||||||
|
|
@ -424,6 +425,15 @@ PortAudioIO::clear_device_lists ()
|
||||||
_output_devices.clear();
|
_output_devices.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
PortAudioIO::add_none_devices ()
|
||||||
|
{
|
||||||
|
_input_devices.insert(std::pair<int, paDevice*>(
|
||||||
|
DeviceNone, new paDevice(AudioBackend::get_standard_device_name(AudioBackend::DeviceNone), 0, 0)));
|
||||||
|
_output_devices.insert(std::pair<int, paDevice*>(
|
||||||
|
DeviceNone, new paDevice(AudioBackend::get_standard_device_name(AudioBackend::DeviceNone), 0, 0)));
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
PortAudioIO::add_default_devices ()
|
PortAudioIO::add_default_devices ()
|
||||||
{
|
{
|
||||||
|
|
@ -503,6 +513,7 @@ PortAudioIO::discover()
|
||||||
if (!initialize_pa()) return;
|
if (!initialize_pa()) return;
|
||||||
|
|
||||||
clear_device_lists ();
|
clear_device_lists ();
|
||||||
|
add_none_devices ();
|
||||||
add_devices ();
|
add_devices ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -558,9 +569,9 @@ PortAudioIO::pcm_setup (
|
||||||
_state = -2;
|
_state = -2;
|
||||||
|
|
||||||
PaError err = paNoError;
|
PaError err = paNoError;
|
||||||
const PaDeviceInfo *nfo_in;
|
const PaDeviceInfo *nfo_in = NULL;
|
||||||
const PaDeviceInfo *nfo_out;
|
const PaDeviceInfo *nfo_out = NULL;
|
||||||
const PaStreamInfo *nfo_s;
|
const PaStreamInfo *nfo_s = NULL;
|
||||||
|
|
||||||
if (!initialize_pa()) {
|
if (!initialize_pa()) {
|
||||||
DEBUG_AUDIO ("PortAudio Initialization Failed\n");
|
DEBUG_AUDIO ("PortAudio Initialization Failed\n");
|
||||||
|
|
@ -583,8 +594,20 @@ PortAudioIO::pcm_setup (
|
||||||
DEBUG_AUDIO (string_compose (
|
DEBUG_AUDIO (string_compose (
|
||||||
"PortAudio Device IDs: i:%1 o:%2\n", device_input, device_output));
|
"PortAudio Device IDs: i:%1 o:%2\n", device_input, device_output));
|
||||||
|
|
||||||
nfo_in = Pa_GetDeviceInfo(device_input);
|
if (device_input == DeviceNone && device_output == DeviceNone) {
|
||||||
nfo_out = Pa_GetDeviceInfo(device_output);
|
// just send the error msg for now rather than return it
|
||||||
|
error << AudioBackend::get_error_string(AudioBackend::DeviceConfigurationNotSupportedError)
|
||||||
|
<< endmsg;
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (device_input != DeviceNone) {
|
||||||
|
nfo_in = Pa_GetDeviceInfo(device_input);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (device_output != DeviceNone) {
|
||||||
|
nfo_out = Pa_GetDeviceInfo(device_output);
|
||||||
|
}
|
||||||
|
|
||||||
if (!nfo_in && ! nfo_out) {
|
if (!nfo_in && ! nfo_out) {
|
||||||
DEBUG_AUDIO ("PortAudio Cannot Query Device Info\n");
|
DEBUG_AUDIO ("PortAudio Cannot Query Device Info\n");
|
||||||
|
|
|
||||||
|
|
@ -101,6 +101,7 @@ public:
|
||||||
private: // Methods
|
private: // Methods
|
||||||
|
|
||||||
void clear_device_lists ();
|
void clear_device_lists ();
|
||||||
|
void add_none_devices ();
|
||||||
void add_default_devices ();
|
void add_default_devices ();
|
||||||
void add_devices ();
|
void add_devices ();
|
||||||
std::string get_host_api_name_from_index (PaHostApiIndex index);
|
std::string get_host_api_name_from_index (PaHostApiIndex index);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue