1
0
Fork 0
forked from len0rd/rockbox

The beginnings of loadable EQ's from the tree. Ifdef'd as CUSTOM_EQ

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@2177 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Justin Heiner 2002-09-05 01:20:10 +00:00
parent e07a97ed00
commit e4a27617c0
3 changed files with 93 additions and 0 deletions

View file

@ -394,6 +394,75 @@ void settings_load(void)
#endif
}
#ifdef CUSTOM_EQ
/ *
* Loads a .eq file
* /
bool settings_load_eq(char* file)
{
char buffer[128];
char buf_set[16];
char buf_val[8];
int fd;
int i;
unsigned int j;
int d = 0;
int vtype = 0;
fd = open(file, O_RDONLY);
if (-1 != fd)
{
int numread = read(fd, buffer, sizeof(buffer) - 1);
if (numread > 0) {
buffer[numread] = 0;
for(i=0;i<numread;i++) {
switch(buffer[i]) {
case '[':
vtype = 1;
buf_set[0] = 0;
d = 0;
break;
case ']':
vtype = 2;
buf_set[d] = 0;
buf_val[0] = 0;
d = 0;
break;
case '#':
buf_val[d] = 0;
vtype = 3;
break;
default:
switch(vtype) {
case 1:
buf_set[d++] = buffer[i];
break;
case 2:
buf_val[d++] = buffer[i];
break;
case 3:
if(strcasecmp(buf_set,"volume"))
{
global_settings.volume = 0;
for(j=0;j<strlen(buf_val);j++)
global_settings.volume = global_settings.volume *
10 + (buf_val[j] - '0');
}
vtype = 0;
break;
}
break;
}
}
}
close(fd);
}
return(false);
}
#endif
/*
* reset all settings to their default value
*/

View file

@ -105,6 +105,8 @@ void settings_load(void);
void settings_reset(void);
void settings_display(void);
bool settings_load_eq(char* file);
void set_bool(char* string, bool* variable );
void set_option(char* string, int* variable, char* options[], int numoptions );
void set_int(char* string,

View file

@ -132,6 +132,9 @@ 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)
@ -239,6 +242,10 @@ 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
@ -320,6 +327,12 @@ 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;
break;
@ -608,6 +621,15 @@ 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 */
case TREE_ATTR_MOD: