Skip to content

Commit

Permalink
Improved interface
Browse files Browse the repository at this point in the history
Not all effects are implemented. Untested.
  • Loading branch information
iscle committed Mar 14, 2024
1 parent 8cc3af5 commit 8107aee
Show file tree
Hide file tree
Showing 11 changed files with 682 additions and 500 deletions.
4 changes: 2 additions & 2 deletions src/ViPER4Android.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,11 @@ static int32_t viperInterfaceProcess(effect_handle_t self, audio_buffer_t *inBuf

static int32_t viperInterfaceCommand(effect_handle_t self,
uint32_t cmdCode, uint32_t cmdSize, void *pCmdData,
uint32_t *replySize, void *pReplyData) {
uint32_t *pReplySize, void *pReplyData) {
auto viperHandle = reinterpret_cast<ViperHandle *>(self);
if (viperHandle == nullptr) return -EINVAL;

return viperHandle->context->handleCommand(cmdCode, cmdSize, pCmdData, replySize, pReplyData);
return viperHandle->context->handleCommand(cmdCode, cmdSize, pCmdData, pReplySize, pReplyData);
}

static int32_t viperInterfaceGetDescriptor(effect_handle_t self, effect_descriptor_t *pDescriptor) {
Expand Down
129 changes: 33 additions & 96 deletions src/ViPER4Android.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,6 @@
// Source: https://github.com/vipersaudio/viperfx_core_binary/blob/master/viperfx_intf.h
// Updated parameters source: https://github.com/vipersaudio/viper4android_fx/blob/master/android_4.x/src/com/vipercn/viper4android_v2/service/ViPER4AndroidService.java

extern "C" {
// Command code
#define COMMAND_CODE_GET 0x01
#define COMMAND_CODE_SET 0x02

typedef enum {
PARAM_GET_ENABLED = 0,
PARAM_GET_FRAME_COUNT,
Expand All @@ -17,94 +12,36 @@ typedef enum {
PARAM_GET_ARCHITECTURE,
} param_get_t;

// Param set
#define PARAM_SET_UPDATE_STATUS 0x9002
#define PARAM_SET_RESET_STATUS 0x9003

#define PARAM_CONVOLUTION_ENABLE 65538
#define PARAM_CONVOLUTION_PREPARE_BUFFER 65540
#define PARAM_CONVOLUTION_SET_BUFFER 65541
#define PARAM_CONVOLUTION_COMMIT_BUFFER 65542
#define PARAM_CONVOLUTION_CROSS_CHANNEL 65543

#define PARAM_HEADPHONE_SURROUND_ENABLE 65544
#define PARAM_HEADPHONE_SURROUND_STRENGTH 65545

#define PARAM_DDC_ENABLE 65546
#define PARAM_DDC_COEFFICIENTS 65547

#define PARAM_SPECTRUM_EXTENSION_ENABLE 65548
#define PARAM_SPECTRUM_EXTENSION_BARK 65549 // Bark is a scale like dB
#define PARAM_SPECTRUM_EXTENSION_BARK_RECONSTRUCT 65550

#define PARAM_FIR_EQUALIZER_ENABLE 65551
#define PARAM_FIR_EQUALIZER_BAND_LEVEL 65552

#define PARAM_FIELD_SURROUND_ENABLE 65553
#define PARAM_FIELD_SURROUND_WIDENING 65554
#define PARAM_FIELD_SURROUND_MID_IMAGE 65555
#define PARAM_FIELD_SURROUND_DEPTH 65556

#define PARAM_DIFFERENTIAL_SURROUND_ENABLE 65557
#define PARAM_DIFFERENTIAL_SURROUND_DELAY 65558

#define PARAM_REVERBERATION_ENABLE 0x10017
#define PARAM_REVERBERATION_ROOM_SIZE 0x10018
#define PARAM_REVERBERATION_ROOM_WIDTH 0x10019
#define PARAM_REVERBERATION_ROOM_DAMPENING 0x1001A
#define PARAM_REVERBERATION_ROOM_WET_SIGNAL 0x1001B
#define PARAM_REVERBERATION_ROOM_DRY_SIGNAL 0x1001C

#define PARAM_AUTOMATIC_GAIN_CONTROL_ENABLE 65565
#define PARAM_AUTOMATIC_GAIN_CONTROL_RATIO 65566
#define PARAM_AUTOMATIC_GAIN_CONTROL_VOLUME 65567
#define PARAM_AUTOMATIC_GAIN_CONTROL_MAX_SCALER 65568

#define PARAM_DYNAMIC_SYSTEM_ENABLE 65569
#define PARAM_DYNAMIC_SYSTEM_X_COEFFICIENTS 65570
#define PARAM_DYNAMIC_SYSTEM_Y_COEFFICIENTS 65571
#define PARAM_DYNAMIC_SYSTEM_SIDE_GAIN 65572
#define PARAM_DYNAMIC_SYSTEM_STRENGTH 65573

#define PARAM_FIDELITY_BASS_ENABLE 65574
#define PARAM_FIDELITY_BASS_MODE 65575
#define PARAM_FIDELITY_BASS_FREQUENCY 65576
#define PARAM_FIDELITY_BASS_GAIN 65577

#define PARAM_FIDELITY_CLARITY_ENABLE 65578
#define PARAM_FIDELITY_CLARITY_MODE 65579
#define PARAM_FIDELITY_CLARITY_GAIN 65580

#define PARAM_CURE_CROSS_FEED_ENABLED 65581
#define PARAM_CURE_CROSS_FEED_STRENGTH 65582

#define PARAM_TUBE_SIMULATOR_ENABLED 65583

#define PARAM_ANALOGX_ENABLE 65584
#define PARAM_ANALOGX_MODE 65585

#define PARAM_GATE_OUTPUT_VOLUME 65586
#define PARAM_GATE_CHANNEL_PAN 65587
#define PARAM_GATE_LIMIT 65588

#define PARAM_SPEAKER_OPTIMIZATION 65603

#define PARAM_FET_COMPRESSOR_ENABLE 65610
#define PARAM_FET_COMPRESSOR_THRESHOLD 65611
#define PARAM_FET_COMPRESSOR_RATIO 65612
#define PARAM_FET_COMPRESSOR_KNEE 65613
#define PARAM_FET_COMPRESSOR_AUTO_KNEE 65614
#define PARAM_FET_COMPRESSOR_GAIN 65615
#define PARAM_FET_COMPRESSOR_AUTO_GAIN 65616
#define PARAM_FET_COMPRESSOR_ATTACK 65617
#define PARAM_FET_COMPRESSOR_AUTO_ATTACK 65618
#define PARAM_FET_COMPRESSOR_RELEASE 65619
#define PARAM_FET_COMPRESSOR_AUTO_RELEASE 65620
#define PARAM_FET_COMPRESSOR_KNEE_MULTI 65621
#define PARAM_FET_COMPRESSOR_MAX_ATTACK 65622
#define PARAM_FET_COMPRESSOR_MAX_RELEASE 65623
#define PARAM_FET_COMPRESSOR_CREST 65624
#define PARAM_FET_COMPRESSOR_ADAPT 65625
#define PARAM_FET_COMPRESSOR_NO_CLIP 65626

}
typedef enum {
PARAM_SET_RESET = 0,
PARAM_SET_DDC_ENABLE,
PARAM_SET_DDC_COEFFICIENTS,
PARAM_SET_VIPER_BASS_ENABLE,
PARAM_SET_VIPER_BASS_MODE,
PARAM_SET_VIPER_BASS_FREQUENCY,
PARAM_SET_VIPER_BASS_GAIN,
PARAM_SET_VIPER_CLARITY_ENABLE,
PARAM_SET_VIPER_CLARITY_MODE,
PARAM_SET_VIPER_CLARITY_GAIN,
PARAM_SET_OUTPUT_GAIN,
PARAM_SET_THRESHOLD_LIMIT,
PARAM_SET_SPEAKER_OPTIMIZATION_ENABLE,
PARAM_SET_ANALOGX_ENABLE,
PARAM_SET_ANALOGX_LEVEL,
PARAM_SET_TUBE_SIMULATOR_ENABLE,
PARAM_SET_CURE_ENABLE,
PARAM_SET_CURE_LEVEL,
PARAM_SET_REVERBERATION_ENABLE,
PARAM_SET_REVERBERATION_ROOM_SIZE,
PARAM_SET_REVERBERATION_SOUND_FIELD,
PARAM_SET_REVERBERATION_DAMPING,
PARAM_SET_REVERBERATION_WET_SIGNAL,
PARAM_SET_REVERBERATION_DRY_SIGNAL,
PARAM_SET_DIFFERENTIAL_SURROUND_ENABLE,
PARAM_SET_DIFFERENTIAL_SURROUND_DELAY,
PARAM_SET_FIELD_SURROUND_ENABLE,
PARAM_SET_FIELD_SURROUND_DEPTH,
PARAM_SET_FIELD_SURROUND_MID_IMAGE,
PARAM_SET_IIR_EQUALIZER_ENABLE,
PARAM_SET_IIR_EQUALIZER_BAND_LEVEL,
} param_set_t;
Loading

0 comments on commit 8107aee

Please sign in to comment.