retval_play = 0;
memset(&sndpcm, 0, sizeof(sndpcm));
- if (bat->playback.device == NULL) {
- fprintf(bat->err, _("No PCM device for playback: exit\n"));
- retval_play = 1;
- goto exit1;
- }
-
err = snd_pcm_open(&sndpcm.handle, bat->playback.device,
SND_PCM_STREAM_PLAYBACK, 0);
if (err != 0) {
retval_record = 0;
memset(&sndpcm, 0, sizeof(sndpcm));
- if (bat->capture.device == NULL) {
- fprintf(bat->err, _("No PCM device for capture: exit\n"));
- retval_record = 1;
- goto exit1;
- }
-
err = snd_pcm_open(&sndpcm.handle, bat->capture.device,
SND_PCM_STREAM_CAPTURE, 0);
if (err != 0) {
return err;
}
+ /* Set default playback and capture devices */
+ if (bat->playback.device == NULL && bat->capture.device == NULL)
+ bat->playback.device = bat->capture.device = DEFAULT_DEV_NAME;
+
/* Determine capture file */
if (bat->local) {
bat->capture.file = bat->playback.file;
#include <alsa/asoundlib.h>
#define TEMP_RECORD_FILE_NAME "/tmp/bat.wav.XXXXXX"
+#define DEFAULT_DEV_NAME "default"
#define OPT_BASE 300
#define OPT_LOG (OPT_BASE + 1)