summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Linenberg <elinenbe@umich.edu>2002-09-17 12:48:56 +0000
committerEric Linenberg <elinenbe@umich.edu>2002-09-17 12:48:56 +0000
commit8d47c5c32951b17ef1efd1ad94c4ab559dc7ab4b (patch)
tree22e9f7edd797ac9259135da409e694f7bdc82423
parent380ca88d4d00b71bc7192527c8aa7ca402851d5b (diff)
downloadrockbox-8d47c5c32951b17ef1efd1ad94c4ab559dc7ab4b.tar.gz
rockbox-8d47c5c32951b17ef1efd1ad94c4ab559dc7ab4b.zip
Philipp's fix .eq loading patch
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@2318 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--apps/settings.c60
-rw-r--r--firmware/mpeg.c4
2 files changed, 53 insertions, 11 deletions
diff --git a/apps/settings.c b/apps/settings.c
index 82de1663bf..771e21affc 100644
--- a/apps/settings.c
+++ b/apps/settings.c
@@ -408,7 +408,7 @@ void settings_load(void)
408 */ 408 */
409bool settings_load_eq(char* file) 409bool settings_load_eq(char* file)
410{ 410{
411 char buffer[128]; 411 char buffer[512];
412 char buf_set[16]; 412 char buf_set[16];
413 char buf_disp[16]; 413 char buf_disp[16];
414 char buf_val[8]; 414 char buf_val[8];
@@ -417,8 +417,10 @@ bool settings_load_eq(char* file)
417 int i; 417 int i;
418 int d = 0; 418 int d = 0;
419 int vtype = 0; 419 int vtype = 0;
420 int line = 0;
420 421
421 422
423 lcd_clear_display();
422 fd = open(file, O_RDONLY); 424 fd = open(file, O_RDONLY);
423 425
424 if (-1 != fd) 426 if (-1 != fd)
@@ -453,10 +455,9 @@ bool settings_load_eq(char* file)
453 buf_val[d++] = buffer[i]; 455 buf_val[d++] = buffer[i];
454 break; 456 break;
455 case 3: 457 case 3:
456 lcd_clear_display(); 458 snprintf(buf_disp,sizeof(buf_disp),"[%s]%s", buf_set, buf_val);
457 snprintf(buf_disp,sizeof(buf_disp),"[%s]", buf_set); 459 lcd_puts(0,line++ % 6,buf_disp);
458 lcd_puts(0,0,buf_disp); 460 lcd_update();
459 lcd_puts(0,1,buf_val);
460 sleep(HZ/2); 461 sleep(HZ/2);
461 if (!strcasecmp(buf_set,"volume")) { 462 if (!strcasecmp(buf_set,"volume")) {
462 global_settings.volume = (atoi(buf_val)/2); 463 global_settings.volume = (atoi(buf_val)/2);
@@ -465,6 +466,8 @@ bool settings_load_eq(char* file)
465 global_settings.volume = mpeg_sound_default(SOUND_VOLUME); 466 global_settings.volume = mpeg_sound_default(SOUND_VOLUME);
466 syntax_error = true; 467 syntax_error = true;
467 } 468 }
469 mpeg_sound_set(SOUND_VOLUME, global_settings.volume);
470
468 } else 471 } else
469 if (!strcasecmp(buf_set,"bass")) { 472 if (!strcasecmp(buf_set,"bass")) {
470 if (buf_val[0] == '-') 473 if (buf_val[0] == '-')
@@ -476,6 +479,7 @@ bool settings_load_eq(char* file)
476 global_settings.bass = mpeg_sound_default(SOUND_BASS); 479 global_settings.bass = mpeg_sound_default(SOUND_BASS);
477 syntax_error = true; 480 syntax_error = true;
478 } 481 }
482 mpeg_sound_set(SOUND_BASS, global_settings.bass);
479 } else 483 } else
480 if (!strcasecmp(buf_set,"treble")) { 484 if (!strcasecmp(buf_set,"treble")) {
481 if (buf_val[0] == '-') 485 if (buf_val[0] == '-')
@@ -487,22 +491,60 @@ bool settings_load_eq(char* file)
487 global_settings.treble = mpeg_sound_default(SOUND_TREBLE); 491 global_settings.treble = mpeg_sound_default(SOUND_TREBLE);
488 syntax_error = true; 492 syntax_error = true;
489 } 493 }
494 mpeg_sound_set(SOUND_TREBLE, global_settings.treble);
490 } else 495 } else
491 if (!strcasecmp(buf_set,"balance")) { 496 if (!strcasecmp(buf_set,"balance")) {
492 if (buf_val[0] == '-') 497 if (buf_val[0] == '-')
493 global_settings.balance = ((mpeg_sound_max(SOUND_BALANCE)/2)-(atoi(buf_val+1)/2)); 498 global_settings.balance = -(atoi(buf_val+1)/2);
494 else 499 else
495 global_settings.balance = ((atoi(buf_val)/2)+(mpeg_sound_max(SOUND_BALANCE)/2)); 500 global_settings.balance = ((atoi(buf_val)/2));
496 if (global_settings.balance > mpeg_sound_max(SOUND_BALANCE) || 501 if (global_settings.balance > mpeg_sound_max(SOUND_BALANCE) ||
497 global_settings.balance < mpeg_sound_min(SOUND_BALANCE)) { 502 global_settings.balance < mpeg_sound_min(SOUND_BALANCE)) {
498 global_settings.balance = mpeg_sound_default(SOUND_BALANCE); 503 global_settings.balance = mpeg_sound_default(SOUND_BALANCE);
499 syntax_error = true; 504 syntax_error = true;
500 } 505 }
506 mpeg_sound_set(SOUND_BALANCE, global_settings.balance);
507 } else
508 if (!strcasecmp(buf_set,"channels")) {
509 global_settings.channel_config = atoi(buf_val);
510 if (global_settings.channel_config > mpeg_sound_max(SOUND_CHANNELS) ||
511 global_settings.channel_config < mpeg_sound_min(SOUND_CHANNELS)) {
512 global_settings.channel_config = mpeg_sound_default(SOUND_CHANNELS);
513 syntax_error = true;
514 }
515 mpeg_sound_set(SOUND_CHANNELS, global_settings.channel_config);
516 } else
517 if (!strcasecmp(buf_set,"loudness")) {
518 global_settings.loudness = atoi(buf_val);
519 if(global_settings.loudness > mpeg_sound_max(SOUND_LOUDNESS) ||
520 global_settings.loudness < mpeg_sound_min(SOUND_LOUDNESS)) {
521 global_settings.loudness = mpeg_sound_default(SOUND_LOUDNESS);
522 syntax_error = true;
523 }
524 mpeg_sound_set(SOUND_LOUDNESS, global_settings.loudness);
525 } else
526 if (!strcasecmp(buf_set,"bass boost")) {
527 global_settings.bass_boost = (atoi(buf_val)/10);
528 if(global_settings.bass_boost > mpeg_sound_max(SOUND_SUPERBASS) ||
529 global_settings.bass_boost < mpeg_sound_min(SOUND_SUPERBASS)) {
530 global_settings.bass_boost = mpeg_sound_default(SOUND_SUPERBASS);
531 syntax_error = true;
532 }
533 mpeg_sound_set(SOUND_SUPERBASS, global_settings.bass_boost);
534 } else if (!strcasecmp(buf_set,"auto volume")) {
535 global_settings.avc = atoi(buf_val);
536 if (global_settings.avc > mpeg_sound_max(SOUND_AVC) ||
537 global_settings.avc < mpeg_sound_min(SOUND_AVC)) {
538 global_settings.avc = mpeg_sound_default(SOUND_AVC);
539 syntax_error = true;
540 }
541 mpeg_sound_set(SOUND_AVC, global_settings.avc);
501 } 542 }
502 if (syntax_error) { 543 if (syntax_error) {
503 lcd_clear_display(); 544 lcd_clear_display();
504 lcd_puts(0,0,"SyntaxError"); 545 lcd_puts(0,1,"SyntaxError");
505 lcd_puts(0,1,buf_set); 546 lcd_puts(0,2,buf_set);
547 lcd_update();
506 sleep(HZ); 548 sleep(HZ);
507 syntax_error = false; 549 syntax_error = false;
508 } 550 }
diff --git a/firmware/mpeg.c b/firmware/mpeg.c
index fa482593b8..e91f1191b0 100644
--- a/firmware/mpeg.c
+++ b/firmware/mpeg.c
@@ -91,7 +91,7 @@ static int minval[] =
91 -50, /* Balance */ 91 -50, /* Balance */
92 0, /* Loudness */ 92 0, /* Loudness */
93 0, /* Bass boost */ 93 0, /* Bass boost */
94 0, /* AVC */ 94 -1, /* AVC */
95 0 /* Channels */ 95 0 /* Channels */
96}; 96};
97 97
@@ -108,7 +108,7 @@ static int maxval[] =
108 50, /* Balance */ 108 50, /* Balance */
109 17, /* Loudness */ 109 17, /* Loudness */
110 10, /* Bass boost */ 110 10, /* Bass boost */
111 0, /* AVC */ 111 3, /* AVC */
112 3 /* Channels */ 112 3 /* Channels */
113}; 113};
114 114