1
0
Fork 0
forked from len0rd/rockbox

Custom EQ files can now be loaded (*.eq). Docs coming soon :)

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@2197 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Justin Heiner 2002-09-06 06:02:02 +00:00
parent 221c4a250d
commit 4bd90cc2ca
2 changed files with 35 additions and 17 deletions

View file

@ -395,7 +395,6 @@ void settings_load(void)
#endif
}
#ifdef CUSTOM_EQ
/*
* Loads a .eq file
*/
@ -405,6 +404,7 @@ bool settings_load_eq(char* file)
char buf_set[16];
char buf_disp[16];
char buf_val[8];
bool syntax_error = false;
int fd;
int i;
int d = 0;
@ -452,24 +452,51 @@ bool settings_load_eq(char* file)
sleep(HZ/2);
if (!strcasecmp(buf_set,"volume")) {
global_settings.volume = (atoi(buf_val)/2);
if(global_settings.volume > mpeg_sound_max(SOUND_VOLUME) ||
global_settings.volume < mpeg_sound_min(SOUND_VOLUME)) {
global_settings.volume = mpeg_sound_default(SOUND_VOLUME);
syntax_error = true;
}
} else
if (!strcasecmp(buf_set,"bass")) {
if (buf_val[0] == '-')
global_settings.bass = mpeg_val2phys(SOUND_BASS,(15-atoi(buf_val+1)));
global_settings.bass = ((mpeg_sound_max(SOUND_BASS)/2)-atoi(buf_val+1));
else
global_settings.bass = mpeg_val2phys(SOUND_BASS,(atoi(buf_val)+15));
global_settings.bass = (atoi(buf_val)+(mpeg_sound_max(SOUND_BASS)/2));
if (global_settings.bass > mpeg_sound_max(SOUND_BASS) ||
global_settings.bass < mpeg_sound_min(SOUND_BASS)) {
global_settings.bass = mpeg_sound_default(SOUND_BASS);
syntax_error = true;
}
} else
if (!strcasecmp(buf_set,"treble")) {
if (buf_val[0] == '-')
global_settings.treble = (15-atoi(buf_val+1));
global_settings.treble = ((mpeg_sound_max(SOUND_TREBLE)/2)-atoi(buf_val+1));
else
global_settings.treble = (atoi(buf_val)+15);
}
global_settings.treble = (atoi(buf_val)+(mpeg_sound_max(SOUND_TREBLE)/2));
if (global_settings.treble > mpeg_sound_max(SOUND_TREBLE) ||
global_settings.treble < mpeg_sound_min(SOUND_TREBLE)) {
global_settings.treble = mpeg_sound_default(SOUND_TREBLE);
syntax_error = true;
}
} else
if (!strcasecmp(buf_set,"balance")) {
if (buf_val[0] == '-')
global_settings.balance = (25-(atoi(buf_val+1)/2));
global_settings.balance = ((mpeg_sound_max(SOUND_BALANCE)/2)-(atoi(buf_val+1)/2));
else
global_settings.balance = ((atoi(buf_val)/2)+25);
global_settings.balance = ((atoi(buf_val)/2)+(mpeg_sound_max(SOUND_BALANCE)/2));
if (global_settings.balance > mpeg_sound_max(SOUND_BALANCE) ||
global_settings.balance < mpeg_sound_min(SOUND_BALANCE)) {
global_settings.balance = mpeg_sound_default(SOUND_BALANCE);
syntax_error = true;
}
}
if (syntax_error) {
lcd_clear_display();
lcd_puts(0,0,"SyntaxError");
lcd_puts(0,1,buf_set);
sleep(HZ);
syntax_error = false;
}
vtype = 0;
break;
@ -482,7 +509,6 @@ bool settings_load_eq(char* file)
}
return(false);
}
#endif
/*
* reset all settings to their default value

View file

@ -132,9 +132,7 @@ extern unsigned char bitmap_icons_6x8[LastIcon][6];
#define TREE_ATTR_M3U 0x80 /* playlist */
#define TREE_ATTR_WPS 0x100 /* wps config file */
#define TREE_ATTR_MOD 0x200 /* firmware file */
#ifdef CUSTOM_EQ
#define TREE_ATTR_EQ 0x300 /* EQ config file */
#endif
#define TREE_ATTR_MASK 0xffd0 /* which bits tree.c uses (above + DIR) */
static int build_playlist(int start_index)
@ -248,10 +246,8 @@ static int showdir(char *path, int start)
dptr->attr |= TREE_ATTR_MPA;
else if (!strcasecmp(&entry->d_name[len-4], ".m3u"))
dptr->attr |= TREE_ATTR_M3U;
#ifdef CUSTOM_EQ
else if (!strcasecmp(&entry->d_name[len-3], ".eq"))
dptr->attr |= TREE_ATTR_EQ;
#endif
else if (!strcasecmp(&entry->d_name[len-4], ".wps"))
dptr->attr |= TREE_ATTR_WPS;
#ifdef HAVE_RECORDER_KEYPAD
@ -333,11 +329,9 @@ static int showdir(char *path, int start)
icon_type = Wps;
break;
#ifdef CUSTOM_EQ
case TREE_ATTR_EQ:
icon_type = Wps;
break;
#endif
case TREE_ATTR_MOD:
icon_type = Mod_Ajz;
@ -627,14 +621,12 @@ bool dirbrowse(char *root)
restore = true;
break;
#ifdef CUSTOM_EQ
case TREE_ATTR_EQ:
snprintf(buf, sizeof buf, "%s/%s",
currdir, file->name);
settings_load_eq(buf);
restore = true;
break;
#endif
#ifndef SIMULATOR
/* firmware file */