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

Commit 137c9708 authored by Eric Laurent's avatar Eric Laurent Committed by Android (Google) Code Review
Browse files

Merge "audiopolicy: engine: Add Volume Groups to common Engine"

parents 0076efc0 251c7f0a
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -43,7 +43,7 @@ status_t AudioAttributes::readFromParcel(const Parcel *parcel)
        strcpy(mAttributes.tags, "");
    }
    mStreamType = static_cast<audio_stream_type_t>(parcel->readInt32());
    mGroupId = parcel->readUint32();
    mGroupId = static_cast<volume_group_t>(parcel->readUint32());
    return NO_ERROR;
}

@@ -60,7 +60,7 @@ status_t AudioAttributes::writeToParcel(Parcel *parcel) const
        parcel->writeUtf8AsUtf16(mAttributes.tags);
    }
    parcel->writeInt32(static_cast<int32_t>(mStreamType));
    parcel->writeUint32(mGroupId);
    parcel->writeUint32(static_cast<uint32_t>(mGroupId));
    return NO_ERROR;
}

+4 −3
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@

#pragma once

#include <media/AudioCommonTypes.h>
#include <system/audio.h>
#include <system/audio_policy.h>
#include <binder/Parcelable.h>
@@ -28,7 +29,7 @@ class AudioAttributes : public Parcelable
public:
    AudioAttributes() = default;
    AudioAttributes(const audio_attributes_t &attributes) : mAttributes(attributes) {}
    AudioAttributes(uint32_t groupId,
    AudioAttributes(volume_group_t groupId,
                    audio_stream_type_t stream,
                    const audio_attributes_t &attributes) :
         mAttributes(attributes), mStreamType(stream), mGroupId(groupId) {}
@@ -39,7 +40,7 @@ public:
    status_t writeToParcel(Parcel *parcel) const override;

    audio_stream_type_t getStreamType() const { return mStreamType; }
    uint32_t getGroupId() const { return mGroupId; }
    volume_group_t getGroupId() const { return mGroupId; }

private:
    audio_attributes_t mAttributes = AUDIO_ATTRIBUTES_INITIALIZER;
@@ -53,7 +54,7 @@ private:
     * @brief mGroupId: for future volume management, define groups within a strategy that follows
     * the same curves of volume (extension of stream types to manage volume)
     */
    uint32_t mGroupId = 0;
    volume_group_t mGroupId = VOLUME_GROUP_NONE;
};

} // namespace android
+5 −1
Original line number Diff line number Diff line
@@ -27,7 +27,7 @@ enum product_strategy_t : uint32_t;
const product_strategy_t PRODUCT_STRATEGY_NONE = static_cast<product_strategy_t>(-1);

using AttributesVector = std::vector<audio_attributes_t>;
using StreamTypes = std::vector<audio_stream_type_t>;
using StreamTypeVector = std::vector<audio_stream_type_t>;

constexpr bool operator==(const audio_attributes_t &lhs, const audio_attributes_t &rhs)
{
@@ -38,5 +38,9 @@ constexpr bool operator!=(const audio_attributes_t &lhs, const audio_attributes_
{
    return !(lhs==rhs);
}

enum volume_group_t : uint32_t;
static const volume_group_t VOLUME_GROUP_NONE = static_cast<volume_group_t>(-1);

} // namespace android
+1 −0
Original line number Diff line number Diff line
@@ -21,6 +21,7 @@
#include <math.h>

namespace android {

/**
 * VolumeSource is the discriminent for volume management on an output.
 * It used to be the stream type by legacy, it may be host volume group or a volume curves if
+2 −0
Original line number Diff line number Diff line
@@ -38,6 +38,8 @@ public:
    virtual float volIndexToDb(device_category device, int indexInUi) const = 0;
    virtual bool hasVolumeIndexForDevice(audio_devices_t device) const = 0;
    virtual status_t initVolume(int indexMin, int indexMax) = 0;
    virtual std::vector<audio_attributes_t> getAttributes() const = 0;
    virtual std::vector<audio_stream_type_t> getStreamTypes() const = 0;
    virtual void dump(String8 *dst, int spaces = 0, bool curvePoints = false) const = 0;
};

Loading