summaryrefslogtreecommitdiffstats
path: root/plugins/alsa/alsa-api-streams.c
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/alsa/alsa-api-streams.c')
-rw-r--r--plugins/alsa/alsa-api-streams.c23
1 files changed, 16 insertions, 7 deletions
diff --git a/plugins/alsa/alsa-api-streams.c b/plugins/alsa/alsa-api-streams.c
index c1fb749..edf506e 100644
--- a/plugins/alsa/alsa-api-streams.c
+++ b/plugins/alsa/alsa-api-streams.c
@@ -19,6 +19,7 @@
#define _GNU_SOURCE // needed for vasprintf
#include "alsa-softmixer.h"
+#include <avirt/avirt.h>
#include <string.h>
#include <stdbool.h>
@@ -231,6 +232,7 @@ STATIC int CreateOneStream(SoftMixerT *mixer, const char * uid, AlsaStreamAudioT
char *volName = NULL;
int pauseNumid = 0;
int volNumid = 0;
+ int device, subdev;
AFB_API_DEBUG(mixer->api,
"NEW STREAM stream %s %s, source %s, sink %s, mute %d",
@@ -238,12 +240,20 @@ STATIC int CreateOneStream(SoftMixerT *mixer, const char * uid, AlsaStreamAudioT
loopDev = ApiLoopFindSubdev(mixer, stream->uid, stream->source, &loop);
if (loopDev) {
+ if (loop->avirt) {
+ device = loopDev->index;
+ subdev = 0;
+ } else { // loop->avirt == false
+ device = loop->capture;
+ subdev = loopDev->index;
+ }
+
// create a valid PCM reference and try to open it.
captureDev->devpath = NULL;
captureDev->cardid = NULL;
captureDev->cardidx = loop->sndcard->cid.cardidx;
- captureDev->device = loop->capture;
- captureDev->subdev = loopDev->index;
+ captureDev->device = device;
+ captureDev->subdev = subdev;
captureDev->pcmplug_params = NULL;
captureCard = loop->sndcard;
@@ -476,11 +486,10 @@ STATIC int CreateOneStream(SoftMixerT *mixer, const char * uid, AlsaStreamAudioT
}
if (loop) {
- if (asprintf((char**) &stream->source, "hw:%d,%d,%d", captureDev->cardidx, loop->playback, capturePcm->cid.subdev) == -1) {
- SOFTMIXER_NOMEM(mixer->api);
- goto OnErrorExit;
- }
-
+ int device = (loop->avirt) ? captureDev->device
+ : loop->playback;
+ if (asprintf((char**) &stream->source, "hw:%d,%d,%d", captureDev->cardidx, device, capturePcm->cid.subdev) == -1)
+ goto OnErrorExit;
} else {
if (asprintf((char**) &stream->source, "hw:%d,%d,%d", captureDev->cardidx, captureDev->device, captureDev->subdev) == -1) {
SOFTMIXER_NOMEM(mixer->api);