Loading audio/6.0/IDevice.hal +24 −0 Original line number Diff line number Diff line Loading @@ -295,4 +295,28 @@ interface IDevice { */ @exit close() generates (Result retval); /** * Applies an audio effect to an audio device. * * @param device identifies the sink or source device this effect must be applied to. * "device" is the AudioPortHandle indicated for the device when the audio * patch connecting that device was created. * @param effectId effect ID (obtained from IEffectsFactory.createEffect) of * the effect to add. * @return retval operation completion status. */ addDeviceEffect(AudioPortHandle device, uint64_t effectId) generates (Result retval); /** * Stops applying an audio effect to an audio device. * * @param device identifies the sink or source device this effect was applied to. * "device" is the AudioPortHandle indicated for the device when the audio * patch is created at the audio HAL. * @param effectId effect ID (obtained from IEffectsFactory.createEffect) of * the effect. * @return retval operation completion status. */ removeDeviceEffect(AudioPortHandle device, uint64_t effectId) generates (Result retval); }; audio/core/all-versions/default/Device.cpp +35 −0 Original line number Diff line number Diff line Loading @@ -18,6 +18,7 @@ #include "core/default/Device.h" #include <HidlUtils.h> #include "common/all-versions/default/EffectMap.h" #include "core/default/Conversions.h" #include "core/default/StreamIn.h" #include "core/default/StreamOut.h" Loading @@ -25,6 +26,7 @@ //#define LOG_NDEBUG 0 #include <inttypes.h> #include <memory.h> #include <string.h> #include <algorithm> Loading Loading @@ -403,6 +405,39 @@ Result Device::doClose() { Return<Result> Device::close() { return doClose(); } Return<Result> Device::addDeviceEffect(AudioPortHandle device, uint64_t effectId) { if (version() < AUDIO_DEVICE_API_VERSION_3_1 || mDevice->add_device_effect == nullptr) { return Result::NOT_SUPPORTED; } effect_handle_t halEffect = EffectMap::getInstance().get(effectId); if (halEffect != NULL) { return analyzeStatus("add_device_effect", mDevice->add_device_effect( mDevice, static_cast<audio_port_handle_t>(device), halEffect)); } else { ALOGW("%s Invalid effect ID passed from client: %" PRIu64 "", __func__, effectId); return Result::INVALID_ARGUMENTS; } } Return<Result> Device::removeDeviceEffect(AudioPortHandle device, uint64_t effectId) { if (version() < AUDIO_DEVICE_API_VERSION_3_1 || mDevice->remove_device_effect == nullptr) { return Result::NOT_SUPPORTED; } effect_handle_t halEffect = EffectMap::getInstance().get(effectId); if (halEffect != NULL) { return analyzeStatus("remove_device_effect", mDevice->remove_device_effect( mDevice, static_cast<audio_port_handle_t>(device), halEffect)); } else { ALOGW("%s Invalid effect ID passed from client: %" PRIu64 "", __func__, effectId); return Result::INVALID_ARGUMENTS; } } #endif } // namespace implementation Loading audio/core/all-versions/default/PrimaryDevice.cpp +8 −0 Original line number Diff line number Diff line Loading @@ -168,6 +168,14 @@ Return<Result> PrimaryDevice::setConnectedState(const DeviceAddress& address, bo Return<Result> PrimaryDevice::close() { return mDevice->close(); } Return<Result> PrimaryDevice::addDeviceEffect(AudioPortHandle device, uint64_t effectId) { return mDevice->addDeviceEffect(device, effectId); } Return<Result> PrimaryDevice::removeDeviceEffect(AudioPortHandle device, uint64_t effectId) { return mDevice->removeDeviceEffect(device, effectId); } #endif // Methods from ::android::hardware::audio::CPP_VERSION::IPrimaryDevice follow. Loading audio/core/all-versions/default/include/core/default/Device.h +2 −1 Original line number Diff line number Diff line Loading @@ -116,8 +116,9 @@ struct Device : public IDevice, public ParametersUtil { #endif #if MAJOR_VERSION >= 6 Return<Result> close() override; Return<Result> addDeviceEffect(AudioPortHandle device, uint64_t effectId) override; Return<Result> removeDeviceEffect(AudioPortHandle device, uint64_t effectId) override; #endif Return<void> debug(const hidl_handle& fd, const hidl_vec<hidl_string>& options) override; // Utility methods for extending interfaces. Loading audio/core/all-versions/default/include/core/default/PrimaryDevice.h +2 −0 Original line number Diff line number Diff line Loading @@ -98,6 +98,8 @@ struct PrimaryDevice : public IPrimaryDevice { #endif #if MAJOR_VERSION >= 6 Return<Result> close() override; Return<Result> addDeviceEffect(AudioPortHandle device, uint64_t effectId) override; Return<Result> removeDeviceEffect(AudioPortHandle device, uint64_t effectId) override; #endif Return<void> debug(const hidl_handle& fd, const hidl_vec<hidl_string>& options) override; Loading Loading
audio/6.0/IDevice.hal +24 −0 Original line number Diff line number Diff line Loading @@ -295,4 +295,28 @@ interface IDevice { */ @exit close() generates (Result retval); /** * Applies an audio effect to an audio device. * * @param device identifies the sink or source device this effect must be applied to. * "device" is the AudioPortHandle indicated for the device when the audio * patch connecting that device was created. * @param effectId effect ID (obtained from IEffectsFactory.createEffect) of * the effect to add. * @return retval operation completion status. */ addDeviceEffect(AudioPortHandle device, uint64_t effectId) generates (Result retval); /** * Stops applying an audio effect to an audio device. * * @param device identifies the sink or source device this effect was applied to. * "device" is the AudioPortHandle indicated for the device when the audio * patch is created at the audio HAL. * @param effectId effect ID (obtained from IEffectsFactory.createEffect) of * the effect. * @return retval operation completion status. */ removeDeviceEffect(AudioPortHandle device, uint64_t effectId) generates (Result retval); };
audio/core/all-versions/default/Device.cpp +35 −0 Original line number Diff line number Diff line Loading @@ -18,6 +18,7 @@ #include "core/default/Device.h" #include <HidlUtils.h> #include "common/all-versions/default/EffectMap.h" #include "core/default/Conversions.h" #include "core/default/StreamIn.h" #include "core/default/StreamOut.h" Loading @@ -25,6 +26,7 @@ //#define LOG_NDEBUG 0 #include <inttypes.h> #include <memory.h> #include <string.h> #include <algorithm> Loading Loading @@ -403,6 +405,39 @@ Result Device::doClose() { Return<Result> Device::close() { return doClose(); } Return<Result> Device::addDeviceEffect(AudioPortHandle device, uint64_t effectId) { if (version() < AUDIO_DEVICE_API_VERSION_3_1 || mDevice->add_device_effect == nullptr) { return Result::NOT_SUPPORTED; } effect_handle_t halEffect = EffectMap::getInstance().get(effectId); if (halEffect != NULL) { return analyzeStatus("add_device_effect", mDevice->add_device_effect( mDevice, static_cast<audio_port_handle_t>(device), halEffect)); } else { ALOGW("%s Invalid effect ID passed from client: %" PRIu64 "", __func__, effectId); return Result::INVALID_ARGUMENTS; } } Return<Result> Device::removeDeviceEffect(AudioPortHandle device, uint64_t effectId) { if (version() < AUDIO_DEVICE_API_VERSION_3_1 || mDevice->remove_device_effect == nullptr) { return Result::NOT_SUPPORTED; } effect_handle_t halEffect = EffectMap::getInstance().get(effectId); if (halEffect != NULL) { return analyzeStatus("remove_device_effect", mDevice->remove_device_effect( mDevice, static_cast<audio_port_handle_t>(device), halEffect)); } else { ALOGW("%s Invalid effect ID passed from client: %" PRIu64 "", __func__, effectId); return Result::INVALID_ARGUMENTS; } } #endif } // namespace implementation Loading
audio/core/all-versions/default/PrimaryDevice.cpp +8 −0 Original line number Diff line number Diff line Loading @@ -168,6 +168,14 @@ Return<Result> PrimaryDevice::setConnectedState(const DeviceAddress& address, bo Return<Result> PrimaryDevice::close() { return mDevice->close(); } Return<Result> PrimaryDevice::addDeviceEffect(AudioPortHandle device, uint64_t effectId) { return mDevice->addDeviceEffect(device, effectId); } Return<Result> PrimaryDevice::removeDeviceEffect(AudioPortHandle device, uint64_t effectId) { return mDevice->removeDeviceEffect(device, effectId); } #endif // Methods from ::android::hardware::audio::CPP_VERSION::IPrimaryDevice follow. Loading
audio/core/all-versions/default/include/core/default/Device.h +2 −1 Original line number Diff line number Diff line Loading @@ -116,8 +116,9 @@ struct Device : public IDevice, public ParametersUtil { #endif #if MAJOR_VERSION >= 6 Return<Result> close() override; Return<Result> addDeviceEffect(AudioPortHandle device, uint64_t effectId) override; Return<Result> removeDeviceEffect(AudioPortHandle device, uint64_t effectId) override; #endif Return<void> debug(const hidl_handle& fd, const hidl_vec<hidl_string>& options) override; // Utility methods for extending interfaces. Loading
audio/core/all-versions/default/include/core/default/PrimaryDevice.h +2 −0 Original line number Diff line number Diff line Loading @@ -98,6 +98,8 @@ struct PrimaryDevice : public IPrimaryDevice { #endif #if MAJOR_VERSION >= 6 Return<Result> close() override; Return<Result> addDeviceEffect(AudioPortHandle device, uint64_t effectId) override; Return<Result> removeDeviceEffect(AudioPortHandle device, uint64_t effectId) override; #endif Return<void> debug(const hidl_handle& fd, const hidl_vec<hidl_string>& options) override; Loading