summaryrefslogtreecommitdiffstats
path: root/plugins/alsa/alsa-api-mixer.c
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/alsa/alsa-api-mixer.c')
-rw-r--r--plugins/alsa/alsa-api-mixer.c35
1 files changed, 23 insertions, 12 deletions
diff --git a/plugins/alsa/alsa-api-mixer.c b/plugins/alsa/alsa-api-mixer.c
index 6d80b55..328f02e 100644
--- a/plugins/alsa/alsa-api-mixer.c
+++ b/plugins/alsa/alsa-api-mixer.c
@@ -27,6 +27,9 @@ static struct cds_list_head mixerList;
static void MixerDelete(SoftMixerT * mixer);
+// AVIRT: temporary loops JSON
+static json_object *LoopsJ = NULL;
+
static void MixerExit() {
SoftMixerT *mixer, *tmp;
printf("%s !\n", __func__);
@@ -575,13 +578,6 @@ STATIC void MixerAttachVerb(AFB_ReqT request) {
mixer->transaction = transaction;
- AFB_ApiInfo(mixer->api, "%s set LOOPS", __func__);
-
- if (loopsJ) {
- error = ApiLoopAttach(mixer, request, uid, loopsJ);
- if (error) goto fail;
- }
-
AFB_ApiInfo(mixer->api, "%s set PLAYBACKS", __func__);
if (playbacksJ) {
@@ -611,11 +607,21 @@ STATIC void MixerAttachVerb(AFB_ReqT request) {
error = ApiZoneAttach(mixer, request, uid, zonesJ);
if (error)
goto fail_source;
-
+
json_object *resultJ = MixerInfoZones(mixer, zonesJ, 0);
json_object_object_add(responseJ, "zone", resultJ);
}
+ // In AVIRT mode, we require both the loops and streams JSON objects to
+ // construct the loopbacks, so when the loops are set, but the streams
+ // are not, we need to save the loops until the streams are given to us
+ if (streamsJ && (loopsJ || LoopsJ)) {
+ AFB_ApiInfo(mixer->api, "%s set LOOPS/AVIRT", __func__);
+ error = ApiLoopAttach(mixer, request, uid,
+ ((loopsJ) ? loopsJ : LoopsJ), streamsJ);
+ if (error) goto fail_loop;
+ }
+
AFB_ApiInfo(mixer->api, "%s set RAMPS", __func__);
if (rampsJ) {
@@ -657,12 +663,12 @@ fail_ramp:
// TODO remove created ramps
fail_zone:
// TODO remove created zone
+fail_loop:
+ // TODO remove created loops
fail_source:
// TODO remove created sources
fail_sink:
// TODO remove created sinks
-fail_loop:
- // TODO remove created loops
fail:
if (mixer->transaction)
@@ -734,9 +740,14 @@ CTLP_CAPI(MixerAttach, source, argsJ, responseJ) {
if (error) goto OnErrorExit;
}
- if (loopsJ) {
- error = ApiLoopAttach(mixer, NULL, uid, loopsJ);
+ // In AVIRT mode, we require both the loops and streams JSON objects to
+ // construct the loopbacks, so when the loops are set, but the streams
+ // are not, we need to save the loops until the streams are given to us
+ if (loopsJ && streamsJ) {
+ error = ApiLoopAttach(mixer, NULL, uid, loopsJ, streamsJ);
if (error) goto OnErrorExit;
+ } else {
+ LoopsJ = loopsJ;
}
if (zonesJ) {