Audio effects: lvm bundle wrapper update after first integration tests.
Change-Id: I20cb55282833bd6e3a160e0dae1cc1fcb6b1ca30
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -27,25 +27,30 @@ extern "C" {
|
|||||||
#define FIVEBAND_NUMBANDS 5
|
#define FIVEBAND_NUMBANDS 5
|
||||||
#define MAX_NUM_BANDS 5
|
#define MAX_NUM_BANDS 5
|
||||||
#define MAX_CALL_SIZE 256
|
#define MAX_CALL_SIZE 256
|
||||||
|
//#define LVM_PCM
|
||||||
|
|
||||||
//TODO: this should be included from each effect API include
|
//TODO: this should be included from each effect API include
|
||||||
static const effect_uuid_t SL_IID_BASSBOOST_ = { 0x0634f220, 0xddd4, 0x11db, 0xa0fc, { 0x00, 0x02, 0xa5, 0xd5, 0xc5, 0x1b } };
|
static const effect_uuid_t SL_IID_BASSBOOST_ = { 0x0634f220, 0xddd4, 0x11db, 0xa0fc,
|
||||||
|
{ 0x00, 0x02, 0xa5, 0xd5, 0xc5, 0x1b } };
|
||||||
const effect_uuid_t * const SL_IID_BASSBOOST = &SL_IID_BASSBOOST_;
|
const effect_uuid_t * const SL_IID_BASSBOOST = &SL_IID_BASSBOOST_;
|
||||||
|
|
||||||
static const effect_uuid_t SL_IID_EQUALIZER_ = { 0x0bed4300, 0xddd6, 0x11db, 0x8f34, { 0x00, 0x02, 0xa5, 0xd5, 0xc5, 0x1b } };
|
static const effect_uuid_t SL_IID_EQUALIZER_ = { 0x0bed4300, 0xddd6, 0x11db, 0x8f34,
|
||||||
|
{ 0x00, 0x02, 0xa5, 0xd5, 0xc5, 0x1b } };
|
||||||
const effect_uuid_t * const SL_IID_EQUALIZER = &SL_IID_EQUALIZER_;
|
const effect_uuid_t * const SL_IID_EQUALIZER = &SL_IID_EQUALIZER_;
|
||||||
|
|
||||||
static const effect_uuid_t SL_IID_VIRTUALIZER_ = { 0x37cc2c00, 0xdddd, 0x11db, 0x8577, { 0x00, 0x02, 0xa5, 0xd5, 0xc5, 0x1b } }; // updated mon 28th june 2010
|
static const effect_uuid_t SL_IID_VIRTUALIZER_ = { 0x37cc2c00, 0xdddd, 0x11db, 0x8577,
|
||||||
|
{ 0x00, 0x02, 0xa5, 0xd5, 0xc5, 0x1b } };
|
||||||
const effect_uuid_t * const SL_IID_VIRTUALIZER = &SL_IID_VIRTUALIZER_;
|
const effect_uuid_t * const SL_IID_VIRTUALIZER = &SL_IID_VIRTUALIZER_;
|
||||||
|
|
||||||
static const effect_uuid_t SL_IID_VOLUME_ = { 0x09e8ede0, 0xddde, 0x11db, 0xb4f6, { 0x00, 0x02, 0xa5, 0xd5, 0xc5, 0x1b } }; // updated mon 28th june 2010
|
static const effect_uuid_t SL_IID_VOLUME_ = { 0x09e8ede0, 0xddde, 0x11db, 0xb4f6,
|
||||||
|
{ 0x00, 0x02, 0xa5, 0xd5, 0xc5, 0x1b } };
|
||||||
const effect_uuid_t * const SL_IID_VOLUME = &SL_IID_VOLUME_;
|
const effect_uuid_t * const SL_IID_VOLUME = &SL_IID_VOLUME_;
|
||||||
|
|
||||||
typedef enum
|
typedef enum
|
||||||
{
|
{
|
||||||
LVM_BASS_BOOST,
|
LVM_BASS_BOOST,
|
||||||
LVM_VIRTUALIZER,
|
LVM_VIRTUALIZER,
|
||||||
LVM_EQUALIZER,
|
LVM_EQUALIZER,
|
||||||
LVM_VOLUME
|
LVM_VOLUME
|
||||||
} lvm_effect_en;
|
} lvm_effect_en;
|
||||||
|
|
||||||
@@ -60,41 +65,51 @@ struct PresetConfig {
|
|||||||
|
|
||||||
/* BundledEffectContext : One per session */
|
/* BundledEffectContext : One per session */
|
||||||
struct BundledEffectContext{
|
struct BundledEffectContext{
|
||||||
LVM_Handle_t hInstance; /* Instance handle */
|
LVM_Handle_t hInstance; /* Instance handle */
|
||||||
int SessionNo; /* Current session number */
|
int SessionNo; /* Current session number */
|
||||||
bool bVolumeEnabled; /* Flag for Volume */
|
bool bVolumeEnabled; /* Flag for Volume */
|
||||||
bool bEqualizerEnabled; /* Flag for EQ */
|
bool bEqualizerEnabled; /* Flag for EQ */
|
||||||
bool bBassEnabled; /* Flag for Bass */
|
bool bBassEnabled; /* Flag for Bass */
|
||||||
bool bVirtualizerEnabled; /* Flag for Virtualizer */
|
bool bBassTempDisabled; /* Flag for Bass to be re-enabled */
|
||||||
int NumberEffectsEnabled; /* Effects in this session */
|
bool bVirtualizerEnabled; /* Flag for Virtualizer */
|
||||||
int NumberEffectsCalled; /* Effects called so far */
|
bool bVirtualizerTempDisabled; /* Flag for effect to be re-enabled */
|
||||||
|
int NumberEffectsEnabled; /* Effects in this session */
|
||||||
|
int NumberEffectsCalled; /* Effects called so far */
|
||||||
// Saved parameters for each effect */
|
// Saved parameters for each effect */
|
||||||
// Bass Boost
|
// Bass Boost
|
||||||
int BassStrengthSaved; /* Conversion between Get/Set */
|
int BassStrengthSaved; /* Conversion between Get/Set */
|
||||||
// Equalizer
|
// Equalizer
|
||||||
int CurPreset; /* Current preset being used */
|
int CurPreset; /* Current preset being used */
|
||||||
// Virtualzer
|
// Virtualzer
|
||||||
int VirtStrengthSaved; /* Conversion between Get/Set */
|
int VirtStrengthSaved; /* Conversion between Get/Set */
|
||||||
// Volume
|
// Volume
|
||||||
int levelSaved; /* for when mute is set, level must be saved */
|
int levelSaved; /* for when mute is set, level must be saved */
|
||||||
bool bMuteEnabled; /* Must store as mute = -96dB level */
|
int positionSaved;
|
||||||
|
bool bMuteEnabled; /* Must store as mute = -96dB level */
|
||||||
|
bool bStereoPositionEnabled;
|
||||||
|
int frameCount;
|
||||||
|
LVM_Fs_en SampleRate;
|
||||||
|
#ifdef LVM_PCM
|
||||||
|
FILE *PcmInPtr;
|
||||||
|
FILE *PcmOutPtr;
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
/* SessionContext : One session */
|
/* SessionContext : One session */
|
||||||
struct SessionContext{
|
struct SessionContext{
|
||||||
bool bBundledEffectsEnabled;
|
bool bBundledEffectsEnabled;
|
||||||
bool bVolumeInstantiated;
|
bool bVolumeInstantiated;
|
||||||
bool bEqualizerInstantiated;
|
bool bEqualizerInstantiated;
|
||||||
bool bBassInstantiated;
|
bool bBassInstantiated;
|
||||||
bool bVirtualizerInstantiated;
|
bool bVirtualizerInstantiated;
|
||||||
BundledEffectContext *pBundledContext;
|
BundledEffectContext *pBundledContext;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct EffectContext{
|
struct EffectContext{
|
||||||
const struct effect_interface_s *itfe;
|
const struct effect_interface_s *itfe;
|
||||||
effect_config_t config;
|
effect_config_t config;
|
||||||
lvm_effect_en EffectType;
|
lvm_effect_en EffectType;
|
||||||
BundledEffectContext *pBundledContext;
|
BundledEffectContext *pBundledContext;
|
||||||
};
|
};
|
||||||
|
|
||||||
//TODO: this should be included from each effect API include
|
//TODO: this should be included from each effect API include
|
||||||
@@ -115,15 +130,15 @@ typedef enum
|
|||||||
/* enumerated parameter settings for Equalizer effect */
|
/* enumerated parameter settings for Equalizer effect */
|
||||||
typedef enum
|
typedef enum
|
||||||
{
|
{
|
||||||
EQ_PARAM_NUM_BANDS, // Gets the number of frequency bands that the equalizer supports.
|
EQ_PARAM_NUM_BANDS, // Gets the number of frequency bands that the equalizer supports.
|
||||||
EQ_PARAM_LEVEL_RANGE, // Returns the minimum and maximum band levels supported.
|
EQ_PARAM_LEVEL_RANGE, // Returns the minimum and maximum band levels supported.
|
||||||
EQ_PARAM_BAND_LEVEL, // Gets/Sets the gain set for the given equalizer band.
|
EQ_PARAM_BAND_LEVEL, // Gets/Sets the gain set for the given equalizer band.
|
||||||
EQ_PARAM_CENTER_FREQ, // Gets the center frequency of the given band.
|
EQ_PARAM_CENTER_FREQ, // Gets the center frequency of the given band.
|
||||||
EQ_PARAM_BAND_FREQ_RANGE, // Gets the frequency range of the given frequency band.
|
EQ_PARAM_BAND_FREQ_RANGE, // Gets the frequency range of the given frequency band.
|
||||||
EQ_PARAM_GET_BAND, // Gets the band that has the most effect on the given frequency.
|
EQ_PARAM_GET_BAND, // Gets the band that has the most effect on the given frequency.
|
||||||
EQ_PARAM_CUR_PRESET, // Gets/Sets the current preset.
|
EQ_PARAM_CUR_PRESET, // Gets/Sets the current preset.
|
||||||
EQ_PARAM_GET_NUM_OF_PRESETS, // Gets the total number of presets the equalizer supports.
|
EQ_PARAM_GET_NUM_OF_PRESETS, // Gets the total number of presets the equalizer supports.
|
||||||
EQ_PARAM_GET_PRESET_NAME // Gets the preset name based on the index.
|
EQ_PARAM_GET_PRESET_NAME // Gets the preset name based on the index.
|
||||||
} t_equalizer_params;
|
} t_equalizer_params;
|
||||||
|
|
||||||
/* enumerated parameter settings for Volume effect */
|
/* enumerated parameter settings for Volume effect */
|
||||||
@@ -139,29 +154,28 @@ typedef enum
|
|||||||
static const int PRESET_CUSTOM = -1;
|
static const int PRESET_CUSTOM = -1;
|
||||||
|
|
||||||
static const uint32_t bandFreqRange[FIVEBAND_NUMBANDS][2] = {
|
static const uint32_t bandFreqRange[FIVEBAND_NUMBANDS][2] = {
|
||||||
{30000, 120000},
|
{30000, 120000},
|
||||||
{12000, 460000},
|
{120001, 460000},
|
||||||
{46000, 1800000},
|
{460001, 1800000},
|
||||||
{180000, 7000000},
|
{1800001, 7000000},
|
||||||
{700000, 1}
|
{7000001, 1}};
|
||||||
};
|
|
||||||
|
|
||||||
static const LVM_UINT16 EQNB_5BandPresetsFrequencies[] = {
|
static const LVM_UINT16 EQNB_5BandPresetsFrequencies[] = {
|
||||||
60, /* Frequencies in Hz */
|
60, /* Frequencies in Hz */
|
||||||
230,
|
230,
|
||||||
910,
|
910,
|
||||||
3600,
|
3600,
|
||||||
14000};
|
14000};
|
||||||
|
|
||||||
static const LVM_UINT16 EQNB_5BandPresetsQFactors[] = {
|
static const LVM_UINT16 EQNB_5BandPresetsQFactors[] = {
|
||||||
96, /* Q factor multiplied by 100 */
|
96, /* Q factor multiplied by 100 */
|
||||||
96,
|
96,
|
||||||
96,
|
96,
|
||||||
96,
|
96,
|
||||||
96};
|
96};
|
||||||
|
|
||||||
static const LVM_INT16 EQNB_5BandNormalPresets[] = {
|
static const LVM_INT16 EQNB_5BandNormalPresets[] = {
|
||||||
3, 0, 0, 0, 3, /* Normal Preset */
|
3, 0, 0, 0, 3, /* Normal Preset */
|
||||||
8, 5, -3, 5, 6, /* Classical Preset */
|
8, 5, -3, 5, 6, /* Classical Preset */
|
||||||
15, -6, 7, 13, 10, /* Dance Preset */
|
15, -6, 7, 13, 10, /* Dance Preset */
|
||||||
0, 0, 0, 0, 0, /* Flat Preset */
|
0, 0, 0, 0, 0, /* Flat Preset */
|
||||||
@@ -172,18 +186,29 @@ static const LVM_INT16 EQNB_5BandNormalPresets[] = {
|
|||||||
-6, 4, 9, 4, -5, /* Pop Preset */
|
-6, 4, 9, 4, -5, /* Pop Preset */
|
||||||
10, 6, -1, 8, 10}; /* Rock Preset */
|
10, 6, -1, 8, 10}; /* Rock Preset */
|
||||||
|
|
||||||
|
static const LVM_INT16 EQNB_5BandSoftPresets[] = {
|
||||||
|
3, 0, 0, 0, 3, /* Normal Preset */
|
||||||
|
5, 3, -2, 4, 4, /* Classical Preset */
|
||||||
|
6, 0, 2, 4, 1, /* Dance Preset */
|
||||||
|
0, 0, 0, 0, 0, /* Flat Preset */
|
||||||
|
3, 0, 0, 2, -1, /* Folk Preset */
|
||||||
|
4, 1, 9, 3, 0, /* Heavy Metal Preset */
|
||||||
|
5, 3, 0, 1, 3, /* Hip Hop Preset */
|
||||||
|
4, 2, -2, 2, 5, /* Jazz Preset */
|
||||||
|
-1, 2, 5, 1, -2, /* Pop Preset */
|
||||||
|
5, 3, -1, 3, 5}; /* Rock Preset */
|
||||||
|
|
||||||
static const PresetConfig gEqualizerPresets[] = {
|
static const PresetConfig gEqualizerPresets[] = {
|
||||||
{"Normal"},
|
{"Normal"},
|
||||||
{"Classical"},
|
{"Classical"},
|
||||||
{"Dance"},
|
{"Dance"},
|
||||||
{"Flat"},
|
{"Flat"},
|
||||||
{"Folk"},
|
{"Folk"},
|
||||||
{"Heavy Metal"},
|
{"Heavy Metal"},
|
||||||
{"Hip Hop"},
|
{"Hip Hop"},
|
||||||
{"Jazz"},
|
{"Jazz"},
|
||||||
{"Pop"},
|
{"Pop"},
|
||||||
{"Rock"}
|
{"Rock"}};
|
||||||
};
|
|
||||||
|
|
||||||
#if __cplusplus
|
#if __cplusplus
|
||||||
} // extern "C"
|
} // extern "C"
|
||||||
|
|||||||
Reference in New Issue
Block a user