summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJustin Heiner <jheiner@rockbox.org>2002-09-06 06:02:02 +0000
committerJustin Heiner <jheiner@rockbox.org>2002-09-06 06:02:02 +0000
commit4bd90cc2ca23561dcafa1204b664007cab3cefb1 (patch)
treef6967d86b06e7c08594b21b9755083eec8bd70f7
parent221c4a250d99836ff288edfa535cddc5473f2a75 (diff)
downloadrockbox-4bd90cc2ca23561dcafa1204b664007cab3cefb1.tar.gz
rockbox-4bd90cc2ca23561dcafa1204b664007cab3cefb1.zip
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
-rw-r--r--apps/settings.c44
-rw-r--r--apps/tree.c8
2 files changed, 35 insertions, 17 deletions
diff --git a/apps/settings.c b/apps/settings.c
index 58f393d75a..14a4a35b97 100644
--- a/apps/settings.c
+++ b/apps/settings.c
@@ -395,7 +395,6 @@ void settings_load(void)
395#endif 395#endif
396} 396}
397 397
398#ifdef CUSTOM_EQ
399/* 398/*
400 * Loads a .eq file 399 * Loads a .eq file
401 */ 400 */
@@ -405,6 +404,7 @@ bool settings_load_eq(char* file)
405 char buf_set[16]; 404 char buf_set[16];
406 char buf_disp[16]; 405 char buf_disp[16];
407 char buf_val[8]; 406 char buf_val[8];
407 bool syntax_error = false;
408 int fd; 408 int fd;
409 int i; 409 int i;
410 int d = 0; 410 int d = 0;
@@ -452,24 +452,51 @@ bool settings_load_eq(char* file)
452 sleep(HZ/2); 452 sleep(HZ/2);
453 if (!strcasecmp(buf_set,"volume")) { 453 if (!strcasecmp(buf_set,"volume")) {
454 global_settings.volume = (atoi(buf_val)/2); 454 global_settings.volume = (atoi(buf_val)/2);
455 if(global_settings.volume > mpeg_sound_max(SOUND_VOLUME) ||
456 global_settings.volume < mpeg_sound_min(SOUND_VOLUME)) {
457 global_settings.volume = mpeg_sound_default(SOUND_VOLUME);
458 syntax_error = true;
459 }
455 } else 460 } else
456 if (!strcasecmp(buf_set,"bass")) { 461 if (!strcasecmp(buf_set,"bass")) {
457 if (buf_val[0] == '-') 462 if (buf_val[0] == '-')
458 global_settings.bass = mpeg_val2phys(SOUND_BASS,(15-atoi(buf_val+1))); 463 global_settings.bass = ((mpeg_sound_max(SOUND_BASS)/2)-atoi(buf_val+1));
459 else 464 else
460 global_settings.bass = mpeg_val2phys(SOUND_BASS,(atoi(buf_val)+15)); 465 global_settings.bass = (atoi(buf_val)+(mpeg_sound_max(SOUND_BASS)/2));
466 if (global_settings.bass > mpeg_sound_max(SOUND_BASS) ||
467 global_settings.bass < mpeg_sound_min(SOUND_BASS)) {
468 global_settings.bass = mpeg_sound_default(SOUND_BASS);
469 syntax_error = true;
470 }
461 } else 471 } else
462 if (!strcasecmp(buf_set,"treble")) { 472 if (!strcasecmp(buf_set,"treble")) {
463 if (buf_val[0] == '-') 473 if (buf_val[0] == '-')
464 global_settings.treble = (15-atoi(buf_val+1)); 474 global_settings.treble = ((mpeg_sound_max(SOUND_TREBLE)/2)-atoi(buf_val+1));
465 else 475 else
466 global_settings.treble = (atoi(buf_val)+15); 476 global_settings.treble = (atoi(buf_val)+(mpeg_sound_max(SOUND_TREBLE)/2));
467 } 477 if (global_settings.treble > mpeg_sound_max(SOUND_TREBLE) ||
478 global_settings.treble < mpeg_sound_min(SOUND_TREBLE)) {
479 global_settings.treble = mpeg_sound_default(SOUND_TREBLE);
480 syntax_error = true;
481 }
482 } else
468 if (!strcasecmp(buf_set,"balance")) { 483 if (!strcasecmp(buf_set,"balance")) {
469 if (buf_val[0] == '-') 484 if (buf_val[0] == '-')
470 global_settings.balance = (25-(atoi(buf_val+1)/2)); 485 global_settings.balance = ((mpeg_sound_max(SOUND_BALANCE)/2)-(atoi(buf_val+1)/2));
471 else 486 else
472 global_settings.balance = ((atoi(buf_val)/2)+25); 487 global_settings.balance = ((atoi(buf_val)/2)+(mpeg_sound_max(SOUND_BALANCE)/2));
488 if (global_settings.balance > mpeg_sound_max(SOUND_BALANCE) ||
489 global_settings.balance < mpeg_sound_min(SOUND_BALANCE)) {
490 global_settings.balance = mpeg_sound_default(SOUND_BALANCE);
491 syntax_error = true;
492 }
493 }
494 if (syntax_error) {
495 lcd_clear_display();
496 lcd_puts(0,0,"SyntaxError");
497 lcd_puts(0,1,buf_set);
498 sleep(HZ);
499 syntax_error = false;
473 } 500 }
474 vtype = 0; 501 vtype = 0;
475 break; 502 break;
@@ -482,7 +509,6 @@ bool settings_load_eq(char* file)
482 } 509 }
483 return(false); 510 return(false);
484} 511}
485#endif
486 512
487/* 513/*
488 * reset all settings to their default value 514 * reset all settings to their default value
diff --git a/apps/tree.c b/apps/tree.c
index 0be77c3b9c..9e16da6ce2 100644
--- a/apps/tree.c
+++ b/apps/tree.c
@@ -132,9 +132,7 @@ 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 */ 135#define TREE_ATTR_EQ 0x300 /* EQ config file */
137#endif
138#define TREE_ATTR_MASK 0xffd0 /* which bits tree.c uses (above + DIR) */ 136#define TREE_ATTR_MASK 0xffd0 /* which bits tree.c uses (above + DIR) */
139 137
140static int build_playlist(int start_index) 138static int build_playlist(int start_index)
@@ -248,10 +246,8 @@ static int showdir(char *path, int start)
248 dptr->attr |= TREE_ATTR_MPA; 246 dptr->attr |= TREE_ATTR_MPA;
249 else if (!strcasecmp(&entry->d_name[len-4], ".m3u")) 247 else if (!strcasecmp(&entry->d_name[len-4], ".m3u"))
250 dptr->attr |= TREE_ATTR_M3U; 248 dptr->attr |= TREE_ATTR_M3U;
251#ifdef CUSTOM_EQ
252 else if (!strcasecmp(&entry->d_name[len-3], ".eq")) 249 else if (!strcasecmp(&entry->d_name[len-3], ".eq"))
253 dptr->attr |= TREE_ATTR_EQ; 250 dptr->attr |= TREE_ATTR_EQ;
254#endif
255 else if (!strcasecmp(&entry->d_name[len-4], ".wps")) 251 else if (!strcasecmp(&entry->d_name[len-4], ".wps"))
256 dptr->attr |= TREE_ATTR_WPS; 252 dptr->attr |= TREE_ATTR_WPS;
257#ifdef HAVE_RECORDER_KEYPAD 253#ifdef HAVE_RECORDER_KEYPAD
@@ -333,11 +329,9 @@ static int showdir(char *path, int start)
333 icon_type = Wps; 329 icon_type = Wps;
334 break; 330 break;
335 331
336#ifdef CUSTOM_EQ
337 case TREE_ATTR_EQ: 332 case TREE_ATTR_EQ:
338 icon_type = Wps; 333 icon_type = Wps;
339 break; 334 break;
340#endif
341 335
342 case TREE_ATTR_MOD: 336 case TREE_ATTR_MOD:
343 icon_type = Mod_Ajz; 337 icon_type = Mod_Ajz;
@@ -627,14 +621,12 @@ bool dirbrowse(char *root)
627 restore = true; 621 restore = true;
628 break; 622 break;
629 623
630#ifdef CUSTOM_EQ
631 case TREE_ATTR_EQ: 624 case TREE_ATTR_EQ:
632 snprintf(buf, sizeof buf, "%s/%s", 625 snprintf(buf, sizeof buf, "%s/%s",
633 currdir, file->name); 626 currdir, file->name);
634 settings_load_eq(buf); 627 settings_load_eq(buf);
635 restore = true; 628 restore = true;
636 break; 629 break;
637#endif
638 630
639#ifndef SIMULATOR 631#ifndef SIMULATOR
640 /* firmware file */ 632 /* firmware file */