Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Unverified Commit 80e11641 authored by vivek mehta's avatar vivek mehta Committed by vlw
Browse files

hal: effect: visualizer: support two offload sessions

add support to get visualizer data for two offload
session.

Change-Id: I273aa392080e67a605137c43a3a5b798f66513fb
parent adbd81c8
Loading
Loading
Loading
Loading
+26 −6
Original line number Diff line number Diff line
@@ -290,17 +290,37 @@ bool effects_enabled() {
    return false;
}

int configure_proxy_capture(struct mixer *mixer, int value) {
    const char *proxy_ctl_name = "AFE_PCM_RX Audio Mixer MultiMedia4";
int set_control(const char* name, struct mixer *mixer, int value) {
    struct mixer_ctl *ctl;

    ctl = mixer_get_ctl_by_name(mixer, proxy_ctl_name);
    ctl = mixer_get_ctl_by_name(mixer, name);
    if (ctl == NULL) {
        ALOGW("%s: could not get %s ctl", __func__, proxy_ctl_name);
        ALOGW("%s: could not get %s ctl", __func__, name);
        return -EINVAL;
    }
    if (mixer_ctl_set_value(ctl, 0, value) != 0) {
        ALOGW("%s: error setting value %d on %s ", __func__, value, name);
        return -EINVAL;
    }
    if (mixer_ctl_set_value(ctl, 0, value) != 0)
        ALOGW("%s: error setting value %d on %s ", __func__, value, proxy_ctl_name);

    return 0;
}

int configure_proxy_capture(struct mixer *mixer, int value) {
    int retval = 0;

    retval = set_control("AFE_PCM_RX Audio Mixer MultiMedia4", mixer, value);

    if (retval != 0)
        return retval;

    // Extending visualizer to capture for compress2 path as well.
    // for extending it to multiple offload either this needs to be extended
    // or need to find better solution to enable only active offload sessions

    retval = set_control("AFE_PCM_RX Audio Mixer MultiMedia7", mixer, value);
    if (retval != 0)
        return retval;

    return 0;
}