diff options
author | Robin Gareus <robin@gareus.org> | 2014-06-04 19:16:37 +0200 |
---|---|---|
committer | Robin Gareus <robin@gareus.org> | 2014-06-04 19:16:37 +0200 |
commit | a907d3455ef4122f35f509cf0638a45aca8d3b7b (patch) | |
tree | af66b94f55e7b7419802d722ea7bc81fb885b855 /libs/backends/jack | |
parent | 40cfe86569daeacf44855befc335a5a5bce61b5f (diff) |
break out ALSA related functions into libardouralsautil
Diffstat (limited to 'libs/backends/jack')
-rw-r--r-- | libs/backends/jack/jack_utils.cc | 57 | ||||
-rw-r--r-- | libs/backends/jack/wscript | 2 |
2 files changed, 3 insertions, 56 deletions
diff --git a/libs/backends/jack/jack_utils.cc b/libs/backends/jack/jack_utils.cc index fcb0d7a169..3bb06ee4e8 100644 --- a/libs/backends/jack/jack_utils.cc +++ b/libs/backends/jack/jack_utils.cc @@ -19,7 +19,7 @@ */ #ifdef HAVE_ALSA -#include <alsa/asoundlib.h> +#include "ardouralsautil/devicelist.h" #endif #ifdef __APPLE__ @@ -276,60 +276,7 @@ void ARDOUR::get_jack_alsa_device_names (device_map_t& devices) { #ifdef HAVE_ALSA - snd_ctl_t *handle; - snd_ctl_card_info_t *info; - snd_pcm_info_t *pcminfo; - snd_ctl_card_info_alloca(&info); - snd_pcm_info_alloca(&pcminfo); - string devname; - int cardnum = -1; - int device = -1; - - while (snd_card_next (&cardnum) >= 0 && cardnum >= 0) { - - devname = "hw:"; - devname += PBD::to_string (cardnum, std::dec); - - if (snd_ctl_open (&handle, devname.c_str(), 0) >= 0 && snd_ctl_card_info (handle, info) >= 0) { - - if (snd_ctl_card_info (handle, info) < 0) { - continue; - } - - string card_name = snd_ctl_card_info_get_name (info); - - /* change devname to use ID, not number */ - - devname = "hw:"; - devname += snd_ctl_card_info_get_id (info); - - while (snd_ctl_pcm_next_device (handle, &device) >= 0 && device >= 0) { - - /* only detect duplex devices here. more - * complex arrangements are beyond our scope - */ - - snd_pcm_info_set_device (pcminfo, device); - snd_pcm_info_set_subdevice (pcminfo, 0); - snd_pcm_info_set_stream (pcminfo, SND_PCM_STREAM_CAPTURE); - - if (snd_ctl_pcm_info (handle, pcminfo) >= 0) { - - snd_pcm_info_set_device (pcminfo, device); - snd_pcm_info_set_subdevice (pcminfo, 0); - snd_pcm_info_set_stream (pcminfo, SND_PCM_STREAM_PLAYBACK); - - if (snd_ctl_pcm_info (handle, pcminfo) >= 0) { - devname += ','; - devname += PBD::to_string (device, std::dec); - devices.insert (std::make_pair (card_name, devname)); - } - } - } - - snd_ctl_close(handle); - } - } + get_alsa_audio_device_names(devices); #else /* silence a compiler unused variable warning */ (void) devices; diff --git a/libs/backends/jack/wscript b/libs/backends/jack/wscript index 1f54e7a5e7..c87441dca3 100644 --- a/libs/backends/jack/wscript +++ b/libs/backends/jack/wscript @@ -49,7 +49,7 @@ def build(bld): obj.uselib = [ 'JACK', 'PORTAUDIO' ] else: obj.uselib = [ 'JACK' ] - obj.use = 'libardour libpbd' + obj.use = 'libardour libpbd ardouralsautil' obj.vnum = JACKBACKEND_VERSION obj.install_path = os.path.join(bld.env['LIBDIR'], 'backends') obj.defines = ['PACKAGE="' + I18N_PACKAGE + '"', |