The simulator should use the keypad period key, not the regular one
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@8568 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
2fcd1b09d4
commit
621bcc2294
10 changed files with 176 additions and 7 deletions
|
@ -78,4 +78,5 @@ eq_cf.S
|
|||
#elif defined(CPU_ARM) && !defined(SIMULATOR)
|
||||
eq_arm.S
|
||||
#endif
|
||||
eq_menu.c
|
||||
#endif
|
||||
|
|
58
apps/dsp.c
58
apps/dsp.c
|
@ -145,6 +145,7 @@ struct dsp_config
|
|||
bool dither_enabled;
|
||||
bool new_gain;
|
||||
bool crossfeed_enabled;
|
||||
bool eq_enabled;
|
||||
};
|
||||
|
||||
struct resample_data
|
||||
|
@ -618,6 +619,52 @@ static void apply_crossfeed(long* src[], int count)
|
|||
}
|
||||
#endif
|
||||
|
||||
#define EQ_CUTOFF_USER2REAL(x) (0xffffffff / dsp->frequency * (x))
|
||||
#define EQ_Q_USER2REAL(x) (((x) << 16) / 10)
|
||||
#define EQ_GAIN_USER2REAL(x) (((x) << 16) / 10)
|
||||
|
||||
/* Synchronize the EQ filters with the global settings */
|
||||
static void eq_update_data()
|
||||
{
|
||||
int i;
|
||||
int *setting;
|
||||
int gain, cutoff, q, maxgain;
|
||||
|
||||
/* Don't do anything if we're not playing */
|
||||
if (dsp->frequency == 0)
|
||||
return;
|
||||
|
||||
setting = &global_settings.eq_band0_cutoff;
|
||||
maxgain = 0;
|
||||
|
||||
/* Iterate over each band and update the appropriate filter */
|
||||
for(i = 0; i < 5; i++) {
|
||||
cutoff = *setting++;
|
||||
q = *setting++;
|
||||
gain = *setting++;
|
||||
|
||||
/* Keep track of maxgain for the pre-amp */
|
||||
if (gain > maxgain)
|
||||
maxgain = gain;
|
||||
|
||||
if (gain == 0) {
|
||||
eq_data.enabled[i] = 0;
|
||||
} else {
|
||||
if (i == 0)
|
||||
eq_ls_coefs(EQ_CUTOFF_USER2REAL(cutoff), EQ_Q_USER2REAL(q),
|
||||
EQ_GAIN_USER2REAL(gain), eq_data.filters[0].coefs);
|
||||
else if (i == 4)
|
||||
eq_hs_coefs(EQ_CUTOFF_USER2REAL(cutoff), EQ_Q_USER2REAL(q),
|
||||
EQ_GAIN_USER2REAL(gain), eq_data.filters[4].coefs);
|
||||
else
|
||||
eq_pk_coefs(EQ_CUTOFF_USER2REAL(cutoff), EQ_Q_USER2REAL(q),
|
||||
EQ_GAIN_USER2REAL(gain), eq_data.filters[i].coefs);
|
||||
|
||||
eq_data.enabled[i] = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Apply EQ filters to those bands that have got it switched on. */
|
||||
static void eq_process(long **x, unsigned num)
|
||||
{
|
||||
|
@ -737,6 +784,9 @@ long dsp_process(char* dst, char* src[], long size)
|
|||
size /= dsp->sample_bytes * factor;
|
||||
dsp_set_replaygain(false);
|
||||
|
||||
if (dsp->eq_enabled)
|
||||
eq_update_data();
|
||||
|
||||
while (size > 0)
|
||||
{
|
||||
samples = convert_to_internal(src, size, tmp);
|
||||
|
@ -745,8 +795,7 @@ long dsp_process(char* dst, char* src[], long size)
|
|||
samples = resample(tmp, samples);
|
||||
if (dsp->crossfeed_enabled && dsp->stereo_mode != STEREO_MONO)
|
||||
apply_crossfeed(tmp, samples);
|
||||
/* TODO: Might want to wrap this with a generic eq_enabled when the
|
||||
settings are in place */
|
||||
if (dsp->eq_enabled)
|
||||
eq_process(tmp, samples);
|
||||
write_samples((short*) dst, tmp, samples);
|
||||
written += samples;
|
||||
|
@ -943,6 +992,11 @@ bool dsp_configure(int setting, void *value)
|
|||
return 1;
|
||||
}
|
||||
|
||||
void dsp_set_eq(bool enable)
|
||||
{
|
||||
dsp->eq_enabled = enable;
|
||||
}
|
||||
|
||||
void dsp_set_crossfeed(bool enable)
|
||||
{
|
||||
if (enable)
|
||||
|
|
|
@ -54,6 +54,7 @@ int dsp_stereo_mode(void);
|
|||
bool dsp_configure(int setting, void *value);
|
||||
void dsp_set_replaygain(bool always);
|
||||
void dsp_set_crossfeed(bool enable);
|
||||
void dsp_set_eq(bool enable);
|
||||
void sound_set_pitch(int r);
|
||||
int sound_get_pitch(void);
|
||||
#endif
|
||||
|
|
|
@ -32,11 +32,11 @@
|
|||
*/
|
||||
|
||||
#define DIV64(x, y, z) (long)(((long long)(x) << (z))/(y))
|
||||
/* TODO: This macro requires the EMAC unit to be in fractional mode
|
||||
when the coef generator routines are called. If this can be guaranteeed,
|
||||
then remove the "&& 0" below for faster coef calculation on Coldfire.
|
||||
/* This macro requires the EMAC unit to be in fractional mode
|
||||
when the coef generator routines are called. If this can't be guaranteeed,
|
||||
then add "&& 0" below. This will use a slower coef calculation on Coldfire.
|
||||
*/
|
||||
#if defined(CPU_COLDFIRE) && !defined(SIMULATOR) && 0
|
||||
#if defined(CPU_COLDFIRE) && !defined(SIMULATOR)
|
||||
#define FRACMUL(x, y) \
|
||||
({ \
|
||||
long t; \
|
||||
|
|
|
@ -3599,3 +3599,57 @@ eng: "Backdrop failed"
|
|||
voice: "Backdrop failed"
|
||||
new:
|
||||
|
||||
id: LANG_EQUALIZER
|
||||
desc: in the sound settings menu
|
||||
eng: "Equalizer"
|
||||
voice: "Equalizer"
|
||||
new:
|
||||
|
||||
id: LANG_EQUALIZER_SETTINGS
|
||||
desc: in the equalizer menu
|
||||
eng: "Browse EQ Presets"
|
||||
voice: "Browse EQ Presets"
|
||||
new:
|
||||
|
||||
id: LANG_EQUALIZER_GRAPHICAL
|
||||
desc: in the equalizer menu
|
||||
eng: "Graphical EQ"
|
||||
voice: "Graphical EQ"
|
||||
new:
|
||||
|
||||
id: LANG_EQUALIZER_GAIN
|
||||
desc: in the equalizer menu
|
||||
eng: "EQ Gain"
|
||||
voice: "EQ Gain"
|
||||
new:
|
||||
|
||||
id: LANG_EQUALIZER_GAIN_ITEM
|
||||
desc: in the equalizer menu
|
||||
eng: "%d Hz Band Gain"
|
||||
voice: ""
|
||||
new:
|
||||
|
||||
id: LANG_EQUALIZER_ADVANCED
|
||||
desc: in the equalizer menu
|
||||
eng: "EQ Advanced Settings"
|
||||
voice: "EQ Advanced Settings"
|
||||
new:
|
||||
|
||||
id: LANG_EQUALIZER_BAND_CUTOFF
|
||||
desc: in the equalizer menu
|
||||
eng: "Cutoff"
|
||||
voice: "Cutoff"
|
||||
new:
|
||||
|
||||
id: LANG_EQUALIZER_BAND_Q
|
||||
desc: in the equalizer menu
|
||||
eng: "Q"
|
||||
voice: "Q"
|
||||
new:
|
||||
|
||||
id: LANG_EQUALIZER_BAND_GAIN
|
||||
desc: in the equalizer menu
|
||||
eng: "Gain"
|
||||
voice: "Gain"
|
||||
new:
|
||||
|
||||
|
|
|
@ -508,6 +508,28 @@ static const struct bit_entry hd_bits[] =
|
|||
#endif
|
||||
#endif /* HAVE_LCD_BITMAP */
|
||||
|
||||
#if CONFIG_CODEC == SWCODEC
|
||||
{1, S_O(eq_enabled), false, "eq enabled", off_on },
|
||||
/* 0..32768 Hz */
|
||||
{15, S_O(eq_band0_cutoff), 60, "eq band 0 cutoff", NULL },
|
||||
{15, S_O(eq_band1_cutoff), 200, "eq band 1 cutoff", NULL },
|
||||
{15, S_O(eq_band2_cutoff), 800, "eq band 2 cutoff", NULL },
|
||||
{15, S_O(eq_band3_cutoff), 4000, "eq band 3 cutoff", NULL },
|
||||
{15, S_O(eq_band4_cutoff), 12000, "eq band 4 cutoff", NULL },
|
||||
/* 0..64 (or 0.0 to 6.4) */
|
||||
{6, S_O(eq_band0_q), 7, "eq band 0 q", NULL },
|
||||
{6, S_O(eq_band1_q), 10, "eq band 1 q", NULL },
|
||||
{6, S_O(eq_band2_q), 10, "eq band 2 q", NULL },
|
||||
{6, S_O(eq_band3_q), 10, "eq band 3 q", NULL },
|
||||
{6, S_O(eq_band4_q), 7, "eq band 4 q", NULL },
|
||||
/* -240..240 (or -24db to +24db) */
|
||||
{9|SIGNED, S_O(eq_band0_gain), 0, "eq band 0 gain", NULL },
|
||||
{9|SIGNED, S_O(eq_band1_gain), 0, "eq band 1 gain", NULL },
|
||||
{9|SIGNED, S_O(eq_band2_gain), 0, "eq band 2 gain", NULL },
|
||||
{9|SIGNED, S_O(eq_band3_gain), 0, "eq band 3 gain", NULL },
|
||||
{9|SIGNED, S_O(eq_band4_gain), 0, "eq band 4 gain", NULL },
|
||||
#endif
|
||||
|
||||
/* If values are just added to the end, no need to bump the version. */
|
||||
/* new stuff to be added at the end */
|
||||
|
||||
|
|
|
@ -39,6 +39,7 @@
|
|||
#define PLUGIN_DIR ROCKBOX_DIR"/rocks"
|
||||
#define BACKDROP_DIR ROCKBOX_DIR"/backdrops"
|
||||
#define REC_BASE_DIR "/recordings"
|
||||
#define EQS_DIR ROCKBOX_DIR "/eqs"
|
||||
|
||||
#define MAX_FILENAME 20
|
||||
|
||||
|
@ -408,6 +409,39 @@ struct user_settings
|
|||
int brightness; /* iriver h300: backlight PWM value: 2..15
|
||||
(0 and 1 are black) */
|
||||
#endif
|
||||
|
||||
#if CONFIG_CODEC == SWCODEC
|
||||
bool eq_enabled; /* Enable equalizer */
|
||||
|
||||
/* Order is important here, must be cutoff, q, then gain for each band.
|
||||
See dsp_eq_update_data in dsp.c for why. */
|
||||
|
||||
/* Band 0 settings */
|
||||
int eq_band0_cutoff; /* Hz */
|
||||
int eq_band0_q;
|
||||
int eq_band0_gain; /* +/- dB */
|
||||
|
||||
/* Band 1 settings */
|
||||
int eq_band1_cutoff; /* Hz */
|
||||
int eq_band1_q;
|
||||
int eq_band1_gain; /* +/- dB */
|
||||
|
||||
/* Band 2 settings */
|
||||
int eq_band2_cutoff; /* Hz */
|
||||
int eq_band2_q;
|
||||
int eq_band2_gain; /* +/- dB */
|
||||
|
||||
/* Band 3 settings */
|
||||
int eq_band3_cutoff; /* Hz */
|
||||
int eq_band3_q;
|
||||
int eq_band3_gain; /* +/- dB */
|
||||
|
||||
/* Band 4 settings */
|
||||
int eq_band4_cutoff; /* Hz */
|
||||
int eq_band4_q;
|
||||
int eq_band4_gain; /* +/- dB */
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_LCD_COLOR
|
||||
unsigned char backdrop_file[MAX_FILENAME+1]; /* backdrop bitmap file */
|
||||
#endif
|
||||
|
|
|
@ -45,6 +45,7 @@
|
|||
#include "splash.h"
|
||||
#if CONFIG_CODEC == SWCODEC
|
||||
#include "dsp.h"
|
||||
#include "eq_menu.h"
|
||||
#endif
|
||||
|
||||
int selected_setting; /* Used by the callback */
|
||||
|
@ -379,6 +380,7 @@ bool sound_menu(void)
|
|||
{ ID2P(LANG_STEREO_WIDTH), stereo_width },
|
||||
#if CONFIG_CODEC == SWCODEC
|
||||
{ ID2P(LANG_CROSSFEED), crossfeed },
|
||||
{ ID2P(LANG_EQUALIZER), eq_menu },
|
||||
#endif
|
||||
#if (CONFIG_CODEC == MAS3587F) || (CONFIG_CODEC == MAS3539F)
|
||||
{ ID2P(LANG_LOUDNESS), loudness },
|
||||
|
|
|
@ -91,6 +91,7 @@ sub buildzip {
|
|||
mkdir ".rockbox/wps", 0777;
|
||||
mkdir ".rockbox/themes", 0777;
|
||||
mkdir ".rockbox/backdrops", 0777;
|
||||
mkdir ".rockbox/eqs", 0777;
|
||||
|
||||
my $c = 'find apps -name "*.codec" ! -empty -exec cp {} .rockbox/codecs/ \;';
|
||||
print `$c`;
|
||||
|
|
|
@ -135,7 +135,7 @@ void button_event(int key, bool pressed)
|
|||
break;
|
||||
#endif
|
||||
|
||||
case SDLK_PERIOD:
|
||||
case SDLK_KP_PERIOD:
|
||||
case SDLK_INSERT:
|
||||
#ifdef BUTTON_MENU
|
||||
new_btn = BUTTON_MENU;
|
||||
|
|
Loading…
Reference in a new issue