mirror of
https://github.com/AndroidAudioMods/ViPERFX_RE.git
synced 2025-06-08 02:29:40 +08:00
Clean up AIDL code
This commit is contained in:
parent
ff8f29489c
commit
9e9008d76a
@ -4,7 +4,7 @@ cc_defaults {
|
|||||||
srcs: [
|
srcs: [
|
||||||
// Main
|
// Main
|
||||||
"src/viper/ViPER.cpp",
|
"src/viper/ViPER.cpp",
|
||||||
"src/ViperContext.cpp",
|
"src/ViPERContext.cpp",
|
||||||
"src/ViPER4Aidl.cpp",
|
"src/ViPER4Aidl.cpp",
|
||||||
"src/ViPER4Android.cpp",
|
"src/ViPER4Android.cpp",
|
||||||
"src/EffectThread.cpp",
|
"src/EffectThread.cpp",
|
||||||
|
@ -1,70 +0,0 @@
|
|||||||
cmake_minimum_required(VERSION 3.16.3)
|
|
||||||
|
|
||||||
set(CMAKE_CXX_STANDARD 20)
|
|
||||||
|
|
||||||
project("ViPER4Android")
|
|
||||||
add_compile_definitions(VIPER_VERSION=20240314)
|
|
||||||
|
|
||||||
# ViPERFX
|
|
||||||
include_directories(src/include)
|
|
||||||
|
|
||||||
set(FILES
|
|
||||||
# Main
|
|
||||||
src/viper/ViPER.cpp
|
|
||||||
src/ViPER4Android.cpp
|
|
||||||
src/ViperContext.cpp
|
|
||||||
|
|
||||||
# Effects
|
|
||||||
src/viper/effects/AnalogX.cpp
|
|
||||||
src/viper/effects/ColorfulMusic.cpp
|
|
||||||
src/viper/effects/Convolver.cpp
|
|
||||||
src/viper/effects/Cure.cpp
|
|
||||||
src/viper/effects/DiffSurround.cpp
|
|
||||||
src/viper/effects/DynamicSystem.cpp
|
|
||||||
src/viper/effects/FETCompressor.cpp
|
|
||||||
src/viper/effects/IIRFilter.cpp
|
|
||||||
src/viper/effects/PlaybackGain.cpp
|
|
||||||
src/viper/effects/Reverberation.cpp
|
|
||||||
src/viper/effects/SoftwareLimiter.cpp
|
|
||||||
src/viper/effects/SpeakerCorrection.cpp
|
|
||||||
src/viper/effects/SpectrumExtend.cpp
|
|
||||||
src/viper/effects/TubeSimulator.cpp
|
|
||||||
src/viper/effects/VHE.cpp
|
|
||||||
src/viper/effects/ViPERBass.cpp
|
|
||||||
src/viper/effects/ViPERClarity.cpp
|
|
||||||
src/viper/effects/ViPERDDC.cpp
|
|
||||||
|
|
||||||
# Utils
|
|
||||||
src/viper/utils/AdaptiveBuffer.cpp
|
|
||||||
src/viper/utils/Biquad.cpp
|
|
||||||
src/viper/utils/CAllpassFilter.cpp
|
|
||||||
src/viper/utils/CCombFilter.cpp
|
|
||||||
src/viper/utils/CRevModel.cpp
|
|
||||||
src/viper/utils/Crossfeed.cpp
|
|
||||||
src/viper/utils/DepthSurround.cpp
|
|
||||||
src/viper/utils/DynamicBass.cpp
|
|
||||||
src/viper/utils/FIR.cpp
|
|
||||||
src/viper/utils/Harmonic.cpp
|
|
||||||
src/viper/utils/HiFi.cpp
|
|
||||||
src/viper/utils/HighShelf.cpp
|
|
||||||
src/viper/utils/IIR_1st.cpp
|
|
||||||
src/viper/utils/IIR_NOrder_BW_BP.cpp
|
|
||||||
src/viper/utils/IIR_NOrder_BW_LH.cpp
|
|
||||||
src/viper/utils/MinPhaseIIRCoeffs.cpp
|
|
||||||
src/viper/utils/MultiBiquad.cpp
|
|
||||||
src/viper/utils/NoiseSharpening.cpp
|
|
||||||
src/viper/utils/PassFilter.cpp
|
|
||||||
src/viper/utils/PConvSingle.cpp
|
|
||||||
src/viper/utils/PolesFilter.cpp
|
|
||||||
src/viper/utils/Polyphase.cpp
|
|
||||||
src/viper/utils/Stereo3DSurround.cpp
|
|
||||||
src/viper/utils/Subwoofer.cpp
|
|
||||||
src/viper/utils/TimeConstDelay.cpp
|
|
||||||
src/viper/utils/WaveBuffer.cpp)
|
|
||||||
|
|
||||||
add_library(v4a_re SHARED
|
|
||||||
${FILES})
|
|
||||||
|
|
||||||
target_link_libraries(v4a_re log)
|
|
||||||
target_compile_options(v4a_re PRIVATE -flto -O3 -DNDEBUG)
|
|
||||||
#target_compile_options(v4afx_r PRIVATE -O2 -DNDEBUG -Wall -Wsign-conversion -Wno-unused-result -Wno-unneeded-internal-declaration -fstrict-aliasing -fvisibility=hidden -Wextra -Wno-unused-parameter)
|
|
135
src/AidlUtils.h
135
src/AidlUtils.h
@ -3,80 +3,79 @@
|
|||||||
#include <aidl/android/media/audio/common/AudioUuid.h>
|
#include <aidl/android/media/audio/common/AudioUuid.h>
|
||||||
#include <aidl/android/media/audio/common/PcmType.h>
|
#include <aidl/android/media/audio/common/PcmType.h>
|
||||||
|
|
||||||
|
using aidl::android::media::audio::common::AudioChannelLayout;
|
||||||
|
using aidl::android::media::audio::common::AudioFormatDescription;
|
||||||
|
using aidl::android::media::audio::common::AudioFormatType;
|
||||||
using aidl::android::media::audio::common::AudioUuid;
|
using aidl::android::media::audio::common::AudioUuid;
|
||||||
using aidl::android::media::audio::common::PcmType;
|
using aidl::android::media::audio::common::PcmType;
|
||||||
|
|
||||||
inline AudioUuid stringToUuid(const char* str) {
|
namespace ViPER4Android {
|
||||||
AudioUuid uuid{};
|
inline AudioUuid stringToUuid(const char *str) {
|
||||||
uint32_t tmp[10];
|
AudioUuid uuid{};
|
||||||
if (!str || sscanf(str, "%08x-%04x-%04x-%04x-%02x%02x%02x%02x%02x%02x", tmp,
|
uint32_t tmp[10];
|
||||||
tmp + 1, tmp + 2, tmp + 3, tmp + 4, tmp + 5, tmp + 6,
|
if (!str || sscanf(str, "%08x-%04x-%04x-%04x-%02x%02x%02x%02x%02x%02x", tmp,
|
||||||
tmp + 7, tmp + 8, tmp + 9) < 10) {
|
tmp + 1, tmp + 2, tmp + 3, tmp + 4, tmp + 5, tmp + 6,
|
||||||
|
tmp + 7, tmp + 8, tmp + 9) < 10) {
|
||||||
|
return uuid;
|
||||||
|
}
|
||||||
|
|
||||||
|
uuid.timeLow = (uint32_t) tmp[0];
|
||||||
|
uuid.timeMid = (uint16_t) tmp[1];
|
||||||
|
uuid.timeHiAndVersion = (uint16_t) tmp[2];
|
||||||
|
uuid.clockSeq = (uint16_t) tmp[3];
|
||||||
|
uuid.node.insert(uuid.node.end(), {(uint8_t) tmp[4], (uint8_t) tmp[5], (uint8_t) tmp[6],
|
||||||
|
(uint8_t) tmp[7], (uint8_t) tmp[8], (uint8_t) tmp[9]});
|
||||||
return uuid;
|
return uuid;
|
||||||
}
|
}
|
||||||
|
|
||||||
uuid.timeLow = (uint32_t)tmp[0];
|
constexpr size_t getPcmSampleSizeInBytes(PcmType pcm) {
|
||||||
uuid.timeMid = (uint16_t)tmp[1];
|
switch (pcm) {
|
||||||
uuid.timeHiAndVersion = (uint16_t)tmp[2];
|
case PcmType::UINT_8_BIT:
|
||||||
uuid.clockSeq = (uint16_t)tmp[3];
|
return 1;
|
||||||
uuid.node.insert(uuid.node.end(), {(uint8_t)tmp[4], (uint8_t)tmp[5], (uint8_t)tmp[6],
|
case PcmType::INT_16_BIT:
|
||||||
(uint8_t)tmp[7], (uint8_t)tmp[8], (uint8_t)tmp[9]});
|
return 2;
|
||||||
return uuid;
|
case PcmType::INT_32_BIT:
|
||||||
}
|
return 4;
|
||||||
|
case PcmType::FIXED_Q_8_24:
|
||||||
constexpr size_t getPcmSampleSizeInBytes(::aidl::android::media::audio::common::PcmType pcm) {
|
return 4;
|
||||||
using ::aidl::android::media::audio::common::PcmType;
|
case PcmType::FLOAT_32_BIT:
|
||||||
switch (pcm) {
|
return 4;
|
||||||
case PcmType::UINT_8_BIT:
|
case PcmType::INT_24_BIT:
|
||||||
return 1;
|
return 3;
|
||||||
case PcmType::INT_16_BIT:
|
}
|
||||||
return 2;
|
|
||||||
case PcmType::INT_32_BIT:
|
|
||||||
return 4;
|
|
||||||
case PcmType::FIXED_Q_8_24:
|
|
||||||
return 4;
|
|
||||||
case PcmType::FLOAT_32_BIT:
|
|
||||||
return 4;
|
|
||||||
case PcmType::INT_24_BIT:
|
|
||||||
return 3;
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
constexpr size_t getChannelCount(
|
|
||||||
const ::aidl::android::media::audio::common::AudioChannelLayout& layout,
|
|
||||||
int32_t mask = std::numeric_limits<int32_t>::max()) {
|
|
||||||
using Tag = ::aidl::android::media::audio::common::AudioChannelLayout::Tag;
|
|
||||||
switch (layout.getTag()) {
|
|
||||||
case Tag::none:
|
|
||||||
return 0;
|
|
||||||
case Tag::invalid:
|
|
||||||
return 0;
|
|
||||||
case Tag::indexMask:
|
|
||||||
return __builtin_popcount(layout.get<Tag::indexMask>() & mask);
|
|
||||||
case Tag::layoutMask:
|
|
||||||
return __builtin_popcount(layout.get<Tag::layoutMask>() & mask);
|
|
||||||
case Tag::voiceMask:
|
|
||||||
return __builtin_popcount(layout.get<Tag::voiceMask>() & mask);
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
constexpr size_t getFrameSizeInBytes(
|
|
||||||
const ::aidl::android::media::audio::common::AudioFormatDescription& format,
|
|
||||||
const ::aidl::android::media::audio::common::AudioChannelLayout& layout) {
|
|
||||||
if (format == ::aidl::android::media::audio::common::AudioFormatDescription{}) {
|
|
||||||
// Unspecified format.
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
using ::aidl::android::media::audio::common::AudioFormatType;
|
|
||||||
if (format.type == AudioFormatType::PCM) {
|
constexpr size_t getChannelCount(const AudioChannelLayout &layout,
|
||||||
return getPcmSampleSizeInBytes(format.pcm) * getChannelCount(layout);
|
int32_t mask = std::numeric_limits<int32_t>::max()) {
|
||||||
} else if (format.type == AudioFormatType::NON_PCM) {
|
switch (layout.getTag()) {
|
||||||
// For non-PCM formats always use the underlying PCM size. The default value for
|
case AudioChannelLayout::Tag::none:
|
||||||
// PCM is "UINT_8_BIT", thus non-encapsulated streams have the frame size of 1.
|
return 0;
|
||||||
return getPcmSampleSizeInBytes(format.pcm);
|
case AudioChannelLayout::Tag::invalid:
|
||||||
|
return 0;
|
||||||
|
case AudioChannelLayout::Tag::indexMask:
|
||||||
|
return __builtin_popcount(layout.get<AudioChannelLayout::Tag::indexMask>() & mask);
|
||||||
|
case AudioChannelLayout::Tag::layoutMask:
|
||||||
|
return __builtin_popcount(layout.get<AudioChannelLayout::Tag::layoutMask>() & mask);
|
||||||
|
case AudioChannelLayout::Tag::voiceMask:
|
||||||
|
return __builtin_popcount(layout.get<AudioChannelLayout::Tag::voiceMask>() & mask);
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
// Something unexpected.
|
|
||||||
return 0;
|
constexpr size_t getFrameSizeInBytes(const AudioFormatDescription &format, const AudioChannelLayout &layout) {
|
||||||
}
|
if (format == AudioFormatDescription{}) {
|
||||||
|
// Unspecified format.
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
if (format.type == AudioFormatType::PCM) {
|
||||||
|
return getPcmSampleSizeInBytes(format.pcm) * getChannelCount(layout);
|
||||||
|
} else if (format.type == AudioFormatType::NON_PCM) {
|
||||||
|
// For non-PCM formats always use the underlying PCM size. The default value for
|
||||||
|
// PCM is "UINT_8_BIT", thus non-encapsulated streams have the frame size of 1.
|
||||||
|
return getPcmSampleSizeInBytes(format.pcm);
|
||||||
|
}
|
||||||
|
// Something unexpected.
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
} // namespace ViPER4Android
|
@ -1,8 +1,8 @@
|
|||||||
#define LOG_TAG "ViPER4AIDL"
|
#define LOG_TAG "ViPER4AIDL"
|
||||||
|
|
||||||
#include "ViPER4Aidl.h"
|
#include "ViPER4Aidl.h"
|
||||||
|
#include "ViPER4Android.h"
|
||||||
#include "AidlUtils.h"
|
#include "AidlUtils.h"
|
||||||
#include <android-base/thread_annotations.h>
|
|
||||||
#include <aidl/android/hardware/audio/effect/DefaultExtension.h>
|
#include <aidl/android/hardware/audio/effect/DefaultExtension.h>
|
||||||
#include <system/audio_effect.h>
|
#include <system/audio_effect.h>
|
||||||
|
|
||||||
@ -20,8 +20,11 @@ using aidl::android::media::audio::common::AudioUuid;
|
|||||||
using aidl::android::media::audio::common::PcmType;
|
using aidl::android::media::audio::common::PcmType;
|
||||||
using android::hardware::EventFlag;
|
using android::hardware::EventFlag;
|
||||||
|
|
||||||
static const AudioUuid kType = stringToUuid("b9bc100c-26cd-42e6-acb6-cad8c3f778de");
|
using ViPER4Android::getFrameSizeInBytes;
|
||||||
static const AudioUuid kUuid = stringToUuid("90380da3-8536-4744-a6a3-5731970e640f");
|
using ViPER4Android::stringToUuid;
|
||||||
|
|
||||||
|
static const AudioUuid kType = stringToUuid(ViPER4Android::kTypeString);
|
||||||
|
static const AudioUuid kUuid = stringToUuid(ViPER4Android::kUuidString);
|
||||||
static const Descriptor kDescriptor = {
|
static const Descriptor kDescriptor = {
|
||||||
.common = {
|
.common = {
|
||||||
.id = {
|
.id = {
|
||||||
@ -33,19 +36,19 @@ static const Descriptor kDescriptor = {
|
|||||||
.type = Flags::Type::INSERT,
|
.type = Flags::Type::INSERT,
|
||||||
.insert = Flags::Insert::LAST,
|
.insert = Flags::Insert::LAST,
|
||||||
},
|
},
|
||||||
.name = "ViPER4Android",
|
.name = ViPER4Android::kName,
|
||||||
.implementor = "Iscle",
|
.implementor = ViPER4Android::kImplementor,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
ndk::ScopedAStatus ViPER4AIDL::open(const Parameter::Common &common,
|
ndk::ScopedAStatus ViPER4AIDL::open(const Parameter::Common &common,
|
||||||
const std::optional<Parameter::Specific> &specific,
|
const std::optional<Parameter::Specific> &specific,
|
||||||
IEffect::OpenEffectReturn *ret) {
|
IEffect::OpenEffectReturn *oer) {
|
||||||
if (common.input.base.format.pcm != PcmType::FLOAT_32_BIT ||
|
if (common.input.base.format.pcm != PcmType::FLOAT_32_BIT ||
|
||||||
common.output.base.format.pcm != PcmType::FLOAT_32_BIT) {
|
common.output.base.format.pcm != PcmType::FLOAT_32_BIT) {
|
||||||
ALOGE("open: unsupported PCM type (input: %d, output: %d)",
|
ALOGE("open: unsupported PCM type (input: %s, output: %s)",
|
||||||
static_cast<int>(common.input.base.format.pcm),
|
toString(common.input.base.format.pcm).c_str(),
|
||||||
static_cast<int>(common.output.base.format.pcm));
|
toString(common.output.base.format.pcm).c_str());
|
||||||
return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_ARGUMENT);
|
return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_ARGUMENT);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -56,32 +59,25 @@ ndk::ScopedAStatus ViPER4AIDL::open(const Parameter::Common &common,
|
|||||||
return ndk::ScopedAStatus::ok();
|
return ndk::ScopedAStatus::ok();
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t inputFrameSize = getFrameSizeInBytes(
|
size_t inputFrameSize = getFrameSizeInBytes(common.input.base.format, common.input.base.channelMask);
|
||||||
common.input.base.format, common.input.base.channelMask);
|
size_t outputFrameSize = getFrameSizeInBytes(common.output.base.format, common.output.base.channelMask);
|
||||||
size_t outputFrameSize = getFrameSizeInBytes(
|
|
||||||
common.output.base.format, common.output.base.channelMask);
|
|
||||||
|
|
||||||
/* EffectContext constructor start */
|
/* EffectContext constructor start */
|
||||||
mCommon = common;
|
mCommon = common;
|
||||||
size_t inBufferSizeInFloat = common.input.frameCount * inputFrameSize / sizeof(float);
|
size_t inBufferSizeInFloat = common.input.frameCount * inputFrameSize / sizeof(float);
|
||||||
size_t outBufferSizeInFloat = common.output.frameCount * outputFrameSize / sizeof(float);
|
size_t outBufferSizeInFloat = common.output.frameCount * outputFrameSize / sizeof(float);
|
||||||
|
|
||||||
ALOGD("open: inBufferSizeInFloat %zu, outBufferSizeInFloat %zu", inBufferSizeInFloat,
|
|
||||||
outBufferSizeInFloat);
|
|
||||||
|
|
||||||
// only status FMQ use the EventFlag
|
// only status FMQ use the EventFlag
|
||||||
mStatusMQ = std::make_shared<StatusMQ>(1, true /* configureEventFlagWord */);
|
mStatusMQ = std::make_shared<StatusMQ>(1, true /* configureEventFlagWord */);
|
||||||
mInputMQ = std::make_shared<DataMQ>(inBufferSizeInFloat);
|
mInputMQ = std::make_shared<DataMQ>(inBufferSizeInFloat);
|
||||||
mOutputMQ = std::make_shared<DataMQ>(outBufferSizeInFloat);
|
mOutputMQ = std::make_shared<DataMQ>(outBufferSizeInFloat);
|
||||||
|
|
||||||
if (!mStatusMQ->isValid() || !mInputMQ->isValid() || !mOutputMQ->isValid()) {
|
if (!mStatusMQ->isValid() || !mInputMQ->isValid() || !mOutputMQ->isValid()) {
|
||||||
ALOGE("open: invalid FMQ (status: %d, input: %d, output: %d)",
|
ALOGE("open: invalid FMQs (status: %d, input: %d, output: %d)",
|
||||||
mStatusMQ->isValid(), mInputMQ->isValid(), mOutputMQ->isValid());
|
mStatusMQ->isValid(), mInputMQ->isValid(), mOutputMQ->isValid());
|
||||||
return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_STATE);
|
return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_STATE);
|
||||||
}
|
}
|
||||||
|
|
||||||
android::status_t status = EventFlag::createEventFlag(
|
android::status_t status = EventFlag::createEventFlag(mStatusMQ->getEventFlagWord(), &mEventFlag);
|
||||||
mStatusMQ->getEventFlagWord(), &mEventFlag);
|
|
||||||
if (status != android::OK || mEventFlag == nullptr) {
|
if (status != android::OK || mEventFlag == nullptr) {
|
||||||
ALOGE("open: failed to create event flag");
|
ALOGE("open: failed to create event flag");
|
||||||
return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_STATE);
|
return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_STATE);
|
||||||
@ -90,17 +86,13 @@ ndk::ScopedAStatus ViPER4AIDL::open(const Parameter::Common &common,
|
|||||||
mWorkBuffer.resize(std::max(inBufferSizeInFloat, outBufferSizeInFloat));
|
mWorkBuffer.resize(std::max(inBufferSizeInFloat, outBufferSizeInFloat));
|
||||||
/* EffectContext constructor end */
|
/* EffectContext constructor end */
|
||||||
|
|
||||||
if (specific.has_value()) {
|
|
||||||
ALOGD("open: specific parameters provided, ignoring for now...");
|
|
||||||
}
|
|
||||||
|
|
||||||
mState = State::IDLE;
|
mState = State::IDLE;
|
||||||
|
|
||||||
dupeFmq(ret);
|
dupeFmq(oer);
|
||||||
|
|
||||||
if (createThread("ViPER4Android") != RetCode::SUCCESS) {
|
if (createThread(ViPER4Android::kName) != RetCode::SUCCESS) {
|
||||||
ALOGE("open: failed to create thread");
|
ALOGE("open: failed to create thread");
|
||||||
return ndk::ScopedAStatus::fromExceptionCode(EX_UNSUPPORTED_OPERATION);
|
return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_STATE);
|
||||||
}
|
}
|
||||||
|
|
||||||
return ndk::ScopedAStatus::ok();
|
return ndk::ScopedAStatus::ok();
|
||||||
@ -130,7 +122,7 @@ ndk::ScopedAStatus ViPER4AIDL::close() {
|
|||||||
|
|
||||||
if (destroyThread() != RetCode::SUCCESS) {
|
if (destroyThread() != RetCode::SUCCESS) {
|
||||||
ALOGE("close: failed to destroy thread");
|
ALOGE("close: failed to destroy thread");
|
||||||
return ndk::ScopedAStatus::fromExceptionCode(EX_UNSUPPORTED_OPERATION);
|
return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_STATE);
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
@ -150,7 +142,7 @@ ndk::ScopedAStatus ViPER4AIDL::getDescriptor(Descriptor *descriptor) {
|
|||||||
return ndk::ScopedAStatus::ok();
|
return ndk::ScopedAStatus::ok();
|
||||||
}
|
}
|
||||||
|
|
||||||
ndk::ScopedAStatus ViPER4AIDL::command(CommandId command) {
|
ndk::ScopedAStatus ViPER4AIDL::command(CommandId commandId) {
|
||||||
std::lock_guard lg(mImplMutex);
|
std::lock_guard lg(mImplMutex);
|
||||||
|
|
||||||
if (mState == State::INIT) {
|
if (mState == State::INIT) {
|
||||||
@ -158,15 +150,12 @@ ndk::ScopedAStatus ViPER4AIDL::command(CommandId command) {
|
|||||||
return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_STATE);
|
return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_STATE);
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (command) {
|
switch (commandId) {
|
||||||
case CommandId::START: {
|
case CommandId::START: {
|
||||||
if (mState == State::PROCESSING) {
|
if (mState == State::PROCESSING) {
|
||||||
ALOGD("command: already started");
|
ALOGD("command: already started");
|
||||||
return ndk::ScopedAStatus::ok();
|
return ndk::ScopedAStatus::ok();
|
||||||
}
|
}
|
||||||
|
|
||||||
//RETURN_IF_ASTATUS_NOT_OK(commandImpl(command), "commandImplFailed");
|
|
||||||
|
|
||||||
mState = State::PROCESSING;
|
mState = State::PROCESSING;
|
||||||
|
|
||||||
if (notifyEventFlag(mDataMqNotEmptyEf) != RetCode::SUCCESS) {
|
if (notifyEventFlag(mDataMqNotEmptyEf) != RetCode::SUCCESS) {
|
||||||
@ -183,7 +172,6 @@ ndk::ScopedAStatus ViPER4AIDL::command(CommandId command) {
|
|||||||
ALOGD("command: already stopped");
|
ALOGD("command: already stopped");
|
||||||
return ndk::ScopedAStatus::ok();
|
return ndk::ScopedAStatus::ok();
|
||||||
}
|
}
|
||||||
|
|
||||||
mState = State::IDLE;
|
mState = State::IDLE;
|
||||||
|
|
||||||
if (notifyEventFlag(mDataMqNotEmptyEf) != RetCode::SUCCESS) {
|
if (notifyEventFlag(mDataMqNotEmptyEf) != RetCode::SUCCESS) {
|
||||||
@ -192,8 +180,6 @@ ndk::ScopedAStatus ViPER4AIDL::command(CommandId command) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
stopThread();
|
stopThread();
|
||||||
|
|
||||||
//RETURN_IF_ASTATUS_NOT_OK(commandImpl(command), "commandImplFailed");
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -206,14 +192,12 @@ ndk::ScopedAStatus ViPER4AIDL::command(CommandId command) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
stopThread();
|
stopThread();
|
||||||
|
|
||||||
resetBuffer();
|
resetBuffer();
|
||||||
//RETURN_IF_ASTATUS_NOT_OK(commandImpl(command), "commandImplFailed");
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
ALOGE("command: unknown command %d", static_cast<uint32_t>(command));
|
ALOGE("command: unknown commandId (%s)", toString(commandId).c_str());
|
||||||
return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_ARGUMENT);
|
return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_ARGUMENT);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -229,8 +213,7 @@ ndk::ScopedAStatus ViPER4AIDL::getState(State *state) {
|
|||||||
return ndk::ScopedAStatus::ok();
|
return ndk::ScopedAStatus::ok();
|
||||||
}
|
}
|
||||||
|
|
||||||
ndk::ScopedAStatus
|
ndk::ScopedAStatus ViPER4AIDL::setParameter(const Parameter ¶meter) {
|
||||||
ViPER4AIDL::setParameter(const Parameter ¶meter) {
|
|
||||||
std::lock_guard lg(mImplMutex);
|
std::lock_guard lg(mImplMutex);
|
||||||
|
|
||||||
const auto &tag = parameter.getTag();
|
const auto &tag = parameter.getTag();
|
||||||
@ -239,14 +222,14 @@ ViPER4AIDL::setParameter(const Parameter ¶meter) {
|
|||||||
auto common = parameter.get<Parameter::Tag::common>();
|
auto common = parameter.get<Parameter::Tag::common>();
|
||||||
if (common.input.base.format.pcm != PcmType::FLOAT_32_BIT ||
|
if (common.input.base.format.pcm != PcmType::FLOAT_32_BIT ||
|
||||||
common.output.base.format.pcm != PcmType::FLOAT_32_BIT) {
|
common.output.base.format.pcm != PcmType::FLOAT_32_BIT) {
|
||||||
ALOGE("setParameter: common: unsupported PCM type (input: %d, output: %d)",
|
ALOGE("setParameter: common: unsupported PCM type (input: %s, output: %s)",
|
||||||
static_cast<int>(common.input.base.format.pcm),
|
toString(common.input.base.format.pcm).c_str(),
|
||||||
static_cast<int>(common.output.base.format.pcm));
|
toString(common.output.base.format.pcm).c_str());
|
||||||
return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_ARGUMENT);
|
return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_ARGUMENT);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if VIPER_AIDL_VERSION >= 2
|
#if VIPER_AIDL_VERSION >= 2
|
||||||
if (mWorkBuffer.size() != 0 && mInputMQ != nullptr && mOutputMQ != nullptr) {
|
if (!mWorkBuffer.empty() && mInputMQ != nullptr && mOutputMQ != nullptr) {
|
||||||
size_t prevInputFrameSize = getFrameSizeInBytes(
|
size_t prevInputFrameSize = getFrameSizeInBytes(
|
||||||
mCommon.input.base.format, mCommon.input.base.channelMask);
|
mCommon.input.base.format, mCommon.input.base.channelMask);
|
||||||
size_t prevOutputFrameSize = getFrameSizeInBytes(
|
size_t prevOutputFrameSize = getFrameSizeInBytes(
|
||||||
@ -258,24 +241,16 @@ ViPER4AIDL::setParameter(const Parameter ¶meter) {
|
|||||||
common.output.base.format, common.output.base.channelMask);
|
common.output.base.format, common.output.base.channelMask);
|
||||||
|
|
||||||
bool needUpdateMq = false;
|
bool needUpdateMq = false;
|
||||||
if (inputFrameSize != prevInputFrameSize ||
|
if (inputFrameSize != prevInputFrameSize || mCommon.input.frameCount != common.input.frameCount) {
|
||||||
mCommon.input.frameCount != common.input.frameCount) {
|
|
||||||
ALOGD("setParameter: common: reset input MQ");
|
|
||||||
mInputMQ.reset();
|
mInputMQ.reset();
|
||||||
needUpdateMq = true;
|
needUpdateMq = true;
|
||||||
}
|
}
|
||||||
if (outputFrameSize != prevOutputFrameSize ||
|
if (outputFrameSize != prevOutputFrameSize ||
|
||||||
mCommon.output.frameCount != common.output.frameCount) {
|
mCommon.output.frameCount != common.output.frameCount) {
|
||||||
ALOGD("setParameter: common: reset output MQ");
|
|
||||||
mOutputMQ.reset();
|
mOutputMQ.reset();
|
||||||
needUpdateMq = true;
|
needUpdateMq = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
ALOGD("setParameter: common: inBufferSizeInFloat %zu, outBufferSizeInFloat %zu, needUpdateMq %d",
|
|
||||||
(size_t) (common.input.frameCount * inputFrameSize / sizeof(float)),
|
|
||||||
(size_t) (common.output.frameCount * outputFrameSize / sizeof(float)),
|
|
||||||
needUpdateMq);
|
|
||||||
|
|
||||||
if (needUpdateMq && mEventFlag->wake(kEventFlagDataMqUpdate) != ::android::OK) {
|
if (needUpdateMq && mEventFlag->wake(kEventFlagDataMqUpdate) != ::android::OK) {
|
||||||
ALOGE("setParameter: common: failed to wake event flag");
|
ALOGE("setParameter: common: failed to wake event flag");
|
||||||
return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_STATE);
|
return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_STATE);
|
||||||
@ -288,8 +263,7 @@ ViPER4AIDL::setParameter(const Parameter ¶meter) {
|
|||||||
case Parameter::Tag::specific: {
|
case Parameter::Tag::specific: {
|
||||||
auto specific = parameter.get<Parameter::Tag::specific>();
|
auto specific = parameter.get<Parameter::Tag::specific>();
|
||||||
if (specific.getTag() != Parameter::Specific::Tag::vendorEffect) {
|
if (specific.getTag() != Parameter::Specific::Tag::vendorEffect) {
|
||||||
ALOGE("setParameter: specific: unsupported tag %d",
|
ALOGE("setParameter: specific: unsupported tag (%s)", toString(specific.getTag()).c_str());
|
||||||
static_cast<int32_t>(specific.getTag()));
|
|
||||||
return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_ARGUMENT);
|
return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_ARGUMENT);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -300,37 +274,25 @@ ViPER4AIDL::setParameter(const Parameter ¶meter) {
|
|||||||
return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_ARGUMENT);
|
return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_ARGUMENT);
|
||||||
}
|
}
|
||||||
|
|
||||||
auto data = defaultExtension->bytes;
|
auto cmd = defaultExtension->bytes;
|
||||||
|
|
||||||
ALOGD("setParameter: specific: vendorEffect data size %zu", data.size());
|
int32_t replyData = 0;
|
||||||
|
uint32_t replySize = sizeof(replyData);
|
||||||
int32_t ret = 0;
|
if (viperContext.handleCommand(EFFECT_CMD_SET_PARAM,
|
||||||
uint32_t retSize = sizeof(ret);
|
cmd.size(), cmd.data(), &replySize, &replyData) != 0 || replyData != 0) {
|
||||||
if (viperContext.handleCommand(
|
|
||||||
EFFECT_CMD_SET_PARAM,
|
|
||||||
data.size(),
|
|
||||||
data.data(),
|
|
||||||
&retSize,
|
|
||||||
&ret
|
|
||||||
) != 0) {
|
|
||||||
ALOGE("setParameter: specific: failed to handle command");
|
ALOGE("setParameter: specific: failed to handle command");
|
||||||
return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_ARGUMENT);
|
return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_ARGUMENT);
|
||||||
}
|
}
|
||||||
if (ret != 0) {
|
|
||||||
ALOGE("setParameter: specific: command failed with ret %d", ret);
|
|
||||||
return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_ARGUMENT);
|
|
||||||
}
|
|
||||||
|
|
||||||
return ndk::ScopedAStatus::ok();
|
return ndk::ScopedAStatus::ok();
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
ALOGE("setParameter: unsupported parameter tag %d", static_cast<int32_t>(tag));
|
ALOGE("setParameter: unsupported parameter tag (%s)", toString(tag).c_str());
|
||||||
return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_ARGUMENT);
|
return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_ARGUMENT);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ndk::ScopedAStatus
|
ndk::ScopedAStatus ViPER4AIDL::getParameter(const Parameter::Id ¶meterId, Parameter *param) {
|
||||||
ViPER4AIDL::getParameter(const Parameter::Id &id, Parameter *param) {
|
|
||||||
if (param == nullptr) {
|
if (param == nullptr) {
|
||||||
ALOGE("getParameter: param is null");
|
ALOGE("getParameter: param is null");
|
||||||
return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_ARGUMENT);
|
return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_ARGUMENT);
|
||||||
@ -338,66 +300,36 @@ ViPER4AIDL::getParameter(const Parameter::Id &id, Parameter *param) {
|
|||||||
|
|
||||||
std::lock_guard lg(mImplMutex);
|
std::lock_guard lg(mImplMutex);
|
||||||
|
|
||||||
const auto &tag = id.getTag();
|
const auto &tag = parameterId.getTag();
|
||||||
switch (tag) {
|
switch (tag) {
|
||||||
case Parameter::Id::commonTag: {
|
case Parameter::Id::commonTag: {
|
||||||
auto commonTag = id.get<Parameter::Id::Tag::commonTag>();
|
auto commonTag = parameterId.get<Parameter::Id::Tag::commonTag>();
|
||||||
if (commonTag != Parameter::Tag::common) {
|
if (commonTag != Parameter::Tag::common) {
|
||||||
ALOGE("getParameter: commonTag: unsupported tag %d",
|
ALOGE("getParameter: commonTag: unsupported tag (%s)", toString(commonTag).c_str());
|
||||||
static_cast<int32_t>(commonTag));
|
|
||||||
return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_ARGUMENT);
|
return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_ARGUMENT);
|
||||||
}
|
}
|
||||||
param->set<Parameter::Tag::common>(mCommon);
|
param->set<Parameter::Tag::common>(mCommon);
|
||||||
return ndk::ScopedAStatus::ok();
|
return ndk::ScopedAStatus::ok();
|
||||||
}
|
}
|
||||||
case Parameter::Id::vendorEffectTag: {
|
case Parameter::Id::vendorEffectTag: {
|
||||||
auto vendorEffectTag = id.get<Parameter::Id::Tag::vendorEffectTag>();
|
const auto &vendorEffectTag = parameterId.get<Parameter::Id::Tag::vendorEffectTag>();
|
||||||
std::optional<DefaultExtension> cmdDefaultExtension;
|
std::optional<DefaultExtension> cmdDefaultExtension;
|
||||||
if (vendorEffectTag.extension.getParcelable(&cmdDefaultExtension) != STATUS_OK || !cmdDefaultExtension.has_value()) {
|
if (vendorEffectTag.extension.getParcelable(&cmdDefaultExtension) != STATUS_OK || !cmdDefaultExtension.has_value()) {
|
||||||
ALOGE("getParameter: vendorEffectTag: failed to get default extension");
|
ALOGE("getParameter: vendorEffectTag: failed to get default extension");
|
||||||
return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_ARGUMENT);
|
return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_ARGUMENT);
|
||||||
}
|
}
|
||||||
|
|
||||||
VendorExtension replyVendorExtension;
|
ALOGW("getParameter: vendorEffectTag: getParameter not implemented");
|
||||||
DefaultExtension replyDefaultExtension;
|
return ndk::ScopedAStatus::fromExceptionCode(EX_UNSUPPORTED_OPERATION);
|
||||||
replyDefaultExtension.bytes.resize(sizeof(effect_param_t) + 2 * sizeof(int32_t));
|
|
||||||
|
|
||||||
auto cmdData = cmdDefaultExtension->bytes;
|
|
||||||
auto replyData = replyDefaultExtension.bytes;
|
|
||||||
uint32_t replySize = replyData.size();
|
|
||||||
|
|
||||||
if (viperContext.handleCommand(
|
|
||||||
EFFECT_CMD_GET_PARAM,
|
|
||||||
cmdData.size(),
|
|
||||||
cmdData.data(),
|
|
||||||
&replySize,
|
|
||||||
replyData.data()
|
|
||||||
) != 0) {
|
|
||||||
ALOGE("getParameter: vendorEffectTag: failed to handle command");
|
|
||||||
return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_ARGUMENT);
|
|
||||||
}
|
|
||||||
|
|
||||||
replyData.resize(replySize);
|
|
||||||
|
|
||||||
if (replyVendorExtension.extension.setParcelable(replyDefaultExtension) != STATUS_OK) {
|
|
||||||
ALOGE("getParameter: vendorEffectTag: failed to set default extension");
|
|
||||||
return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_ARGUMENT);
|
|
||||||
}
|
|
||||||
|
|
||||||
Parameter::Specific specific;
|
|
||||||
specific.set<Parameter::Specific::Tag::vendorEffect>(replyVendorExtension);
|
|
||||||
param->set<Parameter::Tag::specific>(specific);
|
|
||||||
|
|
||||||
return ndk::ScopedAStatus::ok();
|
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
ALOGD("getParameter: unsupported parameter tag %d", static_cast<int32_t>(tag));
|
ALOGD("getParameter: unsupported parameter tag (%s)", toString(tag).c_str());
|
||||||
return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_ARGUMENT);
|
return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_ARGUMENT);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if VIPER_AIDL_VERSION >= 2
|
#if VIPER_AIDL_VERSION >= 2
|
||||||
ndk::ScopedAStatus ViPER4AIDL::reopen(IEffect::OpenEffectReturn *ret) {
|
ndk::ScopedAStatus ViPER4AIDL::reopen(IEffect::OpenEffectReturn *oer) {
|
||||||
std::lock_guard lg(mImplMutex);
|
std::lock_guard lg(mImplMutex);
|
||||||
|
|
||||||
if (mState == State::INIT) {
|
if (mState == State::INIT) {
|
||||||
@ -405,9 +337,7 @@ ndk::ScopedAStatus ViPER4AIDL::reopen(IEffect::OpenEffectReturn *ret) {
|
|||||||
return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_STATE);
|
return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_STATE);
|
||||||
}
|
}
|
||||||
|
|
||||||
ALOGD("reopen: reopening effect");
|
dupeFmqWithReopen(oer);
|
||||||
|
|
||||||
dupeFmqWithReopen(ret);
|
|
||||||
|
|
||||||
return ndk::ScopedAStatus::ok();
|
return ndk::ScopedAStatus::ok();
|
||||||
}
|
}
|
||||||
@ -419,8 +349,9 @@ void ViPER4AIDL::process() {
|
|||||||
* in the life cycle of workerThread (threadLoop).
|
* in the life cycle of workerThread (threadLoop).
|
||||||
*/
|
*/
|
||||||
uint32_t efState = 0;
|
uint32_t efState = 0;
|
||||||
if (!mEventFlag || mEventFlag->wait(mDataMqNotEmptyEf, &efState, 0 /* no timeout */, true /* retry */) != ::android::OK || !(efState & mDataMqNotEmptyEf)) {
|
if (!mEventFlag ||
|
||||||
ALOGE("process: mEventFlag - %p, efState - %x", mEventFlag, efState);
|
mEventFlag->wait(mDataMqNotEmptyEf, &efState, 0 /* no timeout */, true /* retry */) != ::android::OK ||
|
||||||
|
!(efState & mDataMqNotEmptyEf)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -431,45 +362,37 @@ void ViPER4AIDL::process() {
|
|||||||
#else
|
#else
|
||||||
if (mState != State::PROCESSING) {
|
if (mState != State::PROCESSING) {
|
||||||
#endif
|
#endif
|
||||||
ALOGD("process: skip process in state: %s", toString(mState).c_str());
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
ALOGD("process: processing in state: %s, mInputMQ - %p, mOutputMQ - %p",
|
|
||||||
toString(mState).c_str(), mInputMQ.get(), mOutputMQ.get());
|
|
||||||
|
|
||||||
if (!mInputMQ || !mOutputMQ) {
|
if (!mInputMQ || !mOutputMQ) {
|
||||||
ALOGE("process: mInputMQ or mOutputMQ is null");
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
assert(mWorkBuffer.size() >= std::max(mInputMQ->availableToRead(), mOutputMQ->availableToWrite()));
|
assert(mWorkBuffer.size() >= std::max(mInputMQ->availableToRead(), mOutputMQ->availableToWrite()));
|
||||||
|
|
||||||
auto processSamples = std::min(mInputMQ->availableToRead(), mOutputMQ->availableToWrite());
|
auto processSamples = std::min(mInputMQ->availableToRead(), mOutputMQ->availableToWrite());
|
||||||
if (processSamples) {
|
if (processSamples) {
|
||||||
auto buffer = static_cast<float*>(mWorkBuffer.data());
|
auto buffer = static_cast<float *>(mWorkBuffer.data());
|
||||||
mInputMQ->read(buffer, processSamples);
|
mInputMQ->read(buffer, processSamples);
|
||||||
IEffect::Status status = effectProcessImpl(buffer, buffer, processSamples);
|
IEffect::Status status = effectProcessImpl(buffer, buffer, static_cast<int32_t>(processSamples));
|
||||||
mOutputMQ->write(buffer, status.fmqProduced);
|
mOutputMQ->write(buffer, status.fmqProduced);
|
||||||
mStatusMQ->writeBlocking(&status, 1);
|
mStatusMQ->writeBlocking(&status, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ViPER4AIDL::dupeFmq(IEffect::OpenEffectReturn* ret) {
|
void ViPER4AIDL::dupeFmq(IEffect::OpenEffectReturn* oer) {
|
||||||
ALOGD("dupeFmq: mStatusMQ - %p, mInputMQ - %p, mOutputMQ - %p",
|
if (oer && mStatusMQ && mInputMQ && mOutputMQ) {
|
||||||
mStatusMQ.get(), mInputMQ.get(), mOutputMQ.get());
|
oer->statusMQ = mStatusMQ->dupeDesc();
|
||||||
if (ret && mStatusMQ && mInputMQ && mOutputMQ) {
|
oer->inputDataMQ = mInputMQ->dupeDesc();
|
||||||
ret->statusMQ = mStatusMQ->dupeDesc();
|
oer->outputDataMQ = mOutputMQ->dupeDesc();
|
||||||
ret->inputDataMQ = mInputMQ->dupeDesc();
|
|
||||||
ret->outputDataMQ = mOutputMQ->dupeDesc();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ViPER4AIDL::dupeFmqWithReopen(IEffect::OpenEffectReturn* ret) {
|
void ViPER4AIDL::dupeFmqWithReopen(IEffect::OpenEffectReturn* oer) {
|
||||||
size_t inputFrameSize = getFrameSizeInBytes(
|
size_t inputFrameSize = getFrameSizeInBytes(mCommon.input.base.format, mCommon.input.base.channelMask);
|
||||||
mCommon.input.base.format, mCommon.input.base.channelMask);
|
size_t outputFrameSize = getFrameSizeInBytes(mCommon.output.base.format, mCommon.output.base.channelMask);
|
||||||
size_t outputFrameSize = getFrameSizeInBytes(
|
|
||||||
mCommon.output.base.format, mCommon.output.base.channelMask);
|
|
||||||
const size_t inBufferSizeInFloat = mCommon.input.frameCount * inputFrameSize / sizeof(float);
|
const size_t inBufferSizeInFloat = mCommon.input.frameCount * inputFrameSize / sizeof(float);
|
||||||
const size_t outBufferSizeInFloat = mCommon.output.frameCount * outputFrameSize / sizeof(float);
|
const size_t outBufferSizeInFloat = mCommon.output.frameCount * outputFrameSize / sizeof(float);
|
||||||
const size_t bufferSize = std::max(inBufferSizeInFloat, outBufferSizeInFloat);
|
const size_t bufferSize = std::max(inBufferSizeInFloat, outBufferSizeInFloat);
|
||||||
@ -482,7 +405,7 @@ void ViPER4AIDL::dupeFmqWithReopen(IEffect::OpenEffectReturn* ret) {
|
|||||||
if (mWorkBuffer.size() != bufferSize) {
|
if (mWorkBuffer.size() != bufferSize) {
|
||||||
mWorkBuffer.resize(bufferSize);
|
mWorkBuffer.resize(bufferSize);
|
||||||
}
|
}
|
||||||
dupeFmq(ret);
|
dupeFmq(oer);
|
||||||
}
|
}
|
||||||
|
|
||||||
RetCode ViPER4AIDL::notifyEventFlag(uint32_t flag) {
|
RetCode ViPER4AIDL::notifyEventFlag(uint32_t flag) {
|
||||||
@ -490,17 +413,18 @@ RetCode ViPER4AIDL::notifyEventFlag(uint32_t flag) {
|
|||||||
ALOGE("notifyEventFlag: StatusEventFlag invalid");
|
ALOGE("notifyEventFlag: StatusEventFlag invalid");
|
||||||
return RetCode::ERROR_EVENT_FLAG_ERROR;
|
return RetCode::ERROR_EVENT_FLAG_ERROR;
|
||||||
}
|
}
|
||||||
if (const auto ret = mEventFlag->wake(flag); ret != ::android::OK) {
|
if (mEventFlag->wake(flag) != ::android::OK) {
|
||||||
ALOGE("notifyEventFlag: wake failure with ret %d", ret);
|
ALOGE("notifyEventFlag: failed to wake event flag");
|
||||||
return RetCode::ERROR_EVENT_FLAG_ERROR;
|
return RetCode::ERROR_EVENT_FLAG_ERROR;
|
||||||
}
|
}
|
||||||
return RetCode::SUCCESS;
|
return RetCode::SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
// reset buffer status by abandon input data in FMQ
|
|
||||||
void ViPER4AIDL::resetBuffer() {
|
void ViPER4AIDL::resetBuffer() {
|
||||||
|
// reset buffer status by abandon input data in FMQ
|
||||||
if (mStatusMQ) {
|
if (mStatusMQ) {
|
||||||
std::vector<IEffect::Status> status(mStatusMQ->availableToRead());
|
std::vector<IEffect::Status> status(mStatusMQ->availableToRead());
|
||||||
|
mStatusMQ->read(status.data(), status.size());
|
||||||
}
|
}
|
||||||
if (mInputMQ) {
|
if (mInputMQ) {
|
||||||
auto buffer = static_cast<float*>(mWorkBuffer.data());
|
auto buffer = static_cast<float*>(mWorkBuffer.data());
|
||||||
@ -508,18 +432,21 @@ void ViPER4AIDL::resetBuffer() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// A placeholder processing implementation to copy samples from input to output
|
IEffect::Status ViPER4AIDL::effectProcessImpl(float *in, float *out, int32_t samples) {
|
||||||
IEffect::Status ViPER4AIDL::effectProcessImpl(float* in, float* out, int samples) {
|
|
||||||
viperContext.process(in, out, samples);
|
viperContext.process(in, out, samples);
|
||||||
return {STATUS_OK, samples, samples};
|
return {
|
||||||
|
.status = STATUS_OK,
|
||||||
|
.fmqConsumed = samples,
|
||||||
|
.fmqProduced = samples
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" binder_exception_t queryEffect(const AudioUuid *audio_uuid, Descriptor *descriptor) {
|
extern "C" binder_exception_t queryEffect(const AudioUuid *audioUuid, Descriptor *descriptor) {
|
||||||
if (audio_uuid == nullptr || descriptor == nullptr) {
|
if (audioUuid == nullptr || descriptor == nullptr) {
|
||||||
ALOGE("queryEffect: audio_uuid or descriptor is null");
|
ALOGE("queryEffect: audioUuid or descriptor is null");
|
||||||
return EX_ILLEGAL_ARGUMENT;
|
return EX_ILLEGAL_ARGUMENT;
|
||||||
}
|
}
|
||||||
if (*audio_uuid != kUuid) {
|
if (*audioUuid != kUuid) {
|
||||||
ALOGE("queryEffect: invalid uuid");
|
ALOGE("queryEffect: invalid uuid");
|
||||||
return EX_ILLEGAL_ARGUMENT;
|
return EX_ILLEGAL_ARGUMENT;
|
||||||
}
|
}
|
||||||
@ -527,9 +454,10 @@ extern "C" binder_exception_t queryEffect(const AudioUuid *audio_uuid, Descripto
|
|||||||
return EX_NONE;
|
return EX_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" binder_exception_t createEffect(const AudioUuid *audio_uuid, std::shared_ptr<IEffect> *instanceSp) {
|
extern "C" binder_exception_t createEffect(const AudioUuid *audioUuid,
|
||||||
if (audio_uuid == nullptr || instanceSp == nullptr) {
|
std::shared_ptr<IEffect> *instanceSp) {
|
||||||
ALOGE("createEffect: audio_uuid or instanceSp is null");
|
if (audioUuid == nullptr || instanceSp == nullptr) {
|
||||||
|
ALOGE("createEffect: audioUuid or instanceSp is null");
|
||||||
return EX_ILLEGAL_ARGUMENT;
|
return EX_ILLEGAL_ARGUMENT;
|
||||||
}
|
}
|
||||||
*instanceSp = ndk::SharedRefBase::make<ViPER4AIDL>();
|
*instanceSp = ndk::SharedRefBase::make<ViPER4AIDL>();
|
||||||
@ -542,8 +470,8 @@ extern "C" binder_exception_t destroyEffect(const std::shared_ptr<IEffect> &inst
|
|||||||
return EX_ILLEGAL_ARGUMENT;
|
return EX_ILLEGAL_ARGUMENT;
|
||||||
}
|
}
|
||||||
|
|
||||||
Descriptor desc;
|
Descriptor descriptor;
|
||||||
ndk::ScopedAStatus status = instanceSp->getDescriptor(&desc);
|
ndk::ScopedAStatus status = instanceSp->getDescriptor(&descriptor);
|
||||||
if (!status.isOk()) {
|
if (!status.isOk()) {
|
||||||
ALOGE("destroyEffect: failed to get descriptor, status: %s", status.getDescription().c_str());
|
ALOGE("destroyEffect: failed to get descriptor, status: %s", status.getDescription().c_str());
|
||||||
return EX_ILLEGAL_STATE;
|
return EX_ILLEGAL_STATE;
|
||||||
|
@ -1,11 +1,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <mutex>
|
|
||||||
#include <thread>
|
|
||||||
#include <aidl/android/hardware/audio/effect/BnEffect.h>
|
|
||||||
#include <fmq/AidlMessageQueue.h>
|
|
||||||
#include <effect-impl/EffectThread.h>
|
#include <effect-impl/EffectThread.h>
|
||||||
#include "ViperContext.h"
|
#include "ViPERContext.h"
|
||||||
|
|
||||||
using aidl::android::hardware::common::fmq::SynchronizedReadWrite;
|
using aidl::android::hardware::common::fmq::SynchronizedReadWrite;
|
||||||
#if VIPER_AIDL_VERSION >= 2
|
#if VIPER_AIDL_VERSION >= 2
|
||||||
@ -26,15 +22,17 @@ using android::hardware::EventFlag;
|
|||||||
class ViPER4AIDL : public BnEffect, public EffectThread {
|
class ViPER4AIDL : public BnEffect, public EffectThread {
|
||||||
public:
|
public:
|
||||||
// BnEffect
|
// BnEffect
|
||||||
ndk::ScopedAStatus open(const Parameter::Common &common, const std::optional<Parameter::Specific> &specific, IEffect::OpenEffectReturn *ret) override;
|
ndk::ScopedAStatus open(const Parameter::Common &common,
|
||||||
|
const std::optional<Parameter::Specific> &specific,
|
||||||
|
IEffect::OpenEffectReturn *oer) override;
|
||||||
ndk::ScopedAStatus close() override;
|
ndk::ScopedAStatus close() override;
|
||||||
ndk::ScopedAStatus getDescriptor(Descriptor *_aidl_return) override;
|
ndk::ScopedAStatus getDescriptor(Descriptor *descriptor) override;
|
||||||
ndk::ScopedAStatus command(CommandId id) override;
|
ndk::ScopedAStatus command(CommandId command_id) override;
|
||||||
ndk::ScopedAStatus getState(State *state) override;
|
ndk::ScopedAStatus getState(State *state) override;
|
||||||
ndk::ScopedAStatus setParameter(const Parameter &in_param) override;
|
ndk::ScopedAStatus setParameter(const Parameter ¶meter) override;
|
||||||
ndk::ScopedAStatus getParameter(const Parameter::Id &in_paramId, Parameter *param) override;
|
ndk::ScopedAStatus getParameter(const Parameter::Id ¶meter_id, Parameter *parameter) override;
|
||||||
#if VIPER_AIDL_VERSION >= 2
|
#if VIPER_AIDL_VERSION >= 2
|
||||||
ndk::ScopedAStatus reopen(IEffect::OpenEffectReturn *ret) override;
|
ndk::ScopedAStatus reopen(IEffect::OpenEffectReturn *oer) override;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// EffectThread
|
// EffectThread
|
||||||
@ -43,11 +41,11 @@ private:
|
|||||||
typedef android::AidlMessageQueue<IEffect::Status, SynchronizedReadWrite> StatusMQ;
|
typedef android::AidlMessageQueue<IEffect::Status, SynchronizedReadWrite> StatusMQ;
|
||||||
typedef android::AidlMessageQueue<float, SynchronizedReadWrite> DataMQ;
|
typedef android::AidlMessageQueue<float, SynchronizedReadWrite> DataMQ;
|
||||||
|
|
||||||
void dupeFmq(IEffect::OpenEffectReturn* ret);
|
void dupeFmq(IEffect::OpenEffectReturn* oer);
|
||||||
void dupeFmqWithReopen(IEffect::OpenEffectReturn* ret);
|
void dupeFmqWithReopen(IEffect::OpenEffectReturn* oer);
|
||||||
RetCode notifyEventFlag(uint32_t flag);
|
RetCode notifyEventFlag(uint32_t flag);
|
||||||
void resetBuffer();
|
void resetBuffer();
|
||||||
IEffect::Status effectProcessImpl(float* in, float* out, int samples);
|
IEffect::Status effectProcessImpl(float *in, float *out, int32_t samples);
|
||||||
|
|
||||||
std::mutex mImplMutex;
|
std::mutex mImplMutex;
|
||||||
State mState = State::INIT;
|
State mState = State::INIT;
|
||||||
@ -59,12 +57,10 @@ private:
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
Parameter::Common mCommon;
|
Parameter::Common mCommon;
|
||||||
|
|
||||||
std::shared_ptr<StatusMQ> mStatusMQ;
|
std::shared_ptr<StatusMQ> mStatusMQ;
|
||||||
std::shared_ptr<DataMQ> mInputMQ;
|
std::shared_ptr<DataMQ> mInputMQ;
|
||||||
std::shared_ptr<DataMQ> mOutputMQ;
|
std::shared_ptr<DataMQ> mOutputMQ;
|
||||||
EventFlag *mEventFlag;
|
EventFlag *mEventFlag;
|
||||||
std::vector<float> mWorkBuffer;
|
std::vector<float> mWorkBuffer;
|
||||||
|
ViPERContext viperContext;
|
||||||
ViperContext viperContext;
|
|
||||||
};
|
};
|
||||||
|
@ -2,12 +2,15 @@
|
|||||||
#include <hardware/audio_effect.h>
|
#include <hardware/audio_effect.h>
|
||||||
#include "viper/ViPER.h"
|
#include "viper/ViPER.h"
|
||||||
#include <constants.h>
|
#include <constants.h>
|
||||||
#include "ViperContext.h"
|
#include "ViPERContext.h"
|
||||||
|
|
||||||
|
#define VIPER_NAME "ViPER4Android"
|
||||||
|
#define VIPER_IMPLEMENTOR "Iscle, Martmists, ViPER ACOUSTIC"
|
||||||
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
struct ViperHandle {
|
struct ViperHandle {
|
||||||
const struct effect_interface_s *iface; // Always keep as first member
|
const struct effect_interface_s *iface; // Always keep as first member
|
||||||
ViperContext *context;
|
ViPERContext *context;
|
||||||
};
|
};
|
||||||
|
|
||||||
static const effect_descriptor_t viperDescriptor = {
|
static const effect_descriptor_t viperDescriptor = {
|
||||||
@ -19,7 +22,7 @@ static const effect_descriptor_t viperDescriptor = {
|
|||||||
.cpuLoad = 8, // In 0.1 MIPS units as estimated on an ARM9E core (ARMv5TE) with 0 WS
|
.cpuLoad = 8, // In 0.1 MIPS units as estimated on an ARM9E core (ARMv5TE) with 0 WS
|
||||||
.memoryUsage = 1, // In KB and includes only dynamically allocated memory
|
.memoryUsage = 1, // In KB and includes only dynamically allocated memory
|
||||||
.name = VIPER_NAME,
|
.name = VIPER_NAME,
|
||||||
.implementor = VIPER_AUTHORS
|
.implementor = VIPER_IMPLEMENTOR
|
||||||
};
|
};
|
||||||
|
|
||||||
static int32_t viperInterfaceProcess(effect_handle_t self, audio_buffer_t *inBuffer, audio_buffer_t *outBuffer) {
|
static int32_t viperInterfaceProcess(effect_handle_t self, audio_buffer_t *inBuffer, audio_buffer_t *outBuffer) {
|
||||||
@ -58,7 +61,7 @@ viperLibraryCreate(const effect_uuid_t *uuid, int32_t sessionId __unused, int32_
|
|||||||
|
|
||||||
ViperHandle *viperHandle = new ViperHandle();
|
ViperHandle *viperHandle = new ViperHandle();
|
||||||
viperHandle->iface = &viperInterface;
|
viperHandle->iface = &viperInterface;
|
||||||
viperHandle->context = new ViperContext();
|
viperHandle->context = new ViPERContext();
|
||||||
*pHandle = reinterpret_cast<effect_handle_t>(viperHandle);
|
*pHandle = reinterpret_cast<effect_handle_t>(viperHandle);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -83,8 +86,8 @@ __attribute__ ((visibility ("default")))
|
|||||||
audio_effect_library_t AUDIO_EFFECT_LIBRARY_INFO_SYM = {
|
audio_effect_library_t AUDIO_EFFECT_LIBRARY_INFO_SYM = {
|
||||||
.tag = AUDIO_EFFECT_LIBRARY_TAG,
|
.tag = AUDIO_EFFECT_LIBRARY_TAG,
|
||||||
.version = EFFECT_LIBRARY_API_VERSION,
|
.version = EFFECT_LIBRARY_API_VERSION,
|
||||||
.name = VIPER_NAME,
|
.name = ViPER4Android::kName,
|
||||||
.implementor = VIPER_AUTHORS,
|
.implementor = ViPER4Android::kImplementor,
|
||||||
.create_effect = viperLibraryCreate,
|
.create_effect = viperLibraryCreate,
|
||||||
.release_effect = viperLibraryRelease,
|
.release_effect = viperLibraryRelease,
|
||||||
.get_descriptor = viperLibraryGetDescriptor,
|
.get_descriptor = viperLibraryGetDescriptor,
|
||||||
|
@ -1,7 +1,12 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
// Source: https://github.com/vipersaudio/viperfx_core_binary/blob/master/viperfx_intf.h
|
namespace ViPER4Android {
|
||||||
// Updated parameters source: https://github.com/vipersaudio/viper4android_fx/blob/master/android_4.x/src/com/vipercn/viper4android_v2/service/ViPER4AndroidService.java
|
static const char *const kName = "ViPER4Android";
|
||||||
|
static const char *const kImplementor = "Iscle, Martmists, ViPER ACOUSTIC";
|
||||||
|
|
||||||
|
static const char *const kTypeString = "b9bc100c-26cd-42e6-acb6-cad8c3f778de";
|
||||||
|
static const char *const kUuidString = "90380da3-8536-4744-a6a3-5731970e640f";
|
||||||
|
};
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
PARAM_GET_ENABLED = 0,
|
PARAM_GET_ENABLED = 0,
|
||||||
|
@ -1,22 +1,22 @@
|
|||||||
#include <cerrno>
|
#include <cerrno>
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
#include "ViperContext.h"
|
#include "ViPERContext.h"
|
||||||
#include <log/log.h>
|
#include <log/log.h>
|
||||||
#include <constants.h>
|
#include <constants.h>
|
||||||
|
|
||||||
#define SET(type, ptr, value) (*(type *) (ptr) = (value))
|
#define SET(type, ptr, value) (*(type *) (ptr) = (value))
|
||||||
|
|
||||||
ViperContext::ViperContext() :
|
ViPERContext::ViPERContext() :
|
||||||
config({}),
|
config({}),
|
||||||
disableReason(DisableReason::UNKNOWN),
|
disableReason(DisableReason::UNKNOWN),
|
||||||
buffer(std::vector<float>()),
|
buffer(std::vector<float>()),
|
||||||
bufferFrameCount(0),
|
bufferFrameCount(0),
|
||||||
enabled(false) {
|
enabled(false) {
|
||||||
ALOGI("ViperContext created");
|
ALOGI("ViPERContext created");
|
||||||
}
|
}
|
||||||
|
|
||||||
void ViperContext::copyBufferConfig(buffer_config_t *dest, buffer_config_t *src) {
|
void ViPERContext::copyBufferConfig(buffer_config_t *dest, buffer_config_t *src) {
|
||||||
if (src->mask & EFFECT_CONFIG_BUFFER) {
|
if (src->mask & EFFECT_CONFIG_BUFFER) {
|
||||||
dest->buffer = src->buffer;
|
dest->buffer = src->buffer;
|
||||||
}
|
}
|
||||||
@ -44,7 +44,7 @@ void ViperContext::copyBufferConfig(buffer_config_t *dest, buffer_config_t *src)
|
|||||||
dest->mask |= src->mask;
|
dest->mask |= src->mask;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ViperContext::handleSetConfig(effect_config_t *newConfig) {
|
void ViPERContext::handleSetConfig(effect_config_t *newConfig) {
|
||||||
ALOGI("Checking input and output configuration ...");
|
ALOGI("Checking input and output configuration ...");
|
||||||
|
|
||||||
ALOGI("Input mask: 0x%04X", newConfig->inputCfg.mask);
|
ALOGI("Input mask: 0x%04X", newConfig->inputCfg.mask);
|
||||||
@ -129,7 +129,7 @@ void ViperContext::handleSetConfig(effect_config_t *newConfig) {
|
|||||||
viper.reset();
|
viper.reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t ViperContext::handleSetParam(effect_param_t *pCmdParam, void *pReplyData) {
|
int32_t ViPERContext::handleSetParam(effect_param_t *pCmdParam, void *pReplyData) {
|
||||||
// The value offset of an effect parameter is computed by rounding up
|
// The value offset of an effect parameter is computed by rounding up
|
||||||
// the parameter size to the next 32 bit alignment.
|
// the parameter size to the next 32 bit alignment.
|
||||||
uint32_t vOffset = ((pCmdParam->psize + sizeof(int32_t) - 1) / sizeof(int32_t)) * sizeof(int32_t);
|
uint32_t vOffset = ((pCmdParam->psize + sizeof(int32_t) - 1) / sizeof(int32_t)) * sizeof(int32_t);
|
||||||
@ -608,7 +608,7 @@ int32_t ViperContext::handleSetParam(effect_param_t *pCmdParam, void *pReplyData
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t ViperContext::handleGetParam(effect_param_t *pCmdParam, effect_param_t *pReplyParam, uint32_t *pReplySize) {
|
int32_t ViPERContext::handleGetParam(effect_param_t *pCmdParam, effect_param_t *pReplyParam, uint32_t *pReplySize) {
|
||||||
// The value offset of an effect parameter is computed by rounding up
|
// The value offset of an effect parameter is computed by rounding up
|
||||||
// the parameter size to the next 32 bit alignment.
|
// the parameter size to the next 32 bit alignment.
|
||||||
uint32_t vOffset = ((pCmdParam->psize + sizeof(int32_t) - 1) / sizeof(int32_t)) * sizeof(int32_t);
|
uint32_t vOffset = ((pCmdParam->psize + sizeof(int32_t) - 1) / sizeof(int32_t)) * sizeof(int32_t);
|
||||||
@ -684,7 +684,7 @@ int32_t ViperContext::handleGetParam(effect_param_t *pCmdParam, effect_param_t *
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t ViperContext::handleCommand(uint32_t cmdCode, uint32_t cmdSize, void *pCmdData, uint32_t *pReplySize, void *pReplyData) {
|
int32_t ViPERContext::handleCommand(uint32_t cmdCode, uint32_t cmdSize, void *pCmdData, uint32_t *pReplySize, void *pReplyData) {
|
||||||
uint32_t replySize = pReplySize == nullptr ? 0 : *pReplySize;
|
uint32_t replySize = pReplySize == nullptr ? 0 : *pReplySize;
|
||||||
switch (cmdCode) {
|
switch (cmdCode) {
|
||||||
case EFFECT_CMD_INIT: {
|
case EFFECT_CMD_INIT: {
|
||||||
@ -801,7 +801,7 @@ static audio_buffer_t *getBuffer(buffer_config_s *config, audio_buffer_t *buffer
|
|||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t ViperContext::process(audio_buffer_t *inBuffer, audio_buffer_t *outBuffer) {
|
int32_t ViPERContext::process(audio_buffer_t *inBuffer, audio_buffer_t *outBuffer) {
|
||||||
if (disableReason != DisableReason::NONE) {
|
if (disableReason != DisableReason::NONE) {
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
@ -860,7 +860,7 @@ int32_t ViperContext::process(audio_buffer_t *inBuffer, audio_buffer_t *outBuffe
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t ViperContext::process(float *inBuffer, float *outBuffer, size_t count) {
|
int32_t ViPERContext::process(float *inBuffer, float *outBuffer, size_t count) {
|
||||||
memcpy(outBuffer, inBuffer, count * sizeof(float));
|
memcpy(outBuffer, inBuffer, count * sizeof(float));
|
||||||
// The viper process function expects the count to be the number of
|
// The viper process function expects the count to be the number of
|
||||||
// stereo frames, not the number of samples. Thus, we divide by 2.
|
// stereo frames, not the number of samples. Thus, we divide by 2.
|
||||||
@ -868,6 +868,6 @@ int32_t ViperContext::process(float *inBuffer, float *outBuffer, size_t count) {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ViperContext::setDisableReason(DisableReason reason) {
|
void ViPERContext::setDisableReason(DisableReason reason) {
|
||||||
this->disableReason = reason;
|
this->disableReason = reason;
|
||||||
}
|
}
|
@ -6,7 +6,7 @@
|
|||||||
#include "viper/ViPER.h"
|
#include "viper/ViPER.h"
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
class ViperContext {
|
class ViPERContext {
|
||||||
public:
|
public:
|
||||||
enum class DisableReason : int32_t {
|
enum class DisableReason : int32_t {
|
||||||
UNKNOWN = -1,
|
UNKNOWN = -1,
|
||||||
@ -17,7 +17,7 @@ public:
|
|||||||
INVALID_FORMAT,
|
INVALID_FORMAT,
|
||||||
};
|
};
|
||||||
|
|
||||||
ViperContext();
|
ViPERContext();
|
||||||
|
|
||||||
int32_t handleCommand(uint32_t cmdCode, uint32_t cmdSize, void *pCmdData, uint32_t *replySize, void *pReplyData);
|
int32_t handleCommand(uint32_t cmdCode, uint32_t cmdSize, void *pCmdData, uint32_t *replySize, void *pReplyData);
|
||||||
int32_t process(audio_buffer_t *inBuffer, audio_buffer_t *outBuffer);
|
int32_t process(audio_buffer_t *inBuffer, audio_buffer_t *outBuffer);
|
@ -35,6 +35,4 @@ enum class Architecture : uint8_t {
|
|||||||
*/
|
*/
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define VIPER_NAME "ViPER4Android"
|
|
||||||
#define VIPER_AUTHORS "viper.WYF, Martmists, Iscle"
|
|
||||||
#define VIPER_DEFAULT_SAMPLING_RATE 44100
|
#define VIPER_DEFAULT_SAMPLING_RATE 44100
|
Loading…
x
Reference in New Issue
Block a user