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

Commit 6c4d381b authored by Ben Romberger's avatar Ben Romberger Committed by Garmond Leung
Browse files

hal: Add matrix limiter support

Matrix limiter is used to prevent saturation
when mixing multiple audio streams. It is
enabled when both the BD output flag is set
and the property audio.matrix.limiter.enable
is set to true.

Change-Id: Ibf06bd2444874ae555e98a26ed645f2455a3e1a3
parent b492e072
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -103,6 +103,10 @@
#define AUDIO_OUTPUT_FLAG_TIMESTAMP 0x10000
#endif

#ifndef AUDIO_OUTPUT_FLAG_BD10
#define AUDIO_OUTPUT_FLAG_BD10 0x20000
#endif

#ifndef AUDIO_OUTPUT_FLAG_INTERACTIVE
#define AUDIO_OUTPUT_FLAG_INTERACTIVE 0x40000
#endif
+1 −0
Original line number Diff line number Diff line
@@ -126,6 +126,7 @@ const struct string_to_enum s_flag_name_to_enum_table[] = {
    STRING_TO_ENUM(AUDIO_OUTPUT_FLAG_COMPRESS_PASSTHROUGH),
    STRING_TO_ENUM(AUDIO_OUTPUT_FLAG_TIMESTAMP),
    STRING_TO_ENUM(AUDIO_OUTPUT_FLAG_VOIP_RX),
    STRING_TO_ENUM(AUDIO_OUTPUT_FLAG_BD),
    STRING_TO_ENUM(AUDIO_OUTPUT_FLAG_INTERACTIVE),
    STRING_TO_ENUM(AUDIO_INPUT_FLAG_NONE),
    STRING_TO_ENUM(AUDIO_INPUT_FLAG_FAST),
+4 −0
Original line number Diff line number Diff line
@@ -4998,6 +4998,10 @@ int adev_open_output_stream(struct audio_hw_device *dev,
    out->a2dp_compress_mute = false;
    out->dynamic_pm_qos_enabled = 0;

    if ((flags & AUDIO_OUTPUT_FLAG_BD10) &&
        (property_get_bool("audio.matrix.limiter.enable", false)))
        platform_set_device_params(out, DEVICE_PARAM_LIMITER_ID, 1);

    if (out->devices & AUDIO_DEVICE_OUT_AUX_DIGITAL &&
        (flags & AUDIO_OUTPUT_FLAG_DIRECT)) {
        pthread_mutex_lock(&adev->lock);
+1 −0
Original line number Diff line number Diff line
@@ -428,6 +428,7 @@ enum {
 */
#define DEVICE_PARAM_MUTE_ID    0
#define DEVICE_PARAM_LATENCY_ID 1
#define DEVICE_PARAM_LIMITER_ID 2

#define ENUM_TO_STRING(X) #X

+1 −0
Original line number Diff line number Diff line
@@ -546,6 +546,7 @@ enum {
 */
#define DEVICE_PARAM_MUTE_ID    0
#define DEVICE_PARAM_LATENCY_ID 1
#define DEVICE_PARAM_LIMITER_ID 2

#define ENUM_TO_STRING(X) #X