diff options
Diffstat (limited to 'apps')
-rw-r--r-- | apps/settings.c | 69 | ||||
-rw-r--r-- | apps/settings.h | 2 | ||||
-rw-r--r-- | apps/tree.c | 22 |
3 files changed, 93 insertions, 0 deletions
diff --git a/apps/settings.c b/apps/settings.c index fa9ba38106..1a020c305d 100644 --- a/apps/settings.c +++ b/apps/settings.c | |||
@@ -394,6 +394,75 @@ void settings_load(void) | |||
394 | #endif | 394 | #endif |
395 | } | 395 | } |
396 | 396 | ||
397 | #ifdef CUSTOM_EQ | ||
398 | / * | ||
399 | * Loads a .eq file | ||
400 | * / | ||
401 | bool settings_load_eq(char* file) | ||
402 | { | ||
403 | char buffer[128]; | ||
404 | char buf_set[16]; | ||
405 | char buf_val[8]; | ||
406 | int fd; | ||
407 | int i; | ||
408 | unsigned int j; | ||
409 | int d = 0; | ||
410 | int vtype = 0; | ||
411 | |||
412 | fd = open(file, O_RDONLY); | ||
413 | |||
414 | if (-1 != fd) | ||
415 | { | ||
416 | int numread = read(fd, buffer, sizeof(buffer) - 1); | ||
417 | |||
418 | if (numread > 0) { | ||
419 | buffer[numread] = 0; | ||
420 | for(i=0;i<numread;i++) { | ||
421 | switch(buffer[i]) { | ||
422 | case '[': | ||
423 | vtype = 1; | ||
424 | buf_set[0] = 0; | ||
425 | d = 0; | ||
426 | break; | ||
427 | case ']': | ||
428 | vtype = 2; | ||
429 | buf_set[d] = 0; | ||
430 | buf_val[0] = 0; | ||
431 | d = 0; | ||
432 | break; | ||
433 | case '#': | ||
434 | buf_val[d] = 0; | ||
435 | vtype = 3; | ||
436 | break; | ||
437 | default: | ||
438 | switch(vtype) { | ||
439 | case 1: | ||
440 | buf_set[d++] = buffer[i]; | ||
441 | break; | ||
442 | case 2: | ||
443 | buf_val[d++] = buffer[i]; | ||
444 | break; | ||
445 | case 3: | ||
446 | if(strcasecmp(buf_set,"volume")) | ||
447 | { | ||
448 | global_settings.volume = 0; | ||
449 | for(j=0;j<strlen(buf_val);j++) | ||
450 | global_settings.volume = global_settings.volume * | ||
451 | 10 + (buf_val[j] - '0'); | ||
452 | } | ||
453 | vtype = 0; | ||
454 | break; | ||
455 | } | ||
456 | break; | ||
457 | } | ||
458 | } | ||
459 | } | ||
460 | close(fd); | ||
461 | } | ||
462 | return(false); | ||
463 | } | ||
464 | #endif | ||
465 | |||
397 | /* | 466 | /* |
398 | * reset all settings to their default value | 467 | * reset all settings to their default value |
399 | */ | 468 | */ |
diff --git a/apps/settings.h b/apps/settings.h index 4cd7a5ff23..353b50abe9 100644 --- a/apps/settings.h +++ b/apps/settings.h | |||
@@ -105,6 +105,8 @@ void settings_load(void); | |||
105 | void settings_reset(void); | 105 | void settings_reset(void); |
106 | void settings_display(void); | 106 | void settings_display(void); |
107 | 107 | ||
108 | bool settings_load_eq(char* file); | ||
109 | |||
108 | void set_bool(char* string, bool* variable ); | 110 | void set_bool(char* string, bool* variable ); |
109 | void set_option(char* string, int* variable, char* options[], int numoptions ); | 111 | void set_option(char* string, int* variable, char* options[], int numoptions ); |
110 | void set_int(char* string, | 112 | void set_int(char* string, |
diff --git a/apps/tree.c b/apps/tree.c index a190d78ff5..73c75ba606 100644 --- a/apps/tree.c +++ b/apps/tree.c | |||
@@ -132,6 +132,9 @@ extern unsigned char bitmap_icons_6x8[LastIcon][6]; | |||
132 | #define TREE_ATTR_M3U 0x80 /* playlist */ | 132 | #define TREE_ATTR_M3U 0x80 /* playlist */ |
133 | #define TREE_ATTR_WPS 0x100 /* wps config file */ | 133 | #define TREE_ATTR_WPS 0x100 /* wps config file */ |
134 | #define TREE_ATTR_MOD 0x200 /* firmware file */ | 134 | #define TREE_ATTR_MOD 0x200 /* firmware file */ |
135 | #ifdef CUSTOM_EQ | ||
136 | #define TREE_ATTR_EQ 0x300 /* EQ config file */ | ||
137 | #endif | ||
135 | #define TREE_ATTR_MASK 0xffd0 /* which bits tree.c uses (above + DIR) */ | 138 | #define TREE_ATTR_MASK 0xffd0 /* which bits tree.c uses (above + DIR) */ |
136 | 139 | ||
137 | static int build_playlist(int start_index) | 140 | static int build_playlist(int start_index) |
@@ -239,6 +242,10 @@ static int showdir(char *path, int start) | |||
239 | dptr->attr |= TREE_ATTR_MPA; | 242 | dptr->attr |= TREE_ATTR_MPA; |
240 | else if (!strcasecmp(&entry->d_name[len-4], ".m3u")) | 243 | else if (!strcasecmp(&entry->d_name[len-4], ".m3u")) |
241 | dptr->attr |= TREE_ATTR_M3U; | 244 | dptr->attr |= TREE_ATTR_M3U; |
245 | #ifdef CUSTOM_EQ | ||
246 | else if (!strcasecmp(&entry->d_name[len-3], ".eq")) | ||
247 | dptr->attr |= TREE_ATTR_EQ; | ||
248 | #endif | ||
242 | else if (!strcasecmp(&entry->d_name[len-4], ".wps")) | 249 | else if (!strcasecmp(&entry->d_name[len-4], ".wps")) |
243 | dptr->attr |= TREE_ATTR_WPS; | 250 | dptr->attr |= TREE_ATTR_WPS; |
244 | #ifdef HAVE_RECORDER_KEYPAD | 251 | #ifdef HAVE_RECORDER_KEYPAD |
@@ -320,6 +327,12 @@ static int showdir(char *path, int start) | |||
320 | icon_type = Wps; | 327 | icon_type = Wps; |
321 | break; | 328 | break; |
322 | 329 | ||
330 | #ifdef CUSTOM_EQ | ||
331 | case TREE_ATTR_EQ: | ||
332 | icon_type = Wps; | ||
333 | break; | ||
334 | #endif | ||
335 | |||
323 | case TREE_ATTR_MOD: | 336 | case TREE_ATTR_MOD: |
324 | icon_type = Mod_Ajz; | 337 | icon_type = Mod_Ajz; |
325 | break; | 338 | break; |
@@ -608,6 +621,15 @@ bool dirbrowse(char *root) | |||
608 | restore = true; | 621 | restore = true; |
609 | break; | 622 | break; |
610 | 623 | ||
624 | #ifdef CUSTOM_EQ | ||
625 | case TREE_ATTR_EQ: | ||
626 | snprintf(buf, sizeof buf, "%s/%s", | ||
627 | currdir, file->name); | ||
628 | settings_load_eq(buf); | ||
629 | restore = true; | ||
630 | break; | ||
631 | #endif | ||
632 | |||
611 | #ifndef SIMULATOR | 633 | #ifndef SIMULATOR |
612 | /* firmware file */ | 634 | /* firmware file */ |
613 | case TREE_ATTR_MOD: | 635 | case TREE_ATTR_MOD: |