*/
#include <alsa/asoundlib.h>
+#include <glib.h>
+
#include "pbd/convert.h"
#include "ardouralsautil/devicelist.h"
using namespace std;
void
-ARDOUR::get_alsa_audio_device_names (std::map<std::string, std::string>& devices)
+ARDOUR::get_alsa_audio_device_names (std::map<std::string, std::string>& devices, AlsaDuplex duplex)
{
snd_ctl_t *handle;
snd_ctl_card_info_t *info;
string devname;
int cardnum = -1;
int device = -1;
+ const char* fixed_name;
+
+ if ((fixed_name = g_getenv ("ARDOUR_ALSA_DEVICE"))) {
+ devices.insert (make_pair<string,string> (fixed_name, fixed_name));
+ return;
+ }
+
+ assert (duplex > 0);
while (snd_card_next (&cardnum) >= 0 && cardnum >= 0) {
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) {
+ if (snd_ctl_pcm_info (handle, pcminfo) < 0 && (duplex & HalfDuplexIn)) {
continue;
}
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) {
+ if (snd_ctl_pcm_info (handle, pcminfo) < 0 && (duplex & HalfDuplexOut)) {
continue;
}
devname += ',';