From 6da56d9f089743570dacaa52e3ce12338d339ca0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Stenberg?= Date: Thu, 27 Feb 2003 15:02:20 +0000 Subject: [PATCH] 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 --- apps/lang/english.lang | 20 ++++++++ apps/settings.c | 6 +-- apps/sound_menu.c | 13 +++-- firmware/export/mpeg.h | 9 ++-- firmware/mpeg.c | 107 +++++++++++++++++++++-------------------- 5 files changed, 95 insertions(+), 60 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 desc: in settings_menu eng: "Invert" new: + +id: LANG_CHANNEL_STEREO_NARROW_PLAYER +desc: in sound_settings +eng: "St. Narrow" +new: + +id: LANG_CHANNEL_STEREO_NARROW_RECORDER +desc: in sound_settings +eng: "Stereo Narrow" +new: + +id: LANG_CHANNEL_STEREO_WIDE +desc: in sound_settings +eng: "Stereo Wide" +new: + +id: LANG_CHANNEL_KARAOKE +desc: in sound_settings +eng: "Karaoke" +new: 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 ) config_block[0x10] = (unsigned char) ((global_settings.ff_rewind_min_step & 15) << 4 | (global_settings.ff_rewind_accel & 15)); + config_block[0x11] = (unsigned char) ((global_settings.avc & 0x03) | - ((global_settings.channel_config & 0x03) << 2)); + ((global_settings.channel_config & 0x07) << 2)); memcpy(&config_block[0x12], &global_settings.resume_index, 4); memcpy(&config_block[0x16], &global_settings.resume_offset, 4); @@ -457,7 +458,6 @@ void settings_apply(void) mpeg_sound_set(SOUND_BALANCE, global_settings.balance); mpeg_sound_set(SOUND_VOLUME, global_settings.volume); mpeg_sound_set(SOUND_CHANNELS, global_settings.channel_config); - #ifdef HAVE_MAS3587F mpeg_sound_set(SOUND_LOUDNESS, global_settings.loudness); mpeg_sound_set(SOUND_SUPERBASS, global_settings.bass_boost); @@ -598,7 +598,7 @@ void settings_load(void) if (config_block[0x11] != 0xFF) { global_settings.avc = config_block[0x11] & 0x03; - global_settings.channel_config = (config_block[0x11] >> 2) & 0x03; + global_settings.channel_config = (config_block[0x11] >> 2) & 0x07; } 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) static bool chanconf(void) { - char *names[] = {str(LANG_CHANNEL_STEREO), str(LANG_CHANNEL_MONO), - str(LANG_CHANNEL_LEFT), str(LANG_CHANNEL_RIGHT) }; + char *names[] = {str(LANG_CHANNEL_STEREO), +#ifdef HAVE_LCD_CHARCELLS + str(LANG_CHANNEL_STEREO_NARROW_PLAYER), +#else + str(LANG_CHANNEL_STEREO_NARROW_RECORDER), +#endif + str(LANG_CHANNEL_MONO), + str(LANG_CHANNEL_LEFT), str(LANG_CHANNEL_RIGHT), + str(LANG_CHANNEL_KARAOKE), str(LANG_CHANNEL_STEREO_WIDE) }; return set_option(str(LANG_CHANNEL), &global_settings.channel_config, - names, 4, set_chanconf ); + names, 7, set_chanconf ); } bool 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); #define SOUND_NUMSETTINGS 11 #define MPEG_SOUND_STEREO 0 -#define MPEG_SOUND_MONO 1 -#define MPEG_SOUND_MONO_LEFT 2 -#define MPEG_SOUND_MONO_RIGHT 3 +#define MPEG_SOUND_STEREO_NARROW 1 +#define MPEG_SOUND_MONO 2 +#define MPEG_SOUND_MONO_LEFT 3 +#define MPEG_SOUND_MONO_RIGHT 4 +#define MPEG_SOUND_KARAOKE 5 +#define MPEG_SOUND_STEREO_WIDE 6 #define MPEG_STATUS_PLAY 1 #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[] = 17, /* Loudness */ 10, /* Bass boost */ 3, /* AVC */ - 3, /* Channels */ + 6, /* Channels */ 15, /* Left gain */ 15, /* Right gain */ 15, /* Mic gain */ @@ -2654,68 +2654,73 @@ void mpeg_sound_channel_config(int configuration) #ifdef SIMULATOR (void)configuration; #else - unsigned long val_on = 0x80000; - unsigned long val_off = 0; + unsigned long val_ll = 0x80000; + unsigned long val_lr = 0; + unsigned long val_rl = 0; + unsigned long val_rr = 0x80000; switch(configuration) { case MPEG_SOUND_STEREO: - val_on = 0x80000; -#ifdef HAVE_MAS3587F - mas_writemem(MAS_BANK_D0, 0x7fc, &val_on, 1); /* LL */ - mas_writemem(MAS_BANK_D0, 0x7fd, &val_off, 1); /* LR */ - mas_writemem(MAS_BANK_D0, 0x7fe, &val_off, 1); /* RL */ - mas_writemem(MAS_BANK_D0, 0x7ff, &val_on, 1); /* RR */ -#else - mas_writemem(MAS_BANK_D1, 0x7f8, &val_on, 1); /* LL */ - mas_writemem(MAS_BANK_D1, 0x7f9, &val_off, 1); /* LR */ - mas_writemem(MAS_BANK_D1, 0x7fa, &val_off, 1); /* RL */ - mas_writemem(MAS_BANK_D1, 0x7fb, &val_on, 1); /* RR */ -#endif + val_ll = 0x80000; + val_lr = 0; + val_rl = 0; + val_rr = 0x80000; break; + case MPEG_SOUND_MONO: - val_on = 0xc0000; -#ifdef HAVE_MAS3587F - mas_writemem(MAS_BANK_D0, 0x7fc, &val_on, 1); /* LL */ - mas_writemem(MAS_BANK_D0, 0x7fd, &val_on, 1); /* LR */ - mas_writemem(MAS_BANK_D0, 0x7fe, &val_on, 1); /* RL */ - mas_writemem(MAS_BANK_D0, 0x7ff, &val_on, 1); /* RR */ -#else - mas_writemem(MAS_BANK_D1, 0x7f8, &val_on, 1); /* LL */ - mas_writemem(MAS_BANK_D1, 0x7f9, &val_on, 1); /* LR */ - mas_writemem(MAS_BANK_D1, 0x7fa, &val_on, 1); /* RL */ - mas_writemem(MAS_BANK_D1, 0x7fb, &val_on, 1); /* RR */ -#endif + val_ll = 0xc0000; + val_lr = 0xc0000; + val_rl = 0xc0000; + val_rr = 0xc0000; break; + case MPEG_SOUND_MONO_LEFT: - val_on = 0x80000; -#ifdef HAVE_MAS3587F - mas_writemem(MAS_BANK_D0, 0x7fc, &val_on, 1); /* LL */ - mas_writemem(MAS_BANK_D0, 0x7fd, &val_on, 1); /* LR */ - mas_writemem(MAS_BANK_D0, 0x7fe, &val_off, 1); /* RL */ - mas_writemem(MAS_BANK_D0, 0x7ff, &val_off, 1); /* RR */ -#else - mas_writemem(MAS_BANK_D1, 0x7f8, &val_on, 1); /* LL */ - mas_writemem(MAS_BANK_D1, 0x7f9, &val_on, 1); /* LR */ - mas_writemem(MAS_BANK_D1, 0x7fa, &val_off, 1); /* RL */ - mas_writemem(MAS_BANK_D1, 0x7fb, &val_off, 1); /* RR */ -#endif + val_ll = 0x80000; + val_lr = 0x80000; + val_rl = 0; + val_rr = 0; break; + case MPEG_SOUND_MONO_RIGHT: - val_on = 0x80000; -#ifdef HAVE_MAS3587F - mas_writemem(MAS_BANK_D0, 0x7fc, &val_off, 1); /* LL */ - mas_writemem(MAS_BANK_D0, 0x7fd, &val_off, 1); /* LR */ - mas_writemem(MAS_BANK_D0, 0x7fe, &val_on, 1); /* RL */ - mas_writemem(MAS_BANK_D0, 0x7ff, &val_on, 1); /* RR */ -#else - mas_writemem(MAS_BANK_D1, 0x7f8, &val_off, 1); /* LL */ - mas_writemem(MAS_BANK_D1, 0x7f9, &val_off, 1); /* LR */ - mas_writemem(MAS_BANK_D1, 0x7fa, &val_on, 1); /* RL */ - mas_writemem(MAS_BANK_D1, 0x7fb, &val_on, 1); /* RR */ -#endif + val_ll = 0; + val_lr = 0; + val_rl = 0x80000; + val_rr = 0x80000; + break; + + case MPEG_SOUND_STEREO_NARROW: + val_ll = 0xa0000; + val_lr = 0xe0000; + val_rl = 0xe0000; + val_rr = 0xa0000; + break; + + case MPEG_SOUND_STEREO_WIDE: + val_ll = 0x80000; + val_lr = 0x40000; + val_rl = 0x40000; + val_rr = 0x80000; + break; + case MPEG_SOUND_KARAOKE: + val_ll = 0x80001; + val_lr = 0x7ffff; + val_rl = 0x7ffff; + val_rr = 0x80001; break; } + +#ifdef HAVE_MAS3587F + mas_writemem(MAS_BANK_D0, 0x7fc, &val_ll, 1); /* LL */ + mas_writemem(MAS_BANK_D0, 0x7fd, &val_lr, 1); /* LR */ + mas_writemem(MAS_BANK_D0, 0x7fe, &val_rl, 1); /* RL */ + mas_writemem(MAS_BANK_D0, 0x7ff, &val_rr, 1); /* RR */ +#else + mas_writemem(MAS_BANK_D1, 0x7f8, &val_ll, 1); /* LL */ + mas_writemem(MAS_BANK_D1, 0x7f9, &val_lr, 1); /* LR */ + mas_writemem(MAS_BANK_D1, 0x7fa, &val_rl, 1); /* RL */ + mas_writemem(MAS_BANK_D1, 0x7fb, &val_rr, 1); /* RR */ +#endif #endif }