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

Commit 41502b24 authored by jiabin's avatar jiabin
Browse files

Move AudioGain to libaudiofoundation.

1. Create folder for libaudiofoudation.
2. Move AudioGain to libaudiofoudation. The goal is to make AudioGain
be able to use in binder call and be vendor-available later.

Bug: 135621476
Test: make, CTS for AudioTrack, AudioRecord, AudioManagerTest
Change-Id: Ibf16ad9cb7f2ac657a02632ccbe4f934b5a12731
Merged-In: Ibf16ad9cb7f2ac657a02632ccbe4f934b5a12731
parent b8ec243b
Loading
Loading
Loading
Loading
+33 −0
Original line number Diff line number Diff line
cc_library_headers {
    name: "libaudiofoundation_headers",
    vendor_available: true,
    export_include_dirs: ["include"],
}

cc_library_shared {
    name: "libaudiofoundation",
    vendor_available: true,

    srcs: [
        "AudioGain.cpp",
    ],

    shared_libs: [
        "libbase",
        "libbinder",
        "liblog",
        "libutils",
    ],

    header_libs: [
        "libaudio_system_headers",
        "libaudiofoundation_headers",
    ],

    export_header_lib_headers: ["libaudiofoundation_headers"],

    cflags: [
        "-Werror",
        "-Wall",
    ],
}
+13 −13
Original line number Diff line number Diff line
@@ -14,7 +14,7 @@
 * limitations under the License.
 */

#define LOG_TAG "APM::AudioGain"
#define LOG_TAG "AudioGain"
//#define LOG_NDEBUG 0

//#define VERY_VERBOSE_LOGGING
@@ -24,9 +24,9 @@
#define ALOGVV(a...) do { } while(0)
#endif

#include "AudioGain.h"
#include <android-base/stringprintf.h>
#include <media/AudioGain.h>
#include <utils/Log.h>
#include <utils/String8.h>

#include <math.h>

@@ -98,17 +98,17 @@ status_t AudioGain::checkConfig(const struct audio_gain_config *config)
    return NO_ERROR;
}

void AudioGain::dump(String8 *dst, int spaces, int index) const
void AudioGain::dump(std::string *dst, int spaces, int index) const
{
    dst->appendFormat("%*sGain %d:\n", spaces, "", index+1);
    dst->appendFormat("%*s- mode: %08x\n", spaces, "", mGain.mode);
    dst->appendFormat("%*s- channel_mask: %08x\n", spaces, "", mGain.channel_mask);
    dst->appendFormat("%*s- min_value: %d mB\n", spaces, "", mGain.min_value);
    dst->appendFormat("%*s- max_value: %d mB\n", spaces, "", mGain.max_value);
    dst->appendFormat("%*s- default_value: %d mB\n", spaces, "", mGain.default_value);
    dst->appendFormat("%*s- step_value: %d mB\n", spaces, "", mGain.step_value);
    dst->appendFormat("%*s- min_ramp_ms: %d ms\n", spaces, "", mGain.min_ramp_ms);
    dst->appendFormat("%*s- max_ramp_ms: %d ms\n", spaces, "", mGain.max_ramp_ms);
    dst->append(base::StringPrintf("%*sGain %d:\n", spaces, "", index+1));
    dst->append(base::StringPrintf("%*s- mode: %08x\n", spaces, "", mGain.mode));
    dst->append(base::StringPrintf("%*s- channel_mask: %08x\n", spaces, "", mGain.channel_mask));
    dst->append(base::StringPrintf("%*s- min_value: %d mB\n", spaces, "", mGain.min_value));
    dst->append(base::StringPrintf("%*s- max_value: %d mB\n", spaces, "", mGain.max_value));
    dst->append(base::StringPrintf("%*s- default_value: %d mB\n", spaces, "", mGain.default_value));
    dst->append(base::StringPrintf("%*s- step_value: %d mB\n", spaces, "", mGain.step_value));
    dst->append(base::StringPrintf("%*s- min_ramp_ms: %d ms\n", spaces, "", mGain.min_ramp_ms));
    dst->append(base::StringPrintf("%*s- max_ramp_ms: %d ms\n", spaces, "", mGain.max_ramp_ms));
}

} // namespace android
+2 −2
Original line number Diff line number Diff line
@@ -18,8 +18,8 @@

#include <utils/Errors.h>
#include <utils/RefBase.h>
#include <utils/String8.h>
#include <system/audio.h>
#include <string>
#include <vector>

namespace android {
@@ -55,7 +55,7 @@ public:
    int getMaxRampInMs() const { return mGain.max_ramp_ms; }

    // TODO: remove dump from here (split serialization)
    void dump(String8 *dst, int spaces, int index) const;
    void dump(std::string *dst, int spaces, int index) const;

    void getDefaultConfig(struct audio_gain_config *config);
    status_t checkConfig(const struct audio_gain_config *config);
+5 −2
Original line number Diff line number Diff line
@@ -3,7 +3,6 @@ cc_library_static {

    srcs: [
        "src/AudioCollections.cpp",
        "src/AudioGain.cpp",
        "src/AudioInputDescriptor.cpp",
        "src/AudioOutputDescriptor.cpp",
        "src/AudioPatch.cpp",
@@ -21,6 +20,7 @@ cc_library_static {
        "src/TypeConverter.cpp",
    ],
    shared_libs: [
        "libaudiofoundation",
        "libcutils",
        "libhidlbase",
        "liblog",
@@ -28,7 +28,10 @@ cc_library_static {
        "libutils",
        "libxml2",
    ],
    export_shared_lib_headers: ["libmedia"],
    export_shared_lib_headers: [
        "libaudiofoundation",
        "libmedia",
    ],
    static_libs: [
        "libaudioutils",
    ],
+0 −1
Original line number Diff line number Diff line
@@ -19,7 +19,6 @@
#include <unordered_map>
#include <unordered_set>

#include <AudioGain.h>
#include <AudioPort.h>
#include <AudioPatch.h>
#include <DeviceDescriptor.h>
Loading