aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/alsa/alsa-api-loop.c
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/alsa/alsa-api-loop.c')
-rw-r--r--plugins/alsa/alsa-api-loop.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/plugins/alsa/alsa-api-loop.c b/plugins/alsa/alsa-api-loop.c
index a4595dc..b3b96ed 100644
--- a/plugins/alsa/alsa-api-loop.c
+++ b/plugins/alsa/alsa-api-loop.c
@@ -19,7 +19,11 @@
#define _GNU_SOURCE // needed for vasprintf
#include "alsa-softmixer.h"
+
+#ifdef HAVE_AVIRT
#include <avirt/avirt.h>
+#endif
+
#include <string.h>
#define UID_AVIRT_LOOP "AVIRT-Loopback"
@@ -157,7 +161,7 @@ STATIC AlsaLoopSubdevT *ProcessOneAvirtSubdev(SoftMixerT *mixer, AlsaSndLoopT *l
AFB_API_ERROR(mixer->api, "%s: No zones defined!", __func__);
goto OnErrorExit;
}
-
+#ifdef HAVE_AVIRT
error = snd_avirt_stream_new(uid, zone->ccount,
SND_PCM_STREAM_PLAYBACK, "ap_loopback", false);
if (error < 0) {
@@ -166,7 +170,7 @@ STATIC AlsaLoopSubdevT *ProcessOneAvirtSubdev(SoftMixerT *mixer, AlsaSndLoopT *l
__func__, mixer->uid, uid, error);
return NULL;
}
-
+#endif
AlsaLoopSubdevT *subdev = calloc(1, sizeof (AlsaPcmCtlT));
subdev->uid = NULL;
subdev->index = index;
@@ -331,6 +335,7 @@ STATIC AlsaSndLoopT *AttachOneLoop(SoftMixerT *mixer, const char *uid, json_obje
goto fail_snd_card_ctl;
}
} else { // loop->avirt == true
+#ifdef HAVE_AVIRT
AFB_API_NOTICE(mixer->api, "nbStreams: %d max.streams: %d", mixer->nbStreams, mixer->max.streams);
if (mixer->nbStreams >= mixer->max.streams)
@@ -373,6 +378,7 @@ STATIC AlsaSndLoopT *AttachOneLoop(SoftMixerT *mixer, const char *uid, json_obje
__func__, mixer->uid, uid, loop->uid, loop->sndcard->cid.devpath, loop->sndcard->cid.cardid);
goto fail_snd_card;
}
+#endif
}
AFB_API_NOTICE(mixer->api, "%s, uid %s DONE", __func__, uid);
@@ -415,8 +421,10 @@ static void loopDestroy(SoftMixerT * mixer, void* arg) {
mixer->nbLoops--;
cds_list_del(&loop->list);
+#ifdef HAVE_AVIRT
if (loop->avirt)
snd_avirt_card_unconfigure();
+#endif
free(loop);
AFB_API_DEBUG(mixer->api, "DONE !");