Add functionality to show ASIO control panel
This commit is contained in:
parent
acd17a9b53
commit
cfbd9dd6d4
@ -376,6 +376,18 @@ PortAudioBackend::systemic_output_latency () const
|
||||
return _systemic_audio_output_latency;
|
||||
}
|
||||
|
||||
std::string
|
||||
PortAudioBackend::control_app_name () const
|
||||
{
|
||||
return _pcmio->control_app_name (name_to_id (_input_audio_device));
|
||||
}
|
||||
|
||||
void
|
||||
PortAudioBackend::launch_control_app ()
|
||||
{
|
||||
return _pcmio->launch_control_app (name_to_id(_input_audio_device));
|
||||
}
|
||||
|
||||
/* MIDI */
|
||||
|
||||
std::vector<std::string>
|
||||
|
@ -212,8 +212,8 @@ class PortAudioBackend : public AudioBackend {
|
||||
bool can_set_systemic_midi_latencies () const { return false; }
|
||||
|
||||
/* External control app */
|
||||
std::string control_app_name () const { return std::string (); }
|
||||
void launch_control_app () {}
|
||||
std::string control_app_name () const;
|
||||
void launch_control_app ();
|
||||
|
||||
/* MIDI */
|
||||
std::vector<std::string> enumerate_midi_options () const;
|
||||
|
@ -24,6 +24,10 @@
|
||||
#include <glibmm.h>
|
||||
#include "portaudio_io.h"
|
||||
|
||||
#ifdef WITH_ASIO
|
||||
#include "pa_asio.h"
|
||||
#endif
|
||||
|
||||
#include "pbd/compose.h"
|
||||
|
||||
#include "debug.h"
|
||||
@ -63,6 +67,43 @@ PortAudioIO::~PortAudioIO ()
|
||||
free (_output_buffer); _output_buffer = NULL;
|
||||
}
|
||||
|
||||
std::string
|
||||
PortAudioIO::control_app_name (int device_id) const
|
||||
{
|
||||
const PaHostApiInfo* info = Pa_GetHostApiInfo (_host_api_index);
|
||||
std::string app_name;
|
||||
|
||||
if (info == NULL) {
|
||||
DEBUG_AUDIO (string_compose ("Unable to determine Host API from index %1\n",
|
||||
_host_api_index));
|
||||
return app_name;
|
||||
}
|
||||
|
||||
PaHostApiTypeId type_id = info->type;
|
||||
|
||||
#ifdef WITH_ASIO
|
||||
if (type_id == paASIO) {
|
||||
// is this used for anything, or just acts as a boolean?
|
||||
return "PortaudioASIO";
|
||||
}
|
||||
#endif
|
||||
|
||||
return app_name;
|
||||
}
|
||||
|
||||
void
|
||||
PortAudioIO::launch_control_app (int device_id)
|
||||
{
|
||||
#ifdef WITH_ASIO
|
||||
PaError err = PaAsio_ShowControlPanel (device_id, NULL);
|
||||
|
||||
if (err != paNoError) {
|
||||
// error << ?
|
||||
DEBUG_AUDIO (string_compose (
|
||||
"Unable to show control panel for device with index %1\n", device_id));
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
int
|
||||
PortAudioIO::available_sample_rates(int device_id, std::vector<float>& sampleRates)
|
||||
@ -209,8 +250,10 @@ PortAudioIO::get_host_api_index_from_name (const std::string& name)
|
||||
|
||||
for (int i = 0; i < count; ++i) {
|
||||
const PaHostApiInfo* info = Pa_GetHostApiInfo (i);
|
||||
if (info->name != NULL) { // possible?
|
||||
if (name == info->name) return i;
|
||||
if (info != NULL && info->name != NULL) { // possible?
|
||||
if (name == info->name) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
}
|
||||
DEBUG_AUDIO (string_compose ("Unable to get host API from name: %1\n", name));
|
||||
|
@ -54,6 +54,8 @@ public:
|
||||
int available_sample_rates (int device_id, std::vector<float>& sampleRates);
|
||||
int available_buffer_sizes (int device_id, std::vector<uint32_t>& sampleRates);
|
||||
|
||||
std::string control_app_name (int device_id) const;
|
||||
void launch_control_app (int device_id);
|
||||
|
||||
void pcm_stop (void);
|
||||
int pcm_start (void);
|
||||
|
@ -17,6 +17,7 @@ def options(opt):
|
||||
def configure(conf):
|
||||
autowaf.configure(conf)
|
||||
autowaf.check_pkg(conf, 'portaudio-2.0', uselib_store='PORTAUDIO', atleast_version='19')
|
||||
conf.check(header_name='pa_asio.h', define_name='WITH_ASIO', mandatory=False)
|
||||
|
||||
def build(bld):
|
||||
obj = bld(features = 'cxx cxxshlib')
|
||||
|
Loading…
Reference in New Issue
Block a user