summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBjörn Stenberg <bjorn@haxx.se>2003-02-27 15:02:20 +0000
committerBjörn Stenberg <bjorn@haxx.se>2003-02-27 15:02:20 +0000
commit6da56d9f089743570dacaa52e3ce12338d339ca0 (patch)
treebb44408a014fe25b36bbbf54e9b950427a013a97
parentb1079200d34b197a9ea0ec649168b0a307ee9517 (diff)
downloadrockbox-6da56d9f089743570dacaa52e3ce12338d339ca0.tar.gz
rockbox-6da56d9f089743570dacaa52e3ce12338d339ca0.zip
Added three new channel modes: Stereo narrow, Stereo wide, and Karaoke (voice filter). Patch by Remo Hofer.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@3356 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--apps/lang/english.lang20
-rw-r--r--apps/settings.c6
-rw-r--r--apps/sound_menu.c13
-rw-r--r--firmware/export/mpeg.h9
-rw-r--r--firmware/mpeg.c105
5 files changed, 94 insertions, 59 deletions
diff --git a/apps/lang/english.lang b/apps/lang/english.lang
index 62cf492abc..8018947561 100644
--- a/apps/lang/english.lang
+++ b/apps/lang/english.lang
@@ -1409,3 +1409,23 @@ id: LANG_INVERT
1409desc: in settings_menu 1409desc: in settings_menu
1410eng: "Invert" 1410eng: "Invert"
1411new: 1411new:
1412
1413id: LANG_CHANNEL_STEREO_NARROW_PLAYER
1414desc: in sound_settings
1415eng: "St. Narrow"
1416new:
1417
1418id: LANG_CHANNEL_STEREO_NARROW_RECORDER
1419desc: in sound_settings
1420eng: "Stereo Narrow"
1421new:
1422
1423id: LANG_CHANNEL_STEREO_WIDE
1424desc: in sound_settings
1425eng: "Stereo Wide"
1426new:
1427
1428id: LANG_CHANNEL_KARAOKE
1429desc: in sound_settings
1430eng: "Karaoke"
1431new:
diff --git a/apps/settings.c b/apps/settings.c
index 7019319fb3..a99d7244d4 100644
--- a/apps/settings.c
+++ b/apps/settings.c
@@ -325,9 +325,10 @@ int settings_save( void )
325 config_block[0x10] = (unsigned char) 325 config_block[0x10] = (unsigned char)
326 ((global_settings.ff_rewind_min_step & 15) << 4 | 326 ((global_settings.ff_rewind_min_step & 15) << 4 |
327 (global_settings.ff_rewind_accel & 15)); 327 (global_settings.ff_rewind_accel & 15));
328
328 config_block[0x11] = (unsigned char) 329 config_block[0x11] = (unsigned char)
329 ((global_settings.avc & 0x03) | 330 ((global_settings.avc & 0x03) |
330 ((global_settings.channel_config & 0x03) << 2)); 331 ((global_settings.channel_config & 0x07) << 2));
331 332
332 memcpy(&config_block[0x12], &global_settings.resume_index, 4); 333 memcpy(&config_block[0x12], &global_settings.resume_index, 4);
333 memcpy(&config_block[0x16], &global_settings.resume_offset, 4); 334 memcpy(&config_block[0x16], &global_settings.resume_offset, 4);
@@ -457,7 +458,6 @@ void settings_apply(void)
457 mpeg_sound_set(SOUND_BALANCE, global_settings.balance); 458 mpeg_sound_set(SOUND_BALANCE, global_settings.balance);
458 mpeg_sound_set(SOUND_VOLUME, global_settings.volume); 459 mpeg_sound_set(SOUND_VOLUME, global_settings.volume);
459 mpeg_sound_set(SOUND_CHANNELS, global_settings.channel_config); 460 mpeg_sound_set(SOUND_CHANNELS, global_settings.channel_config);
460
461#ifdef HAVE_MAS3587F 461#ifdef HAVE_MAS3587F
462 mpeg_sound_set(SOUND_LOUDNESS, global_settings.loudness); 462 mpeg_sound_set(SOUND_LOUDNESS, global_settings.loudness);
463 mpeg_sound_set(SOUND_SUPERBASS, global_settings.bass_boost); 463 mpeg_sound_set(SOUND_SUPERBASS, global_settings.bass_boost);
@@ -598,7 +598,7 @@ void settings_load(void)
598 if (config_block[0x11] != 0xFF) 598 if (config_block[0x11] != 0xFF)
599 { 599 {
600 global_settings.avc = config_block[0x11] & 0x03; 600 global_settings.avc = config_block[0x11] & 0x03;
601 global_settings.channel_config = (config_block[0x11] >> 2) & 0x03; 601 global_settings.channel_config = (config_block[0x11] >> 2) & 0x07;
602 } 602 }
603 603
604 if (config_block[0x12] != 0xFF) 604 if (config_block[0x12] != 0xFF)
diff --git a/apps/sound_menu.c b/apps/sound_menu.c
index a7e01b8c8e..9ac95e46b8 100644
--- a/apps/sound_menu.c
+++ b/apps/sound_menu.c
@@ -228,10 +228,17 @@ static void set_chanconf(int val)
228 228
229static bool chanconf(void) 229static bool chanconf(void)
230{ 230{
231 char *names[] = {str(LANG_CHANNEL_STEREO), str(LANG_CHANNEL_MONO), 231 char *names[] = {str(LANG_CHANNEL_STEREO),
232 str(LANG_CHANNEL_LEFT), str(LANG_CHANNEL_RIGHT) }; 232#ifdef HAVE_LCD_CHARCELLS
233 str(LANG_CHANNEL_STEREO_NARROW_PLAYER),
234#else
235 str(LANG_CHANNEL_STEREO_NARROW_RECORDER),
236#endif
237 str(LANG_CHANNEL_MONO),
238 str(LANG_CHANNEL_LEFT), str(LANG_CHANNEL_RIGHT),
239 str(LANG_CHANNEL_KARAOKE), str(LANG_CHANNEL_STEREO_WIDE) };
233 return set_option(str(LANG_CHANNEL), &global_settings.channel_config, 240 return set_option(str(LANG_CHANNEL), &global_settings.channel_config,
234 names, 4, set_chanconf ); 241 names, 7, set_chanconf );
235} 242}
236 243
237bool sound_menu(void) 244bool sound_menu(void)
diff --git a/firmware/export/mpeg.h b/firmware/export/mpeg.h
index 69bacc5c7b..6b44363f8f 100644
--- a/firmware/export/mpeg.h
+++ b/firmware/export/mpeg.h
@@ -105,9 +105,12 @@ void mpeg_set_buffer_margin(int seconds);
105#define SOUND_NUMSETTINGS 11 105#define SOUND_NUMSETTINGS 11
106 106
107#define MPEG_SOUND_STEREO 0 107#define MPEG_SOUND_STEREO 0
108#define MPEG_SOUND_MONO 1 108#define MPEG_SOUND_STEREO_NARROW 1
109#define MPEG_SOUND_MONO_LEFT 2 109#define MPEG_SOUND_MONO 2
110#define MPEG_SOUND_MONO_RIGHT 3 110#define MPEG_SOUND_MONO_LEFT 3
111#define MPEG_SOUND_MONO_RIGHT 4
112#define MPEG_SOUND_KARAOKE 5
113#define MPEG_SOUND_STEREO_WIDE 6
111 114
112#define MPEG_STATUS_PLAY 1 115#define MPEG_STATUS_PLAY 1
113#define MPEG_STATUS_PAUSE 2 116#define MPEG_STATUS_PAUSE 2
diff --git a/firmware/mpeg.c b/firmware/mpeg.c
index e9d0943115..b0f183592e 100644
--- a/firmware/mpeg.c
+++ b/firmware/mpeg.c
@@ -139,7 +139,7 @@ static int maxval[] =
139 17, /* Loudness */ 139 17, /* Loudness */
140 10, /* Bass boost */ 140 10, /* Bass boost */
141 3, /* AVC */ 141 3, /* AVC */
142 3, /* Channels */ 142 6, /* Channels */
143 15, /* Left gain */ 143 15, /* Left gain */
144 15, /* Right gain */ 144 15, /* Right gain */
145 15, /* Mic gain */ 145 15, /* Mic gain */
@@ -2654,68 +2654,73 @@ void mpeg_sound_channel_config(int configuration)
2654#ifdef SIMULATOR 2654#ifdef SIMULATOR
2655 (void)configuration; 2655 (void)configuration;
2656#else 2656#else
2657 unsigned long val_on = 0x80000; 2657 unsigned long val_ll = 0x80000;
2658 unsigned long val_off = 0; 2658 unsigned long val_lr = 0;
2659 unsigned long val_rl = 0;
2660 unsigned long val_rr = 0x80000;
2659 2661
2660 switch(configuration) 2662 switch(configuration)
2661 { 2663 {
2662 case MPEG_SOUND_STEREO: 2664 case MPEG_SOUND_STEREO:
2663 val_on = 0x80000; 2665 val_ll = 0x80000;
2664#ifdef HAVE_MAS3587F 2666 val_lr = 0;
2665 mas_writemem(MAS_BANK_D0, 0x7fc, &val_on, 1); /* LL */ 2667 val_rl = 0;
2666 mas_writemem(MAS_BANK_D0, 0x7fd, &val_off, 1); /* LR */ 2668 val_rr = 0x80000;
2667 mas_writemem(MAS_BANK_D0, 0x7fe, &val_off, 1); /* RL */
2668 mas_writemem(MAS_BANK_D0, 0x7ff, &val_on, 1); /* RR */
2669#else
2670 mas_writemem(MAS_BANK_D1, 0x7f8, &val_on, 1); /* LL */
2671 mas_writemem(MAS_BANK_D1, 0x7f9, &val_off, 1); /* LR */
2672 mas_writemem(MAS_BANK_D1, 0x7fa, &val_off, 1); /* RL */
2673 mas_writemem(MAS_BANK_D1, 0x7fb, &val_on, 1); /* RR */
2674#endif
2675 break; 2669 break;
2670
2676 case MPEG_SOUND_MONO: 2671 case MPEG_SOUND_MONO:
2677 val_on = 0xc0000; 2672 val_ll = 0xc0000;
2678#ifdef HAVE_MAS3587F 2673 val_lr = 0xc0000;
2679 mas_writemem(MAS_BANK_D0, 0x7fc, &val_on, 1); /* LL */ 2674 val_rl = 0xc0000;
2680 mas_writemem(MAS_BANK_D0, 0x7fd, &val_on, 1); /* LR */ 2675 val_rr = 0xc0000;
2681 mas_writemem(MAS_BANK_D0, 0x7fe, &val_on, 1); /* RL */
2682 mas_writemem(MAS_BANK_D0, 0x7ff, &val_on, 1); /* RR */
2683#else
2684 mas_writemem(MAS_BANK_D1, 0x7f8, &val_on, 1); /* LL */
2685 mas_writemem(MAS_BANK_D1, 0x7f9, &val_on, 1); /* LR */
2686 mas_writemem(MAS_BANK_D1, 0x7fa, &val_on, 1); /* RL */
2687 mas_writemem(MAS_BANK_D1, 0x7fb, &val_on, 1); /* RR */
2688#endif
2689 break; 2676 break;
2677
2690 case MPEG_SOUND_MONO_LEFT: 2678 case MPEG_SOUND_MONO_LEFT:
2691 val_on = 0x80000; 2679 val_ll = 0x80000;
2692#ifdef HAVE_MAS3587F 2680 val_lr = 0x80000;
2693 mas_writemem(MAS_BANK_D0, 0x7fc, &val_on, 1); /* LL */ 2681 val_rl = 0;
2694 mas_writemem(MAS_BANK_D0, 0x7fd, &val_on, 1); /* LR */ 2682 val_rr = 0;
2695 mas_writemem(MAS_BANK_D0, 0x7fe, &val_off, 1); /* RL */
2696 mas_writemem(MAS_BANK_D0, 0x7ff, &val_off, 1); /* RR */
2697#else
2698 mas_writemem(MAS_BANK_D1, 0x7f8, &val_on, 1); /* LL */
2699 mas_writemem(MAS_BANK_D1, 0x7f9, &val_on, 1); /* LR */
2700 mas_writemem(MAS_BANK_D1, 0x7fa, &val_off, 1); /* RL */
2701 mas_writemem(MAS_BANK_D1, 0x7fb, &val_off, 1); /* RR */
2702#endif
2703 break; 2683 break;
2684
2704 case MPEG_SOUND_MONO_RIGHT: 2685 case MPEG_SOUND_MONO_RIGHT:
2705 val_on = 0x80000; 2686 val_ll = 0;
2687 val_lr = 0;
2688 val_rl = 0x80000;
2689 val_rr = 0x80000;
2690 break;
2691
2692 case MPEG_SOUND_STEREO_NARROW:
2693 val_ll = 0xa0000;
2694 val_lr = 0xe0000;
2695 val_rl = 0xe0000;
2696 val_rr = 0xa0000;
2697 break;
2698
2699 case MPEG_SOUND_STEREO_WIDE:
2700 val_ll = 0x80000;
2701 val_lr = 0x40000;
2702 val_rl = 0x40000;
2703 val_rr = 0x80000;
2704 break;
2705 case MPEG_SOUND_KARAOKE:
2706 val_ll = 0x80001;
2707 val_lr = 0x7ffff;
2708 val_rl = 0x7ffff;
2709 val_rr = 0x80001;
2710 break;
2711 }
2712
2706#ifdef HAVE_MAS3587F 2713#ifdef HAVE_MAS3587F
2707 mas_writemem(MAS_BANK_D0, 0x7fc, &val_off, 1); /* LL */ 2714 mas_writemem(MAS_BANK_D0, 0x7fc, &val_ll, 1); /* LL */
2708 mas_writemem(MAS_BANK_D0, 0x7fd, &val_off, 1); /* LR */ 2715 mas_writemem(MAS_BANK_D0, 0x7fd, &val_lr, 1); /* LR */
2709 mas_writemem(MAS_BANK_D0, 0x7fe, &val_on, 1); /* RL */ 2716 mas_writemem(MAS_BANK_D0, 0x7fe, &val_rl, 1); /* RL */
2710 mas_writemem(MAS_BANK_D0, 0x7ff, &val_on, 1); /* RR */ 2717 mas_writemem(MAS_BANK_D0, 0x7ff, &val_rr, 1); /* RR */
2711#else 2718#else
2712 mas_writemem(MAS_BANK_D1, 0x7f8, &val_off, 1); /* LL */ 2719 mas_writemem(MAS_BANK_D1, 0x7f8, &val_ll, 1); /* LL */
2713 mas_writemem(MAS_BANK_D1, 0x7f9, &val_off, 1); /* LR */ 2720 mas_writemem(MAS_BANK_D1, 0x7f9, &val_lr, 1); /* LR */
2714 mas_writemem(MAS_BANK_D1, 0x7fa, &val_on, 1); /* RL */ 2721 mas_writemem(MAS_BANK_D1, 0x7fa, &val_rl, 1); /* RL */
2715 mas_writemem(MAS_BANK_D1, 0x7fb, &val_on, 1); /* RR */ 2722 mas_writemem(MAS_BANK_D1, 0x7fb, &val_rr, 1); /* RR */
2716#endif 2723#endif
2717 break;
2718 }
2719#endif 2724#endif
2720} 2725}
2721 2726