Audio effects: lvm bundle wrapper update after first integration tests.

Change-Id: I20cb55282833bd6e3a160e0dae1cc1fcb6b1ca30
This commit is contained in:
Eric Laurent
2010-07-23 00:54:58 -07:00
parent 4782cdbbbe
commit 021697ad3d
2 changed files with 1071 additions and 738 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -27,25 +27,30 @@ extern "C" {
#define FIVEBAND_NUMBANDS 5
#define MAX_NUM_BANDS 5
#define MAX_CALL_SIZE 256
//#define LVM_PCM
//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_;
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_;
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_;
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_;
typedef enum
{
LVM_BASS_BOOST,
LVM_VIRTUALIZER,
LVM_EQUALIZER,
LVM_EQUALIZER,
LVM_VOLUME
} lvm_effect_en;
@@ -60,41 +65,51 @@ struct PresetConfig {
/* BundledEffectContext : One per session */
struct BundledEffectContext{
LVM_Handle_t hInstance; /* Instance handle */
int SessionNo; /* Current session number */
bool bVolumeEnabled; /* Flag for Volume */
bool bEqualizerEnabled; /* Flag for EQ */
bool bBassEnabled; /* Flag for Bass */
bool bVirtualizerEnabled; /* Flag for Virtualizer */
int NumberEffectsEnabled; /* Effects in this session */
int NumberEffectsCalled; /* Effects called so far */
LVM_Handle_t hInstance; /* Instance handle */
int SessionNo; /* Current session number */
bool bVolumeEnabled; /* Flag for Volume */
bool bEqualizerEnabled; /* Flag for EQ */
bool bBassEnabled; /* Flag for Bass */
bool bBassTempDisabled; /* Flag for Bass to be re-enabled */
bool bVirtualizerEnabled; /* Flag for Virtualizer */
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 */
// Bass Boost
int BassStrengthSaved; /* Conversion between Get/Set */
int BassStrengthSaved; /* Conversion between Get/Set */
// Equalizer
int CurPreset; /* Current preset being used */
int CurPreset; /* Current preset being used */
// Virtualzer
int VirtStrengthSaved; /* Conversion between Get/Set */
int VirtStrengthSaved; /* Conversion between Get/Set */
// Volume
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 */
struct SessionContext{
bool bBundledEffectsEnabled;
bool bVolumeInstantiated;
bool bVolumeInstantiated;
bool bEqualizerInstantiated;
bool bBassInstantiated;
bool bVirtualizerInstantiated;
BundledEffectContext *pBundledContext;
bool bVirtualizerInstantiated;
BundledEffectContext *pBundledContext;
};
struct EffectContext{
const struct effect_interface_s *itfe;
effect_config_t config;
lvm_effect_en EffectType;
BundledEffectContext *pBundledContext;
BundledEffectContext *pBundledContext;
};
//TODO: this should be included from each effect API include
@@ -115,15 +130,15 @@ typedef enum
/* enumerated parameter settings for Equalizer effect */
typedef enum
{
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_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_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_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_PRESET_NAME // Gets the preset name based on the index.
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_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_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_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_PRESET_NAME // Gets the preset name based on the index.
} t_equalizer_params;
/* enumerated parameter settings for Volume effect */
@@ -139,29 +154,28 @@ typedef enum
static const int PRESET_CUSTOM = -1;
static const uint32_t bandFreqRange[FIVEBAND_NUMBANDS][2] = {
{30000, 120000},
{12000, 460000},
{46000, 1800000},
{180000, 7000000},
{700000, 1}
};
{30000, 120000},
{120001, 460000},
{460001, 1800000},
{1800001, 7000000},
{7000001, 1}};
static const LVM_UINT16 EQNB_5BandPresetsFrequencies[] = {
60, /* Frequencies in Hz */
230,
910,
3600,
14000};
60, /* Frequencies in Hz */
230,
910,
3600,
14000};
static const LVM_UINT16 EQNB_5BandPresetsQFactors[] = {
96, /* Q factor multiplied by 100 */
96,
96,
96,
96};
96, /* Q factor multiplied by 100 */
96,
96,
96,
96};
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 */
15, -6, 7, 13, 10, /* Dance 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 */
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[] = {
{"Normal"},
{"Classical"},
{"Dance"},
{"Flat"},
{"Folk"},
{"Heavy Metal"},
{"Hip Hop"},
{"Jazz"},
{"Pop"},
{"Rock"}
};
{"Normal"},
{"Classical"},
{"Dance"},
{"Flat"},
{"Folk"},
{"Heavy Metal"},
{"Hip Hop"},
{"Jazz"},
{"Pop"},
{"Rock"}};
#if __cplusplus
} // extern "C"