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

Commit 765efd2d authored by Trinath Thammishetty's avatar Trinath Thammishetty Committed by Gerrit - the friendly Code Review server
Browse files

hal: Add new parameter in SA+ effects and resolve compilation issue

Add new parameter in SA+ effects to get latency introduced
by each effect. Use #ifdef instead of #if in environmentalreverb header
file since _cplusplus macro not being defined is raising errors.

Change-Id: I0d5e410414502ac2bef77f1cbd7b041e4f26844d
parent 64fa732d
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -32,6 +32,8 @@
#include "effect_api.h"
#include "bass_boost.h"

#define BASSBOOST_MAX_LATENCY 30

/* Offload bassboost UUID: 2c4a8c24-1581-487f-94f6-0002a5d5c51b */
const effect_descriptor_t bassboost_descriptor = {
        {0x0634f220, 0xddd4, 0x11db, 0xa0fc, { 0x00, 0x02, 0xa5, 0xd5, 0xc5, 0x1b }},
@@ -101,6 +103,11 @@ int bass_get_parameter(effect_context_t *context, effect_param_t *p,
           p->status = -EINVAL;
        p->vsize = sizeof(int16_t);
        break;
    case BASSBOOST_PARAM_LATENCY:
        if (p->vsize < sizeof(uint32_t))
           p->status = -EINVAL;
        p->vsize = sizeof(uint32_t);
        break;
    default:
        p->status = -EINVAL;
    }
@@ -127,6 +134,10 @@ int bass_get_parameter(effect_context_t *context, effect_param_t *p,
            *(int16_t *)value = 0;
        break;

    case BASSBOOST_PARAM_LATENCY:
        *(uint32_t *)value = BASSBOOST_MAX_LATENCY;
        break;

    default:
        p->status = -EINVAL;
        break;
+3 −1
Original line number Diff line number Diff line
/*
 * Copyright (c) 2013-2015, The Linux Foundation. All rights reserved.
 * Copyright (c) 2013-2015, 2018, The Linux Foundation. All rights reserved.
 * Not a Contribution.
 *
 * Copyright (C) 2013 The Android Open Source Project
@@ -20,6 +20,8 @@
#ifndef OFFLOAD_EFFECT_BASS_BOOST_H_
#define OFFLOAD_EFFECT_BASS_BOOST_H_

#define BASSBOOST_PARAM_LATENCY 0x80000000

#include "bundle.h"

enum {
+13 −1
Original line number Diff line number Diff line
/*
 * Copyright (c) 2013-2014, 2017, The Linux Foundation. All rights reserved.
 * Copyright (c) 2013-2014, 2017-2018, The Linux Foundation. All rights reserved.
 * Not a Contribution.
 *
 * Copyright (C) 2013 The Android Open Source Project
@@ -29,6 +29,8 @@
#include "effect_api.h"
#include "equalizer.h"

#define EQUALIZER_MAX_LATENCY 0

/* Offload equalizer UUID: a0dac280-401c-11e3-9379-0002a5d5c51b */
const effect_descriptor_t equalizer_descriptor = {
        {0x0bed4300, 0xddd6, 0x11db, 0x8f34, {0x00, 0x02, 0xa5, 0xd5, 0xc5, 0x1b}}, // type
@@ -253,6 +255,12 @@ int equalizer_get_parameter(effect_context_t *context, effect_param_t *p,
        p->vsize = (2 + NUM_EQ_BANDS) * sizeof(uint16_t);
        break;

    case EQ_PARAM_LATENCY:
        if (p->vsize < sizeof(uint32_t))
           p->status = -EINVAL;
        p->vsize = sizeof(uint32_t);
        break;

    default:
        p->status = -EINVAL;
    }
@@ -352,6 +360,10 @@ int equalizer_get_parameter(effect_context_t *context, effect_param_t *p,
        }
    } break;

    case EQ_PARAM_LATENCY:
        *(uint32_t *)value = EQUALIZER_MAX_LATENCY;
        break;

    default:
        p->status = -EINVAL;
        break;
+3 −1
Original line number Diff line number Diff line
/*
 * Copyright (c) 2013-2014, The Linux Foundation. All rights reserved.
 * Copyright (c) 2013-2014, 2018, The Linux Foundation. All rights reserved.
 * Not a Contribution.
 *
 * Copyright (C) 2013 The Android Open Source Project
@@ -26,6 +26,8 @@
#define INVALID_PRESET		 -2
#define PRESET_CUSTOM		 -1

#define EQ_PARAM_LATENCY 0x80000000

extern const effect_descriptor_t equalizer_descriptor;

typedef struct equalizer_context_s {
+11 −1
Original line number Diff line number Diff line
/*
 * Copyright (c) 2013 - 2014, 2017, The Linux Foundation. All rights reserved.
 * Copyright (c) 2013 - 2014, 2017-2018, The Linux Foundation. All rights reserved.
 * Not a Contribution.
 *
 * Copyright (C) 2013 The Android Open Source Project
@@ -30,6 +30,8 @@
#include "effect_api.h"
#include "reverb.h"

#define REVERB_MAX_LATENCY 100

/* Offload auxiliary environmental reverb UUID: 79a18026-18fd-4185-8233-0002a5d5c51b */
const effect_descriptor_t aux_env_reverb_descriptor = {
        { 0xc2e5d5f0, 0x94bd, 0x4763, 0x9cac, { 0x4e, 0x23, 0x4d, 0x06, 0x83, 0x9e } },
@@ -522,6 +524,11 @@ int reverb_get_parameter(effect_context_t *context, effect_param_t *p,
           p->status = -EINVAL;
        p->vsize = sizeof(reverb_settings_t);
        break;
    case REVERB_PARAM_LATENCY:
        if (p->vsize < sizeof(uint32_t))
            return -EINVAL;
        p->vsize = sizeof(uint32_t);
        break;
    default:
        p->status = -EINVAL;
    }
@@ -575,6 +582,9 @@ int reverb_get_parameter(effect_context_t *context, effect_param_t *p,
        reverb_settings->diffusion = reverb_get_diffusion(reverb_ctxt);
        reverb_settings->density = reverb_get_density(reverb_ctxt);
        break;
    case REVERB_PARAM_LATENCY:
        *(uint16_t *)value = REVERB_MAX_LATENCY;
        break;
    default:
        p->status = -EINVAL;
        break;
Loading