diff options
Diffstat (limited to 'plugins/alsa/alsa-api-mixer.c')
-rw-r--r-- | plugins/alsa/alsa-api-mixer.c | 33 |
1 files changed, 22 insertions, 11 deletions
diff --git a/plugins/alsa/alsa-api-mixer.c b/plugins/alsa/alsa-api-mixer.c index e892b2f..ebb8c25 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_req_t request) { mixer->transaction = transaction; - AFB_API_INFO(mixer->api, "%s set LOOPS", __func__); - - if (loopsJ) { - error = ApiLoopAttach(mixer, request, uid, loopsJ); - if (error) goto fail; - } - AFB_API_INFO(mixer->api, "%s set PLAYBACKS", __func__); if (playbacksJ) { @@ -616,6 +612,16 @@ STATIC void MixerAttachVerb(afb_req_t request) { 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_API_INFO(mixer->api, "%s set LOOPS/AVIRT", __func__); + error = ApiLoopAttach(mixer, request, uid, + ((loopsJ) ? loopsJ : LoopsJ), streamsJ); + if (error) goto fail_loop; + } + AFB_API_INFO(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) { |