From a907d3455ef4122f35f509cf0638a45aca8d3b7b Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Wed, 4 Jun 2014 19:16:37 +0200 Subject: [PATCH] break out ALSA related functions into libardouralsautil --- gtk2_ardour/ardev_common.sh.in | 2 +- .../ardouralsautil/devicelist.h | 32 +++ libs/ardouralsautil/devicelist.cc | 200 +++++++++++++++++ libs/ardouralsautil/wscript | 37 ++++ libs/backends/alsa/alsa_audiobackend.cc | 205 ++++-------------- libs/backends/alsa/alsa_audiobackend.h | 3 +- libs/backends/alsa/wscript | 2 +- libs/backends/jack/jack_utils.cc | 57 +---- libs/backends/jack/wscript | 2 +- tools/linux_packaging/build | 2 +- wscript | 1 + 11 files changed, 317 insertions(+), 226 deletions(-) create mode 100644 libs/ardouralsautil/ardouralsautil/devicelist.h create mode 100644 libs/ardouralsautil/devicelist.cc create mode 100644 libs/ardouralsautil/wscript diff --git a/gtk2_ardour/ardev_common.sh.in b/gtk2_ardour/ardev_common.sh.in index 0e7f76d754..30723722e2 100644 --- a/gtk2_ardour/ardev_common.sh.in +++ b/gtk2_ardour/ardev_common.sh.in @@ -31,7 +31,7 @@ export ARDOUR_DLL_PATH=$libs export GTK_PATH=~/.ardour3:$libs/clearlooks-newer export VAMP_PATH=$libs/vamp-plugins${VAMP_PATH:+:$VAMP_PATH} -export LD_LIBRARY_PATH=$libs/qm-dsp:$libs/vamp-sdk:$libs/surfaces:$libs/surfaces/control_protocol:$libs/ardour:$libs/midi++2:$libs/pbd:$libs/rubberband:$libs/soundtouch:$libs/gtkmm2ext:$libs/gnomecanvas:$libs/libsndfile:$libs/appleutility:$libs/taglib:$libs/evoral:$libs/evoral/src/libsmf:$libs/audiographer:$libs/timecode:$libs/libltc:$libs/canvas${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH} +export LD_LIBRARY_PATH=$libs/qm-dsp:$libs/vamp-sdk:$libs/surfaces:$libs/surfaces/control_protocol:$libs/ardour:$libs/midi++2:$libs/pbd:$libs/rubberband:$libs/soundtouch:$libs/gtkmm2ext:$libs/gnomecanvas:$libs/libsndfile:$libs/appleutility:$libs/taglib:$libs/evoral:$libs/evoral/src/libsmf:$libs/audiographer:$libs/timecode:$libs/libltc:$libs/canvas:$libs/ardouralsautil${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH} # DYLD_LIBRARY_PATH is for darwin. export DYLD_FALLBACK_LIBRARY_PATH=$LD_LIBRARY_PATH diff --git a/libs/ardouralsautil/ardouralsautil/devicelist.h b/libs/ardouralsautil/ardouralsautil/devicelist.h new file mode 100644 index 0000000000..ee56cadcde --- /dev/null +++ b/libs/ardouralsautil/ardouralsautil/devicelist.h @@ -0,0 +1,32 @@ +/* + * Copyright (C) 2014 Robin Gareus + * Copyright (C) 2013 Paul Davis + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#ifndef __libardouralsautil_devicelist_h__ +#define __libardouralsautil_devicelist_h__ + +#include +#include +namespace ARDOUR { + + void get_alsa_audio_device_names (std::map& devices); + void get_alsa_rawmidi_device_names (std::map& devices); + int card_to_num(const char* device_name); + +} +#endif diff --git a/libs/ardouralsautil/devicelist.cc b/libs/ardouralsautil/devicelist.cc new file mode 100644 index 0000000000..31957a80cf --- /dev/null +++ b/libs/ardouralsautil/devicelist.cc @@ -0,0 +1,200 @@ +/* + * Copyright (C) 2014 Robin Gareus + * Copyright (C) 2013 Paul Davis + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include "pbd/convert.h" +#include "ardouralsautil/devicelist.h" + +using namespace std; + +void +ARDOUR::get_alsa_audio_device_names (std::map& devices) +{ + 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) { + continue; + } + + 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) { + continue; + } + devname += ','; + devname += PBD::to_string (device, std::dec); + devices.insert (std::make_pair (card_name, devname)); + } + + snd_ctl_close(handle); + } + } +} + +void +ARDOUR::get_alsa_rawmidi_device_names (std::map& devices) +{ + int cardnum = -1; + snd_ctl_card_info_t *cinfo; + snd_ctl_card_info_alloca (&cinfo); + while (snd_card_next (&cardnum) >= 0 && cardnum >= 0) { + snd_ctl_t *handle; + std::string devname = "hw:"; + devname += PBD::to_string (cardnum, std::dec); + if (snd_ctl_open (&handle, devname.c_str (), 0) >= 0 && snd_ctl_card_info (handle, cinfo) >= 0) { + int device = -1; + while (snd_ctl_rawmidi_next_device (handle, &device) >= 0 && device >= 0) { + snd_rawmidi_info_t *info; + snd_rawmidi_info_alloca (&info); + snd_rawmidi_info_set_device (info, device); + + int subs_in, subs_out; + + snd_rawmidi_info_set_stream (info, SND_RAWMIDI_STREAM_INPUT); + if (snd_ctl_rawmidi_info (handle, info) >= 0) { + subs_in = snd_rawmidi_info_get_subdevices_count (info); + } else { + subs_in = 0; + } + + snd_rawmidi_info_set_stream (info, SND_RAWMIDI_STREAM_OUTPUT); + if (snd_ctl_rawmidi_info (handle, info) >= 0) { + subs_out = snd_rawmidi_info_get_subdevices_count (info); + } else { + subs_out = 0; + } + + const int subs = subs_in > subs_out ? subs_in : subs_out; + if (!subs) { + continue; + } + + for (int sub = 0; sub < subs; ++sub) { + snd_rawmidi_info_set_stream (info, sub < subs_in ? + SND_RAWMIDI_STREAM_INPUT : + SND_RAWMIDI_STREAM_OUTPUT); + + snd_rawmidi_info_set_subdevice (info, sub); + if (snd_ctl_rawmidi_info (handle, info) < 0) { + continue; + } + + const char *sub_name = snd_rawmidi_info_get_subdevice_name (info); + if (sub == 0 && sub_name[0] == '\0') { + devname = "hw:"; + devname += snd_ctl_card_info_get_id (cinfo); + devname += ","; + devname += PBD::to_string (device, std::dec); + + std::string card_name; + card_name = snd_rawmidi_info_get_name (info); + card_name += " ("; + if (sub < subs_in) card_name += "I"; + if (sub < subs_out) card_name += "O"; + card_name += ")"; + + devices.insert (std::make_pair (card_name, devname)); + break; + } else { + devname = "hw:"; + devname += snd_ctl_card_info_get_id (cinfo); + devname += ","; + devname += PBD::to_string (device, std::dec); + devname += ","; + devname += PBD::to_string (sub, std::dec); + + std::string card_name = sub_name; + card_name += " ("; + if (sub < subs_in) card_name += "I"; + if (sub < subs_out) card_name += "O"; + card_name += ")"; + devices.insert (std::make_pair (card_name, devname)); + } + } + } + snd_ctl_close (handle); + } + } +} + +int +ARDOUR::card_to_num(const char* device_name) +{ + char* ctl_name; + const char * comma; + snd_ctl_t* ctl_handle; + int i = -1; + + if (strncasecmp(device_name, "plughw:", 7) == 0) { + device_name += 4; + } + if (!(comma = strchr(device_name, ','))) { + ctl_name = strdup(device_name); + } else { + ctl_name = strndup(device_name, comma - device_name); + } + + if (snd_ctl_open (&ctl_handle, ctl_name, 0) >= 0) { + snd_ctl_card_info_t *card_info; + snd_ctl_card_info_alloca (&card_info); + if (snd_ctl_card_info(ctl_handle, card_info) >= 0) { + i = snd_ctl_card_info_get_card(card_info); + } + snd_ctl_close(ctl_handle); + } + free(ctl_name); + return i; +} diff --git a/libs/ardouralsautil/wscript b/libs/ardouralsautil/wscript new file mode 100644 index 0000000000..9a5d1e5251 --- /dev/null +++ b/libs/ardouralsautil/wscript @@ -0,0 +1,37 @@ +#!/usr/bin/env python +from waflib.extras import autowaf as autowaf +from waflib import Options +import os +import sys +import re + +# Mandatory variables +top = '.' +out = 'build' + +path_prefix = 'libs/ardouralsautil/' + +def options(opt): + autowaf.set_options(opt) + + +def configure(conf): + autowaf.configure(conf) + if re.search ("linux", sys.platform) != None and Options.options.dist_target != 'mingw': + autowaf.check_pkg(conf, 'alsa', uselib_store='ALSA') + +def build(bld): + if re.search ("linux", sys.platform) != None: + if bld.is_defined('HAVE_ALSA'): + obj = bld(features = 'cxx cxxshlib') + obj.source = [ + 'devicelist.cc' + ] + obj.export_includes = ['.'] + obj.includes = ['.'] + obj.name = 'ardouralsautil' + obj.target = 'ardouralsautil' + obj.use = 'libpbd' + obj.uselib = [ 'ALSA' ] + obj.vnum = '0.0.1' + obj.install_path = os.path.join(bld.env['LIBDIR'], 'ardouralsautil') diff --git a/libs/backends/alsa/alsa_audiobackend.cc b/libs/backends/alsa/alsa_audiobackend.cc index 7115af0206..e8198ba333 100644 --- a/libs/backends/alsa/alsa_audiobackend.cc +++ b/libs/backends/alsa/alsa_audiobackend.cc @@ -31,6 +31,7 @@ #include "pbd/file_utils.h" #include "ardour/port_manager.h" #include "ardour/system_exec.h" +#include "ardouralsautil/devicelist.h" #include "i18n.h" using namespace ARDOUR; @@ -44,8 +45,8 @@ AlsaAudioBackend::AlsaAudioBackend (AudioEngine& e, AudioBackendInfo& info) , _run (false) , _active (false) , _freewheeling (false) - , _capture_device("") - , _playback_device("") + , _audio_device("") + , _midi_device("") , _samplerate (48000) , _samples_per_period (1024) , _periods_per_cycle (2) @@ -83,79 +84,14 @@ std::vector AlsaAudioBackend::enumerate_devices () const { std::vector s; - int cardnum = -1; - int device = -1; - snd_ctl_card_info_t *info; - snd_ctl_card_info_alloca (&info); - snd_pcm_info_t *pcminfo; - snd_pcm_info_alloca (&pcminfo); - - while (snd_card_next (&cardnum) >= 0 && cardnum >= 0) { - snd_ctl_t *handle; - - std::string 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; - } - - std::string card_name = snd_ctl_card_info_get_name (info); - devname = "hw:"; - devname += snd_ctl_card_info_get_id (info); - - while (snd_ctl_pcm_next_device (handle, &device) >= 0 && device >= 0) { - 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) { - continue; - } - 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) { - continue; - } - devname += ','; - devname += PBD::to_string (device, std::dec); - s.push_back (DeviceStatus (devname + " " + card_name, true)); - } - snd_ctl_close (handle); - } + std::map devices; + get_alsa_audio_device_names(devices); + for (std::map::const_iterator i = devices.begin (); i != devices.end(); ++i) { + s.push_back (DeviceStatus (i->first, true)); } return s; } -static int card_to_num(const char* device_name) -{ - char* ctl_name; - const char * comma; - snd_ctl_t* ctl_handle; - int i = -1; - - if (strncasecmp(device_name, "plughw:", 7) == 0) { - device_name += 4; - } - if (!(comma = strchr(device_name, ','))) { - ctl_name = strdup(device_name); - } else { - ctl_name = strndup(device_name, comma - device_name); - } - - if (snd_ctl_open (&ctl_handle, ctl_name, 0) >= 0) { - snd_ctl_card_info_t *card_info; - snd_ctl_card_info_alloca (&card_info); - if (snd_ctl_card_info(ctl_handle, card_info) >= 0) { - i = snd_ctl_card_info_get_card(card_info); - } - snd_ctl_close(ctl_handle); - } - free(ctl_name); - return i; -} - static void acquire_device(const char* device_name) { /* This is quick hack, ideally we'll link against libdbus and implement a dbus-listener @@ -253,8 +189,7 @@ AlsaAudioBackend::can_change_buffer_size_when_running () const int AlsaAudioBackend::set_device_name (const std::string& d) { - _capture_device = d; - _playback_device = d; + _audio_device = d; return 0; } @@ -317,7 +252,7 @@ AlsaAudioBackend::set_systemic_output_latency (uint32_t sl) std::string AlsaAudioBackend::device_name () const { - return _capture_device; + return _audio_device; } float @@ -363,96 +298,17 @@ AlsaAudioBackend::systemic_output_latency () const } /* MIDI */ -void -AlsaAudioBackend::enumerate_midi_devices (std::vector &m) const -{ - int cardnum = -1; - snd_ctl_card_info_t *cinfo; - snd_ctl_card_info_alloca (&cinfo); - while (snd_card_next (&cardnum) >= 0 && cardnum >= 0) { - snd_ctl_t *handle; - std::string devname = "hw:"; - devname += PBD::to_string (cardnum, std::dec); - if (snd_ctl_open (&handle, devname.c_str (), 0) >= 0 && snd_ctl_card_info (handle, cinfo) >= 0) { - int device = -1; - while (snd_ctl_rawmidi_next_device (handle, &device) >= 0 && device >= 0) { - snd_rawmidi_info_t *info; - snd_rawmidi_info_alloca (&info); - snd_rawmidi_info_set_device (info, device); - - int subs_in, subs_out; - - snd_rawmidi_info_set_stream (info, SND_RAWMIDI_STREAM_INPUT); - if (snd_ctl_rawmidi_info (handle, info) >= 0) { - subs_in = snd_rawmidi_info_get_subdevices_count (info); - } else { - subs_in = 0; - } - - snd_rawmidi_info_set_stream (info, SND_RAWMIDI_STREAM_OUTPUT); - if (snd_ctl_rawmidi_info (handle, info) >= 0) { - subs_out = snd_rawmidi_info_get_subdevices_count (info); - } else { - subs_out = 0; - } - - const int subs = subs_in > subs_out ? subs_in : subs_out; - if (!subs) { - continue; - } - - for (int sub = 0; sub < subs; ++sub) { - snd_rawmidi_info_set_stream (info, sub < subs_in ? - SND_RAWMIDI_STREAM_INPUT : - SND_RAWMIDI_STREAM_OUTPUT); - - snd_rawmidi_info_set_subdevice (info, sub); - if (snd_ctl_rawmidi_info (handle, info) < 0) { - continue; - } - - const char *sub_name = snd_rawmidi_info_get_subdevice_name (info); - if (sub == 0 && sub_name[0] == '\0') { - devname = "hw:"; - devname += snd_ctl_card_info_get_id (cinfo); - devname += ","; - devname += PBD::to_string (device, std::dec); - devname += " "; - devname += snd_rawmidi_info_get_name (info); - devname += " ("; - if (sub < subs_in) devname += "I"; - if (sub < subs_out) devname += "O"; - devname += ")"; - m.push_back (devname); - break; - } else { - devname = "hw:"; - devname += snd_ctl_card_info_get_id (cinfo); - devname += ","; - devname += PBD::to_string (device, std::dec); - devname += ","; - devname += PBD::to_string (sub, std::dec); - devname += " "; - devname += sub_name; - devname += " ("; - if (sub < subs_in) devname += "I"; - if (sub < subs_out) devname += "O"; - devname += ")"; - m.push_back (devname); - } - } - } - snd_ctl_close (handle); - } - } -} - std::vector AlsaAudioBackend::enumerate_midi_options () const { std::vector m; m.push_back (_("-None-")); - enumerate_midi_devices(m); + std::map devices; + get_alsa_rawmidi_device_names(devices); + + for (std::map::const_iterator i = devices.begin (); i != devices.end(); ++i) { + m.push_back (i->first); + } if (m.size() > 2) { m.push_back (_("-All-")); } @@ -503,9 +359,18 @@ AlsaAudioBackend::_start (bool for_latency_measurement) assert(_rmidi_out.size() == 0); assert(_pcmi == 0); - unsigned int pos = _capture_device.find(" "); - acquire_device(_capture_device.substr(0, pos).c_str()); - _pcmi = new Alsa_pcmi (_capture_device.substr(0, pos).c_str(), _playback_device.substr(0, pos).c_str(), 0, _samplerate, _samples_per_period, _periods_per_cycle, 0); + std::string alsa_device; + std::map devices; + get_alsa_audio_device_names(devices); + for (std::map::const_iterator i = devices.begin (); i != devices.end(); ++i) { + if (i->first == _audio_device) { + alsa_device = i->second; + break; + } + } + + acquire_device(alsa_device.c_str()); + _pcmi = new Alsa_pcmi (alsa_device.c_str(), alsa_device.c_str(), 0, _samplerate, _samples_per_period, _periods_per_cycle, 0); switch (_pcmi->state ()) { case 0: /* OK */ break; case -1: PBD::error << _("AlsaAudioBackend: failed to open device.") << endmsg; break; @@ -947,10 +812,20 @@ AlsaAudioBackend::register_system_midi_ports() return 0; } else if (_midi_device == _("-All-")) { - enumerate_midi_devices(devices); + std::map devmap; + get_alsa_rawmidi_device_names(devmap); + for (std::map::const_iterator i = devmap.begin (); i != devmap.end(); ++i) { + devices.push_back (i->second); + } } else { - unsigned int pos = _midi_device.find(" "); - devices.push_back(_midi_device.substr(0, pos)); + std::map devmap; + get_alsa_rawmidi_device_names(devmap); + for (std::map::const_iterator i = devmap.begin (); i != devmap.end(); ++i) { + if (i->first == _midi_device) { + devices.push_back (i->second); + break; + } + } } for (std::vector::const_iterator i = devices.begin (); i != devices.end (); ++i) { diff --git a/libs/backends/alsa/alsa_audiobackend.h b/libs/backends/alsa/alsa_audiobackend.h index cb9e50af10..6ad58161f3 100644 --- a/libs/backends/alsa/alsa_audiobackend.h +++ b/libs/backends/alsa/alsa_audiobackend.h @@ -285,8 +285,7 @@ class AlsaAudioBackend : public AudioBackend { bool _freewheeling; void enumerate_midi_devices (std::vector &) const; - std::string _capture_device; - std::string _playback_device; + std::string _audio_device; std::string _midi_device; float _samplerate; diff --git a/libs/backends/alsa/wscript b/libs/backends/alsa/wscript index ff35abd30c..0e539e5718 100644 --- a/libs/backends/alsa/wscript +++ b/libs/backends/alsa/wscript @@ -31,7 +31,7 @@ def build(bld): obj.includes = ['.'] obj.name = 'alsa_audiobackend' obj.target = 'alsa_audiobackend' - obj.use = 'libardour libpbd' + obj.use = 'libardour libpbd ardouralsautil' obj.uselib = 'ALSA' obj.vnum = ALSABACKEND_VERSION obj.install_path = os.path.join(bld.env['LIBDIR'], 'backends') 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 +#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 + '"', diff --git a/tools/linux_packaging/build b/tools/linux_packaging/build index 647fc88f4b..78ab149f2c 100755 --- a/tools/linux_packaging/build +++ b/tools/linux_packaging/build @@ -409,7 +409,7 @@ cp $BUILD_ROOT/libs/fst/ardour-vst-scanner* $APPLIB/ || true cp $BUILD_ROOT/libs/vfork/ardour-exec-wrapper $APPLIB/ OURLIBDIR=$BUILD_ROOT/libs -OURLIBS=$OURLIBDIR/vamp-sdk:$OURLIBDIR/surfaces/control_protocol:$OURLIBDIR/ardour:$OURLIBDIR/midi++2:$OURLIBDIR/pbd:$OURLIBDIR/rubberband:$OURLIBDIR/soundtouch:$OURLIBDIR/gtkmm2ext:$OURLIBDIR/sigc++2:$OURLIBDIR/glibmm2:$OURLIBDIR/gtkmm2/atk:$OURLIBDIR/gtkmm2/pango:$OURLIBDIR/gtkmm2/gdk:$OURLIBDIR/gtkmm2/gtk:$OURLIBDIR/canvas:$OURLIBDIR/libsndfile:$OURLIBDIR/evoral:$OURLIBDIR/evoral/src/libsmf:$OURLIBDIR/audiographer:$OURLIBDIR/timecode:$OURLIBDIR/taglib:$OURLIBDIR/libltc:$OURLIBDIR/qm-dsp +OURLIBS=$OURLIBDIR/vamp-sdk:$OURLIBDIR/surfaces/control_protocol:$OURLIBDIR/ardour:$OURLIBDIR/midi++2:$OURLIBDIR/pbd:$OURLIBDIR/rubberband:$OURLIBDIR/soundtouch:$OURLIBDIR/gtkmm2ext:$OURLIBDIR/sigc++2:$OURLIBDIR/glibmm2:$OURLIBDIR/gtkmm2/atk:$OURLIBDIR/gtkmm2/pango:$OURLIBDIR/gtkmm2/gdk:$OURLIBDIR/gtkmm2/gtk:$OURLIBDIR/canvas:$OURLIBDIR/libsndfile:$OURLIBDIR/evoral:$OURLIBDIR/evoral/src/libsmf:$OURLIBDIR/audiographer:$OURLIBDIR/timecode:$OURLIBDIR/taglib:$OURLIBDIR/libltc:$OURLIBDIR/qm-dsp:$OURLIBDIR/ardouralsautil echo $OURLIBS${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH} diff --git a/wscript b/wscript index f8885c839a..c15b8891ed 100644 --- a/wscript +++ b/wscript @@ -81,6 +81,7 @@ children = [ # shared helper binaries (plugin-scanner, exec-wrapper) 'libs/fst', 'libs/vfork', + 'libs/ardouralsautil', ] i18n_children = [