mirror of
https://github.com/AndroidAudioMods/ViPERFX_RE.git
synced 2025-06-08 02:29:40 +08:00
logging and version
This commit is contained in:
parent
c5534cf59f
commit
70dff35e63
@ -5,7 +5,12 @@ project("ViPER4Android Reworked")
|
|||||||
set(CMAKE_CXX_COMPILER_VERSION 20)
|
set(CMAKE_CXX_COMPILER_VERSION 20)
|
||||||
|
|
||||||
include_directories(include/)
|
include_directories(include/)
|
||||||
message(${ANDROID_NDK}/include/)
|
|
||||||
|
add_compile_definitions(VERSION_MAJOR=1)
|
||||||
|
add_compile_definitions(VERSION_MINOR=0)
|
||||||
|
add_compile_definitions(VERSION_REVISION=0)
|
||||||
|
add_compile_definitions(VERSION_BUILD=0)
|
||||||
|
add_compile_definitions(VERSION_CODENAME="Reworked")
|
||||||
|
|
||||||
set(FILES
|
set(FILES
|
||||||
# Main
|
# Main
|
||||||
@ -39,3 +44,7 @@ add_library(
|
|||||||
# Provides a relative path to your source file(s).
|
# Provides a relative path to your source file(s).
|
||||||
${FILES})
|
${FILES})
|
||||||
|
|
||||||
|
target_link_libraries(
|
||||||
|
v4afx_r
|
||||||
|
log
|
||||||
|
)
|
||||||
|
@ -136,7 +136,7 @@ static inline audio_unique_id_use_t audio_unique_id_get_use(audio_unique_id_t id
|
|||||||
*/
|
*/
|
||||||
typedef uint32_t audio_channel_mask_t;
|
typedef uint32_t audio_channel_mask_t;
|
||||||
|
|
||||||
/* log(2) of maximum number of representations, not part of public API */
|
/* v4a_print(2) of maximum number of representations, not part of public API */
|
||||||
#define AUDIO_CHANNEL_REPRESENTATION_LOG2 2
|
#define AUDIO_CHANNEL_REPRESENTATION_LOG2 2
|
||||||
|
|
||||||
/* The return value is undefined if the channel mask is invalid. */
|
/* The return value is undefined if the channel mask is invalid. */
|
||||||
|
@ -70,40 +70,45 @@ int32_t Effect::command(uint32_t cmdCode, uint32_t cmdSize, void *pCmdData, uint
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#define ERROR this->configureOk = false;\
|
#define DO_ERROR() this->configureOk = false;\
|
||||||
return -EINVAL;
|
return -EINVAL
|
||||||
|
|
||||||
int32_t Effect::configure(effect_config_t *newConfig) {
|
int32_t Effect::configure(effect_config_t *newConfig) {
|
||||||
|
v4a_print(ANDROID_LOG_INFO, "Begin audio configure ...");
|
||||||
|
v4a_print(ANDROID_LOG_INFO, "Checking input and output configuration ...");
|
||||||
|
|
||||||
if (newConfig->inputCfg.samplingRate != newConfig->outputCfg.samplingRate) {
|
if (newConfig->inputCfg.samplingRate != newConfig->outputCfg.samplingRate) {
|
||||||
// __android_log_print(4,"ViPER4Android_v2","ViPER4Android disabled, reason [in.SR = %d, out.SR = %d]",inSamplingRate,outSamplingRate);
|
v4a_printf(ANDROID_LOG_ERROR, "ViPER4Android disabled, reason [in.SR = %d, out.SR = %d]", newConfig->inputCfg.samplingRate, newConfig->outputCfg.samplingRate);
|
||||||
ERROR
|
DO_ERROR();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (newConfig->inputCfg.samplingRate > 48000) {
|
if (newConfig->inputCfg.samplingRate > 48000) {
|
||||||
// __android_log_print(4,"ViPER4Android_v2","ViPER4Android disabled, reason [SR out of range]");
|
v4a_print(ANDROID_LOG_ERROR, "ViPER4Android disabled, reason [SR out of range]");
|
||||||
ERROR
|
DO_ERROR();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (newConfig->inputCfg.channels != newConfig->outputCfg.channels) {
|
if (newConfig->inputCfg.channels != newConfig->outputCfg.channels) {
|
||||||
// __android_log_print(4,"ViPER4Android_v2","ViPER4Android disabled, reason [in.CH = %d, out.CH = %d]",inChannels,outChannels);
|
v4a_printf(ANDROID_LOG_ERROR, "ViPER4Android disabled, reason [in.CH = %d, out.CH = %d]", newConfig->inputCfg.channels, newConfig->outputCfg.channels);
|
||||||
ERROR
|
DO_ERROR();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (newConfig->inputCfg.channels != AUDIO_CHANNEL_OUT_STEREO) {
|
if (newConfig->inputCfg.channels != AUDIO_CHANNEL_OUT_STEREO) {
|
||||||
// __android_log_print(4,"ViPER4Android_v2","ViPER4Android disabled, reason [CH != 2]");
|
v4a_print(ANDROID_LOG_ERROR, "ViPER4Android disabled, reason [CH != 2]");
|
||||||
ERROR
|
DO_ERROR();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
v4a_print(ANDROID_LOG_INFO, "Input and output configuration checked.");
|
||||||
|
|
||||||
// if (((inFormat & 0x80000) != 0) && ((outFormat & 0x80000) != 0)) {
|
// if (((inFormat & 0x80000) != 0) && ((outFormat & 0x80000) != 0)) {
|
||||||
// if ((inFormat & 0xfd) != 1) {
|
// if ((inFormat & 0xfd) != 1) {
|
||||||
// __android_log_print(4,"ViPER4Android_v2","ViPER4Android disabled, reason [in.FMT = %d]");
|
// v4a_printf(ANDROID_LOG_ERROR, "ViPER4Android disabled, reason [in.FMT = %d]");
|
||||||
// __android_log_print(4,"ViPER4Android_v2","We only accept s16 and fixed.31 format");
|
// v4a_printf(ANDROID_LOG_ERROR, "We only accept s16 and fixed.31 format");
|
||||||
// this->configureOk = false;
|
// this->configureOk = false;
|
||||||
// return 0xffffffea;
|
// return 0xffffffea;
|
||||||
// }
|
// }
|
||||||
// if ((outFormat & 0xfd) != 1) {
|
// if ((outFormat & 0xfd) != 1) {
|
||||||
// __android_log_print(4,"ViPER4Android_v2","ViPER4Android disabled, reason [out.FMT = %d]");
|
// v4a_printf(ANDROID_LOG_ERROR, "ViPER4Android disabled, reason [out.FMT = %d]");
|
||||||
// __android_log_print(4,"ViPER4Android_v2","We only accept s16 and fixed.31 format");
|
// v4a_printf(ANDROID_LOG_ERROR, "We only accept s16 and fixed.31 format");
|
||||||
// this->configureOk = false;
|
// this->configureOk = false;
|
||||||
// return 0xffffffea;
|
// return 0xffffffea;
|
||||||
// }
|
// }
|
||||||
@ -111,6 +116,9 @@ int32_t Effect::configure(effect_config_t *newConfig) {
|
|||||||
|
|
||||||
memcpy(&this->config, newConfig, sizeof(effect_config_t));
|
memcpy(&this->config, newConfig, sizeof(effect_config_t));
|
||||||
this->configureOk = true;
|
this->configureOk = true;
|
||||||
|
|
||||||
|
v4a_print(ANDROID_LOG_INFO, "Audio configure finished");
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4,9 +4,11 @@
|
|||||||
|
|
||||||
#include "ProcessUnit_FX.h"
|
#include "ProcessUnit_FX.h"
|
||||||
#include "Effect.h"
|
#include "Effect.h"
|
||||||
|
#include "constants.h"
|
||||||
|
|
||||||
ProcessUnit_FX::ProcessUnit_FX() {
|
ProcessUnit_FX::ProcessUnit_FX() {
|
||||||
|
v4a_print(ANDROID_LOG_INFO, "Welcome to ViPER4Android Reworked driver[SQ]");
|
||||||
|
v4a_printf(ANDROID_LOG_INFO, "Current version is %s %s", VERSION_STRING, VERSION_CODENAME);
|
||||||
}
|
}
|
||||||
|
|
||||||
ProcessUnit_FX::~ProcessUnit_FX() {
|
ProcessUnit_FX::~ProcessUnit_FX() {
|
||||||
|
@ -4,4 +4,12 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include <android/log.h>
|
||||||
|
|
||||||
|
#define STR_HELPER(x) #x
|
||||||
|
#define STR(x) STR_HELPER(x)
|
||||||
|
#define VERSION_STRING STR(VERSION_MAJOR) "." STR(VERSION_MINOR) "." STR(VERSION_REVISION) "." STR(VERSION_BUILD)
|
||||||
|
|
||||||
#define DEFAULT_SAMPLERATE 44100
|
#define DEFAULT_SAMPLERATE 44100
|
||||||
|
#define v4a_print(status, message) __android_log_write(status, "ViPER4Android_Reworked", message)
|
||||||
|
#define v4a_printf(status, format, ...) __android_log_print(status, "ViPER4Android_Reworked", format, __VA_ARGS__)
|
@ -4,6 +4,7 @@
|
|||||||
|
|
||||||
#include "Effect.h"
|
#include "Effect.h"
|
||||||
#include "ProcessUnit_FX.h"
|
#include "ProcessUnit_FX.h"
|
||||||
|
#include "constants.h"
|
||||||
|
|
||||||
static effect_descriptor_t viper_descriptor = {
|
static effect_descriptor_t viper_descriptor = {
|
||||||
// Identical type/uuid to original ViPER4Android
|
// Identical type/uuid to original ViPER4Android
|
||||||
@ -32,7 +33,7 @@ extern "C" {
|
|||||||
}
|
}
|
||||||
static int32_t generic_getDescriptor(effect_handle_t self, effect_descriptor_t *pDescriptor) {
|
static int32_t generic_getDescriptor(effect_handle_t self, effect_descriptor_t *pDescriptor) {
|
||||||
auto e = (handle *) self;
|
auto e = (handle *) self;
|
||||||
strcpy(viper_descriptor.name, "ViPER4Android Reworked [1.0.0.0]");
|
strcpy(viper_descriptor.name, "ViPER4Android Reworked [" VERSION_STRING "]");
|
||||||
strcpy(viper_descriptor.implementor, "ViPER.WYF, Martmists, Iscle");
|
strcpy(viper_descriptor.implementor, "ViPER.WYF, Martmists, Iscle");
|
||||||
|
|
||||||
memcpy(pDescriptor, e->descriptor, sizeof(effect_descriptor_t));
|
memcpy(pDescriptor, e->descriptor, sizeof(effect_descriptor_t));
|
||||||
@ -47,23 +48,34 @@ extern "C" {
|
|||||||
};
|
};
|
||||||
|
|
||||||
int32_t EffectCreate(const effect_uuid_t *uuid, int32_t sessionId, int32_t ioId, effect_handle_t *pEffect) {
|
int32_t EffectCreate(const effect_uuid_t *uuid, int32_t sessionId, int32_t ioId, effect_handle_t *pEffect) {
|
||||||
|
v4a_print(ANDROID_LOG_INFO,"Enter EffectCreate()");
|
||||||
if (memcmp(uuid, &viper_descriptor.uuid, sizeof(effect_uuid_t)) == 0) {
|
if (memcmp(uuid, &viper_descriptor.uuid, sizeof(effect_uuid_t)) == 0) {
|
||||||
// UUID matches
|
// UUID matches
|
||||||
strcpy(viper_descriptor.name, "ViPER4Android Reworked [1.0.0.0]");
|
v4a_printf(ANDROID_LOG_INFO, "EffectCreate(), uuid = %08x-%04x-%04x-%04x-%02x%02x%02x%02x%02x%02x", uuid->timeLow, uuid->timeMid, uuid->timeHiAndVersion, uuid->clockSeq, uuid->node[0], uuid->node[1], uuid->node[2], uuid->node[3], uuid->node[4], uuid->node[5]);
|
||||||
|
|
||||||
|
strcpy(viper_descriptor.name, "ViPER4Android Reworked [" VERSION_STRING "]");
|
||||||
strcpy(viper_descriptor.implementor, "ViPER.WYF, Martmists, Iscle");
|
strcpy(viper_descriptor.implementor, "ViPER.WYF, Martmists, Iscle");
|
||||||
|
|
||||||
|
v4a_print(ANDROID_LOG_INFO, "EffectCreate(), v4a standard effect (normal), Constructing ProcessUnit_FX");
|
||||||
|
|
||||||
auto ptr = (handle*)calloc(1, sizeof(handle));
|
auto ptr = (handle*)calloc(1, sizeof(handle));
|
||||||
ptr->interface = &viper_interface;
|
ptr->interface = &viper_interface;
|
||||||
ptr->effect = new ProcessUnit_FX();
|
ptr->effect = new ProcessUnit_FX();
|
||||||
ptr->descriptor = &viper_descriptor;
|
ptr->descriptor = &viper_descriptor;
|
||||||
|
|
||||||
|
v4a_print(ANDROID_LOG_INFO, "Creating ViPER4Android Reworked [" VERSION_STRING "]");
|
||||||
*pEffect = (effect_handle_t)ptr;
|
*pEffect = (effect_handle_t)ptr;
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
|
v4a_print(ANDROID_LOG_ERROR, "EffectCreate(), Error [effect not found]");
|
||||||
return -ENOENT;
|
return -ENOENT;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t EffectRelease(effect_handle_t ei) {
|
int32_t EffectRelease(effect_handle_t ei) {
|
||||||
|
v4a_print(ANDROID_LOG_INFO, "EffectRelease(), Deconstructing ProcessUnit");
|
||||||
|
|
||||||
auto ptr = (handle*)ei;
|
auto ptr = (handle*)ei;
|
||||||
delete ptr->effect;
|
delete ptr->effect;
|
||||||
free(ptr);
|
free(ptr);
|
||||||
@ -71,12 +83,17 @@ extern "C" {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int32_t EffectGetDescriptor(const effect_uuid_t *uuid, effect_descriptor_t *pDescriptor) {
|
int32_t EffectGetDescriptor(const effect_uuid_t *uuid, effect_descriptor_t *pDescriptor) {
|
||||||
|
v4a_print(ANDROID_LOG_INFO, "Enter EffectGetDescriptor()");
|
||||||
|
|
||||||
if (memcmp(uuid, &viper_descriptor.uuid, sizeof(effect_uuid_t)) == 0) {
|
if (memcmp(uuid, &viper_descriptor.uuid, sizeof(effect_uuid_t)) == 0) {
|
||||||
strcpy(viper_descriptor.name, "ViPER4Android Reworked [1.0.0.0]");
|
v4a_printf(ANDROID_LOG_INFO, "EffectGetDescriptor(), uuid = %08x-%04x-%04x-%04x-%02x%02x%02x%02x%02x%02x", uuid->timeLow, uuid->timeMid, uuid->timeHiAndVersion, uuid->clockSeq, uuid->node[0], uuid->node[1], uuid->node[2], uuid->node[3], uuid->node[4], uuid->node[5]);
|
||||||
|
|
||||||
|
strcpy(viper_descriptor.name, "ViPER4Android Reworked [" VERSION_STRING "]");
|
||||||
strcpy(viper_descriptor.implementor, "ViPER.WYF, Martmists, Iscle");
|
strcpy(viper_descriptor.implementor, "ViPER.WYF, Martmists, Iscle");
|
||||||
|
|
||||||
memcpy(pDescriptor, &viper_descriptor, sizeof(effect_descriptor_t));
|
memcpy(pDescriptor, &viper_descriptor, sizeof(effect_descriptor_t));
|
||||||
} else {
|
} else {
|
||||||
|
v4a_print(ANDROID_LOG_ERROR, "EffectGetDescriptor(), Error [effect not found]");
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user