diff options
-rw-r--r-- | apps/lang/english.lang | 42 | ||||
-rw-r--r-- | apps/main.c | 18 | ||||
-rw-r--r-- | apps/recorder/radio.c | 18 | ||||
-rw-r--r-- | apps/recorder/recording.c | 9 | ||||
-rw-r--r-- | apps/settings.c | 35 | ||||
-rw-r--r-- | apps/settings.h | 8 | ||||
-rw-r--r-- | apps/sound_menu.c | 67 | ||||
-rw-r--r-- | firmware/export/mp3_playback.h | 25 | ||||
-rw-r--r-- | firmware/mp3_playback.c | 158 |
9 files changed, 291 insertions, 89 deletions
diff --git a/apps/lang/english.lang b/apps/lang/english.lang index f9f1bf3bc2..062c7a0d75 100644 --- a/apps/lang/english.lang +++ b/apps/lang/english.lang | |||
@@ -326,9 +326,9 @@ voice: "Loudness" | |||
326 | new: | 326 | new: |
327 | 327 | ||
328 | id: LANG_BBOOST | 328 | id: LANG_BBOOST |
329 | desc: in sound settings | 329 | desc: DEPRECATED |
330 | eng: "Bass Boost" | 330 | eng: "" |
331 | voice: "Bass Boost" | 331 | voice: "" |
332 | new: | 332 | new: |
333 | 333 | ||
334 | id: LANG_DECAY | 334 | id: LANG_DECAY |
@@ -2757,3 +2757,39 @@ desc: in radio screen | |||
2757 | eng: "Action" | 2757 | eng: "Action" |
2758 | voice: "" | 2758 | voice: "" |
2759 | new: | 2759 | new: |
2760 | |||
2761 | id: LANG_MDB_STRENGTH | ||
2762 | desc: in sound settings | ||
2763 | eng: "MDB Strength" | ||
2764 | voice: "MDB Strength" | ||
2765 | new: | ||
2766 | |||
2767 | id: LANG_MDB_HARMONICS | ||
2768 | desc: in sound settings | ||
2769 | eng: "MDB Harmonics" | ||
2770 | voice: "MDB Harmonics" | ||
2771 | new: | ||
2772 | |||
2773 | id: LANG_MDB_CENTER | ||
2774 | desc: in sound settings | ||
2775 | eng: "MDB Center frequency" | ||
2776 | voice: "MDB Center frequency" | ||
2777 | new: | ||
2778 | |||
2779 | id: LANG_MDB_SHAPE | ||
2780 | desc: in sound settings | ||
2781 | eng: "MDB Shape" | ||
2782 | voice: "MDB Shape" | ||
2783 | new: | ||
2784 | |||
2785 | id: LANG_MDB_ENABLE | ||
2786 | desc: in sound settings | ||
2787 | eng: "MDB Enable" | ||
2788 | voice: "MDB Enable" | ||
2789 | new: | ||
2790 | |||
2791 | id: LANG_SUPERBASS | ||
2792 | desc: in sound settings | ||
2793 | eng: "Super bass" | ||
2794 | voice: "Super bass" | ||
2795 | new: | ||
diff --git a/apps/main.c b/apps/main.c index 9ead6e2db3..7a4590ebe1 100644 --- a/apps/main.c +++ b/apps/main.c | |||
@@ -89,9 +89,14 @@ void init(void) | |||
89 | global_settings.treble, | 89 | global_settings.treble, |
90 | global_settings.balance, | 90 | global_settings.balance, |
91 | global_settings.loudness, | 91 | global_settings.loudness, |
92 | global_settings.bass_boost, | ||
93 | global_settings.avc, | 92 | global_settings.avc, |
94 | global_settings.channel_config ); | 93 | global_settings.channel_config, |
94 | global_settings.mdb_strength, | ||
95 | global_settings.mdb_harmonics, | ||
96 | global_settings.mdb_center, | ||
97 | global_settings.mdb_shape, | ||
98 | global_settings.mdb_enable, | ||
99 | global_settings.superbass); | ||
95 | mpeg_init(); | 100 | mpeg_init(); |
96 | while (button_get(false) != 0) | 101 | while (button_get(false) != 0) |
97 | ; /* Empty the keyboard buffer */ | 102 | ; /* Empty the keyboard buffer */ |
@@ -227,9 +232,14 @@ void init(void) | |||
227 | global_settings.treble, | 232 | global_settings.treble, |
228 | global_settings.balance, | 233 | global_settings.balance, |
229 | global_settings.loudness, | 234 | global_settings.loudness, |
230 | global_settings.bass_boost, | ||
231 | global_settings.avc, | 235 | global_settings.avc, |
232 | global_settings.channel_config ); | 236 | global_settings.channel_config, |
237 | global_settings.mdb_strength, | ||
238 | global_settings.mdb_harmonics, | ||
239 | global_settings.mdb_center, | ||
240 | global_settings.mdb_shape, | ||
241 | global_settings.mdb_enable, | ||
242 | global_settings.superbass); | ||
233 | mpeg_init(); | 243 | mpeg_init(); |
234 | talk_init(); | 244 | talk_init(); |
235 | 245 | ||
diff --git a/apps/recorder/radio.c b/apps/recorder/radio.c index d4dc8a93aa..ce4bc8b4d6 100644 --- a/apps/recorder/radio.c +++ b/apps/recorder/radio.c | |||
@@ -203,14 +203,7 @@ bool radio_screen(void) | |||
203 | 203 | ||
204 | mpeg_init_recording(); | 204 | mpeg_init_recording(); |
205 | 205 | ||
206 | mpeg_sound_channel_config(global_settings.channel_config); | 206 | sound_settings_apply(); |
207 | mpeg_sound_set(SOUND_BASS, global_settings.bass); | ||
208 | mpeg_sound_set(SOUND_TREBLE, global_settings.treble); | ||
209 | mpeg_sound_set(SOUND_BALANCE, global_settings.balance); | ||
210 | mpeg_sound_set(SOUND_VOLUME, global_settings.volume); | ||
211 | mpeg_sound_set(SOUND_LOUDNESS, global_settings.loudness); | ||
212 | mpeg_sound_set(SOUND_SUPERBASS, global_settings.bass_boost); | ||
213 | mpeg_sound_set(SOUND_AVC, global_settings.avc); | ||
214 | 207 | ||
215 | /* Yes, we use the D/A for monitoring */ | 208 | /* Yes, we use the D/A for monitoring */ |
216 | peak_meter_playback(true); | 209 | peak_meter_playback(true); |
@@ -532,14 +525,7 @@ bool radio_screen(void) | |||
532 | 525 | ||
533 | mpeg_init_playback(); | 526 | mpeg_init_playback(); |
534 | 527 | ||
535 | mpeg_sound_channel_config(global_settings.channel_config); | 528 | sound_settings_apply(); |
536 | mpeg_sound_set(SOUND_BASS, global_settings.bass); | ||
537 | mpeg_sound_set(SOUND_TREBLE, global_settings.treble); | ||
538 | mpeg_sound_set(SOUND_BALANCE, global_settings.balance); | ||
539 | mpeg_sound_set(SOUND_VOLUME, global_settings.volume); | ||
540 | mpeg_sound_set(SOUND_LOUDNESS, global_settings.loudness); | ||
541 | mpeg_sound_set(SOUND_SUPERBASS, global_settings.bass_boost); | ||
542 | mpeg_sound_set(SOUND_AVC, global_settings.avc); | ||
543 | 529 | ||
544 | fmradio_set_status(0); | 530 | fmradio_set_status(0); |
545 | 531 | ||
diff --git a/apps/recorder/recording.c b/apps/recorder/recording.c index 40c416971a..60b6e4743e 100644 --- a/apps/recorder/recording.c +++ b/apps/recorder/recording.c | |||
@@ -606,14 +606,7 @@ bool recording_screen(void) | |||
606 | 606 | ||
607 | mpeg_init_playback(); | 607 | mpeg_init_playback(); |
608 | 608 | ||
609 | mpeg_sound_channel_config(global_settings.channel_config); | 609 | sound_settings_apply(); |
610 | mpeg_sound_set(SOUND_BASS, global_settings.bass); | ||
611 | mpeg_sound_set(SOUND_TREBLE, global_settings.treble); | ||
612 | mpeg_sound_set(SOUND_BALANCE, global_settings.balance); | ||
613 | mpeg_sound_set(SOUND_VOLUME, global_settings.volume); | ||
614 | mpeg_sound_set(SOUND_LOUDNESS, global_settings.loudness); | ||
615 | mpeg_sound_set(SOUND_SUPERBASS, global_settings.bass_boost); | ||
616 | mpeg_sound_set(SOUND_AVC, global_settings.avc); | ||
617 | 610 | ||
618 | lcd_setfont(FONT_UI); | 611 | lcd_setfont(FONT_UI); |
619 | 612 | ||
diff --git a/apps/settings.c b/apps/settings.c index 79fbfa5090..8434d3e211 100644 --- a/apps/settings.c +++ b/apps/settings.c | |||
@@ -71,7 +71,7 @@ char rockboxdir[] = ROCKBOX_DIR; /* config/font/data file directory */ | |||
71 | char rec_base_directory[] = REC_BASE_DIR; | 71 | char rec_base_directory[] = REC_BASE_DIR; |
72 | 72 | ||
73 | 73 | ||
74 | #define CONFIG_BLOCK_VERSION 13 | 74 | #define CONFIG_BLOCK_VERSION 14 |
75 | #define CONFIG_BLOCK_SIZE 512 | 75 | #define CONFIG_BLOCK_SIZE 512 |
76 | #define RTC_BLOCK_SIZE 44 | 76 | #define RTC_BLOCK_SIZE 44 |
77 | 77 | ||
@@ -165,8 +165,8 @@ static struct bit_entry rtc_bits[] = | |||
165 | {5 | SIGNED, S_O(treble), 0, "treble", NULL }, /* -15..+15 / -12..+12 */ | 165 | {5 | SIGNED, S_O(treble), 0, "treble", NULL }, /* -15..+15 / -12..+12 */ |
166 | #ifdef HAVE_MAS3587F | 166 | #ifdef HAVE_MAS3587F |
167 | {5, S_O(loudness), 0, "loudness", NULL }, /* 0...17 */ | 167 | {5, S_O(loudness), 0, "loudness", NULL }, /* 0...17 */ |
168 | {7, S_O(bass_boost), 0, "bass boost", NULL }, /* 0...100 */ | ||
169 | {3, S_O(avc), 0, "auto volume", "off,20ms,2,4,8" }, | 168 | {3, S_O(avc), 0, "auto volume", "off,20ms,2,4,8" }, |
169 | {1, S_O(superbass), false, "superbass", off_on }, | ||
170 | #endif | 170 | #endif |
171 | {3, S_O(channel_config), 6, "channels", | 171 | {3, S_O(channel_config), 6, "channels", |
172 | "stereo,stereo narrow,mono,mono left,mono right,karaoke,stereo wide" }, | 172 | "stereo,stereo narrow,mono,mono left,mono right,karaoke,stereo wide" }, |
@@ -325,7 +325,11 @@ static struct bit_entry hd_bits[] = | |||
325 | /* If values are just added to the end, no need to bump the version. */ | 325 | /* If values are just added to the end, no need to bump the version. */ |
326 | {2, S_O(sort_file), 0, "sort files", "alpha,oldest,newest,type" }, | 326 | {2, S_O(sort_file), 0, "sort files", "alpha,oldest,newest,type" }, |
327 | {2, S_O(sort_dir), 0, "sort dirs", "alpha,oldest,newest" }, | 327 | {2, S_O(sort_dir), 0, "sort dirs", "alpha,oldest,newest" }, |
328 | 328 | {7, S_O(mdb_strength), 0, "mdb strength", NULL}, | |
329 | {7, S_O(mdb_harmonics), 0, "mdb harmonics", NULL}, | ||
330 | {9, S_O(mdb_center), 0, "mdb center", NULL}, | ||
331 | {9, S_O(mdb_shape), 0, "mdb shape", NULL}, | ||
332 | {1, S_O(mdb_enable), 0, "mdb enable", off_on}, | ||
329 | 333 | ||
330 | /* Sum of all bit sizes must not grow beyond 0xB8*8 = 1472 */ | 334 | /* Sum of all bit sizes must not grow beyond 0xB8*8 = 1472 */ |
331 | }; | 335 | }; |
@@ -667,10 +671,8 @@ void settings_apply_pm_range(void) | |||
667 | } | 671 | } |
668 | #endif /* HAVE_LCD_BITMAP */ | 672 | #endif /* HAVE_LCD_BITMAP */ |
669 | 673 | ||
670 | void settings_apply(void) | 674 | void sound_settings_apply(void) |
671 | { | 675 | { |
672 | char buf[64]; | ||
673 | |||
674 | mpeg_sound_set(SOUND_BASS, global_settings.bass); | 676 | mpeg_sound_set(SOUND_BASS, global_settings.bass); |
675 | mpeg_sound_set(SOUND_TREBLE, global_settings.treble); | 677 | mpeg_sound_set(SOUND_TREBLE, global_settings.treble); |
676 | mpeg_sound_set(SOUND_BALANCE, global_settings.balance); | 678 | mpeg_sound_set(SOUND_BALANCE, global_settings.balance); |
@@ -678,9 +680,21 @@ void settings_apply(void) | |||
678 | mpeg_sound_set(SOUND_CHANNELS, global_settings.channel_config); | 680 | mpeg_sound_set(SOUND_CHANNELS, global_settings.channel_config); |
679 | #ifdef HAVE_MAS3587F | 681 | #ifdef HAVE_MAS3587F |
680 | mpeg_sound_set(SOUND_LOUDNESS, global_settings.loudness); | 682 | mpeg_sound_set(SOUND_LOUDNESS, global_settings.loudness); |
681 | mpeg_sound_set(SOUND_SUPERBASS, global_settings.bass_boost); | ||
682 | mpeg_sound_set(SOUND_AVC, global_settings.avc); | 683 | mpeg_sound_set(SOUND_AVC, global_settings.avc); |
684 | mpeg_sound_set(SOUND_MDB_STRENGTH, global_settings.mdb_strength); | ||
685 | mpeg_sound_set(SOUND_MDB_HARMONICS, global_settings.mdb_harmonics); | ||
686 | mpeg_sound_set(SOUND_MDB_CENTER, global_settings.mdb_center); | ||
687 | mpeg_sound_set(SOUND_MDB_SHAPE, global_settings.mdb_shape); | ||
688 | mpeg_sound_set(SOUND_MDB_ENABLE, global_settings.mdb_enable); | ||
689 | mpeg_sound_set(SOUND_SUPERBASS, global_settings.superbass); | ||
683 | #endif | 690 | #endif |
691 | } | ||
692 | |||
693 | void settings_apply(void) | ||
694 | { | ||
695 | char buf[64]; | ||
696 | |||
697 | sound_settings_apply(); | ||
684 | 698 | ||
685 | mpeg_set_buffer_margin(global_settings.buffer_margin); | 699 | mpeg_set_buffer_margin(global_settings.buffer_margin); |
686 | 700 | ||
@@ -1207,9 +1221,14 @@ void settings_reset(void) { | |||
1207 | global_settings.bass = mpeg_sound_default(SOUND_BASS); | 1221 | global_settings.bass = mpeg_sound_default(SOUND_BASS); |
1208 | global_settings.treble = mpeg_sound_default(SOUND_TREBLE); | 1222 | global_settings.treble = mpeg_sound_default(SOUND_TREBLE); |
1209 | global_settings.loudness = mpeg_sound_default(SOUND_LOUDNESS); | 1223 | global_settings.loudness = mpeg_sound_default(SOUND_LOUDNESS); |
1210 | global_settings.bass_boost = mpeg_sound_default(SOUND_SUPERBASS); | ||
1211 | global_settings.avc = mpeg_sound_default(SOUND_AVC); | 1224 | global_settings.avc = mpeg_sound_default(SOUND_AVC); |
1212 | global_settings.channel_config = mpeg_sound_default(SOUND_CHANNELS); | 1225 | global_settings.channel_config = mpeg_sound_default(SOUND_CHANNELS); |
1226 | global_settings.mdb_strength = mpeg_sound_default(SOUND_MDB_STRENGTH); | ||
1227 | global_settings.mdb_harmonics = mpeg_sound_default(SOUND_MDB_HARMONICS); | ||
1228 | global_settings.mdb_center = mpeg_sound_default(SOUND_MDB_CENTER); | ||
1229 | global_settings.mdb_shape = mpeg_sound_default(SOUND_MDB_SHAPE); | ||
1230 | global_settings.mdb_enable = mpeg_sound_default(SOUND_MDB_ENABLE); | ||
1231 | global_settings.superbass = mpeg_sound_default(SOUND_SUPERBASS); | ||
1213 | global_settings.contrast = lcd_default_contrast(); | 1232 | global_settings.contrast = lcd_default_contrast(); |
1214 | global_settings.wps_file[0] = '\0'; | 1233 | global_settings.wps_file[0] = '\0'; |
1215 | global_settings.font_file[0] = '\0'; | 1234 | global_settings.font_file[0] = '\0'; |
diff --git a/apps/settings.h b/apps/settings.h index baea723e4b..b7b0864b4c 100644 --- a/apps/settings.h +++ b/apps/settings.h | |||
@@ -71,9 +71,14 @@ struct user_settings | |||
71 | int bass; /* bass eq: 0-100 0=off 100=max */ | 71 | int bass; /* bass eq: 0-100 0=off 100=max */ |
72 | int treble; /* treble eq: 0-100 0=low 100=high */ | 72 | int treble; /* treble eq: 0-100 0=low 100=high */ |
73 | int loudness; /* loudness eq: 0-100 0=off 100=max */ | 73 | int loudness; /* loudness eq: 0-100 0=off 100=max */ |
74 | int bass_boost; /* bass boost eq: 0-100 0=off 100=max */ | ||
75 | int avc; /* auto volume correct: 0=off, 1=20ms, 2=2s 3=4s 4=8s */ | 74 | int avc; /* auto volume correct: 0=off, 1=20ms, 2=2s 3=4s 4=8s */ |
76 | int channel_config; /* Stereo, Mono, Mono left, Mono right */ | 75 | int channel_config; /* Stereo, Mono, Mono left, Mono right */ |
76 | int mdb_strength; /* 0-127dB */ | ||
77 | int mdb_harmonics; /* 0-100% */ | ||
78 | int mdb_center; /* 20-300Hz */ | ||
79 | int mdb_shape; /* 50-300Hz */ | ||
80 | bool mdb_enable; /* true/false */ | ||
81 | bool superbass; /* true/false */ | ||
77 | 82 | ||
78 | int rec_quality; /* 0-7 */ | 83 | int rec_quality; /* 0-7 */ |
79 | int rec_source; /* 0=mic, 1=line, 2=S/PDIF */ | 84 | int rec_source; /* 0=mic, 1=line, 2=S/PDIF */ |
@@ -226,6 +231,7 @@ struct opt_items { | |||
226 | int settings_save(void); | 231 | int settings_save(void); |
227 | void settings_load(int which); | 232 | void settings_load(int which); |
228 | void settings_reset(void); | 233 | void settings_reset(void); |
234 | void sound_settings_apply(void); | ||
229 | void settings_apply(void); | 235 | void settings_apply(void); |
230 | void settings_apply_pm_range(void); | 236 | void settings_apply_pm_range(void); |
231 | void settings_display(void); | 237 | void settings_display(void); |
diff --git a/apps/sound_menu.c b/apps/sound_menu.c index 4a6857d0cb..fe01cd9560 100644 --- a/apps/sound_menu.c +++ b/apps/sound_menu.c | |||
@@ -55,9 +55,11 @@ bool set_sound(char* string, | |||
55 | char* unit; | 55 | char* unit; |
56 | char str[32]; | 56 | char str[32]; |
57 | int talkunit = UNIT_INT; | 57 | int talkunit = UNIT_INT; |
58 | int steps; | ||
58 | 59 | ||
59 | unit = mpeg_sound_unit(setting); | 60 | unit = mpeg_sound_unit(setting); |
60 | numdec = mpeg_sound_numdecimals(setting); | 61 | numdec = mpeg_sound_numdecimals(setting); |
62 | steps = mpeg_sound_steps(setting); | ||
61 | min = mpeg_sound_min(setting); | 63 | min = mpeg_sound_min(setting); |
62 | max = mpeg_sound_max(setting); | 64 | max = mpeg_sound_max(setting); |
63 | if (*unit == 'd') /* crude reconstruction */ | 65 | if (*unit == 'd') /* crude reconstruction */ |
@@ -103,7 +105,7 @@ bool set_sound(char* string, | |||
103 | case BUTTON_RIGHT: | 105 | case BUTTON_RIGHT: |
104 | case BUTTON_RIGHT | BUTTON_REPEAT: | 106 | case BUTTON_RIGHT | BUTTON_REPEAT: |
105 | #endif | 107 | #endif |
106 | (*variable)++; | 108 | (*variable)+=steps; |
107 | if(*variable > max ) | 109 | if(*variable > max ) |
108 | *variable = max; | 110 | *variable = max; |
109 | changed = true; | 111 | changed = true; |
@@ -116,7 +118,7 @@ bool set_sound(char* string, | |||
116 | case BUTTON_LEFT: | 118 | case BUTTON_LEFT: |
117 | case BUTTON_LEFT | BUTTON_REPEAT: | 119 | case BUTTON_LEFT | BUTTON_REPEAT: |
118 | #endif | 120 | #endif |
119 | (*variable)--; | 121 | (*variable)-=steps; |
120 | if(*variable < min ) | 122 | if(*variable < min ) |
121 | *variable = min; | 123 | *variable = min; |
122 | changed = true; | 124 | changed = true; |
@@ -176,10 +178,56 @@ static bool loudness(void) | |||
176 | SOUND_LOUDNESS); | 178 | SOUND_LOUDNESS); |
177 | } | 179 | } |
178 | 180 | ||
179 | static bool bass_boost(void) | 181 | static bool mdb_strength(void) |
180 | { | 182 | { |
181 | return set_sound(str(LANG_BBOOST), &global_settings.bass_boost, | 183 | return set_sound(str(LANG_MDB_STRENGTH), &global_settings.mdb_strength, |
182 | SOUND_SUPERBASS); | 184 | SOUND_MDB_STRENGTH); |
185 | } | ||
186 | |||
187 | static bool mdb_harmonics(void) | ||
188 | { | ||
189 | return set_sound(str(LANG_MDB_HARMONICS), &global_settings.mdb_harmonics, | ||
190 | SOUND_MDB_HARMONICS); | ||
191 | } | ||
192 | |||
193 | static bool mdb_center(void) | ||
194 | { | ||
195 | return set_sound(str(LANG_MDB_CENTER), &global_settings.mdb_center, | ||
196 | SOUND_MDB_CENTER); | ||
197 | } | ||
198 | |||
199 | static bool mdb_shape(void) | ||
200 | { | ||
201 | return set_sound(str(LANG_MDB_SHAPE), &global_settings.mdb_shape, | ||
202 | SOUND_MDB_SHAPE); | ||
203 | } | ||
204 | |||
205 | static void set_mdb_enable(bool value) | ||
206 | { | ||
207 | mpeg_sound_set(SOUND_MDB_ENABLE, (int)value); | ||
208 | } | ||
209 | |||
210 | static bool mdb_enable(void) | ||
211 | { | ||
212 | return set_bool_options(str(LANG_MDB_ENABLE), | ||
213 | &global_settings.mdb_enable, | ||
214 | STR(LANG_SET_BOOL_YES), | ||
215 | STR(LANG_SET_BOOL_NO), | ||
216 | set_mdb_enable); | ||
217 | } | ||
218 | |||
219 | static void set_superbass(bool value) | ||
220 | { | ||
221 | mpeg_sound_set(SOUND_SUPERBASS, (int)value); | ||
222 | } | ||
223 | |||
224 | static bool superbass(void) | ||
225 | { | ||
226 | return set_bool_options(str(LANG_SUPERBASS), | ||
227 | &global_settings.superbass, | ||
228 | STR(LANG_SET_BOOL_YES), | ||
229 | STR(LANG_SET_BOOL_NO), | ||
230 | set_superbass); | ||
183 | } | 231 | } |
184 | 232 | ||
185 | static void set_avc(int val) | 233 | static void set_avc(int val) |
@@ -363,8 +411,13 @@ bool sound_menu(void) | |||
363 | { STR(LANG_CHANNEL_MENU), chanconf }, | 411 | { STR(LANG_CHANNEL_MENU), chanconf }, |
364 | #ifdef HAVE_MAS3587F | 412 | #ifdef HAVE_MAS3587F |
365 | { STR(LANG_LOUDNESS), loudness }, | 413 | { STR(LANG_LOUDNESS), loudness }, |
366 | { STR(LANG_BBOOST), bass_boost }, | 414 | { STR(LANG_AUTOVOL), avc }, |
367 | { STR(LANG_AUTOVOL), avc } | 415 | { STR(LANG_SUPERBASS), superbass }, |
416 | { STR(LANG_MDB_ENABLE), mdb_enable }, | ||
417 | { STR(LANG_MDB_STRENGTH), mdb_strength }, | ||
418 | { STR(LANG_MDB_HARMONICS), mdb_harmonics }, | ||
419 | { STR(LANG_MDB_CENTER), mdb_center }, | ||
420 | { STR(LANG_MDB_SHAPE), mdb_shape }, | ||
368 | #endif | 421 | #endif |
369 | }; | 422 | }; |
370 | 423 | ||
diff --git a/firmware/export/mp3_playback.h b/firmware/export/mp3_playback.h index ad989a2572..2370614e19 100644 --- a/firmware/export/mp3_playback.h +++ b/firmware/export/mp3_playback.h | |||
@@ -26,7 +26,10 @@ | |||
26 | 26 | ||
27 | /* functions formerly in mpeg.c */ | 27 | /* functions formerly in mpeg.c */ |
28 | void mp3_init(int volume, int bass, int treble, int balance, | 28 | void mp3_init(int volume, int bass, int treble, int balance, |
29 | int loudness, int bass_boost, int avc, int channel_config); | 29 | int loudness, int avc, int channel_config, |
30 | int mdb_strength, int mdb_harmonics, | ||
31 | int mdb_center, int mdb_shape, bool mdb_enable, | ||
32 | bool superbass); | ||
30 | void mpeg_sound_set(int setting, int value); | 33 | void mpeg_sound_set(int setting, int value); |
31 | int mpeg_sound_min(int setting); | 34 | int mpeg_sound_min(int setting); |
32 | int mpeg_sound_max(int setting); | 35 | int mpeg_sound_max(int setting); |
@@ -35,6 +38,7 @@ void mpeg_sound_channel_config(int configuration); | |||
35 | int mpeg_val2phys(int setting, int value); | 38 | int mpeg_val2phys(int setting, int value); |
36 | char *mpeg_sound_unit(int setting); | 39 | char *mpeg_sound_unit(int setting); |
37 | int mpeg_sound_numdecimals(int setting); | 40 | int mpeg_sound_numdecimals(int setting); |
41 | int mpeg_sound_steps(int setting); | ||
38 | #if defined(HAVE_MAS3587F) || defined(SIMULATOR) | 42 | #if defined(HAVE_MAS3587F) || defined(SIMULATOR) |
39 | void mpeg_set_pitch(int percent); | 43 | void mpeg_set_pitch(int percent); |
40 | #endif | 44 | #endif |
@@ -63,13 +67,18 @@ unsigned char* mp3_get_pos(void); | |||
63 | #define SOUND_TREBLE 2 | 67 | #define SOUND_TREBLE 2 |
64 | #define SOUND_BALANCE 3 | 68 | #define SOUND_BALANCE 3 |
65 | #define SOUND_LOUDNESS 4 | 69 | #define SOUND_LOUDNESS 4 |
66 | #define SOUND_SUPERBASS 5 | 70 | #define SOUND_AVC 5 |
67 | #define SOUND_AVC 6 | 71 | #define SOUND_CHANNELS 6 |
68 | #define SOUND_CHANNELS 7 | 72 | #define SOUND_LEFT_GAIN 7 |
69 | #define SOUND_LEFT_GAIN 8 | 73 | #define SOUND_RIGHT_GAIN 8 |
70 | #define SOUND_RIGHT_GAIN 9 | 74 | #define SOUND_MIC_GAIN 9 |
71 | #define SOUND_MIC_GAIN 10 | 75 | #define SOUND_MDB_STRENGTH 10 |
72 | #define SOUND_NUMSETTINGS 11 | 76 | #define SOUND_MDB_HARMONICS 11 |
77 | #define SOUND_MDB_CENTER 12 | ||
78 | #define SOUND_MDB_SHAPE 13 | ||
79 | #define SOUND_MDB_ENABLE 14 | ||
80 | #define SOUND_SUPERBASS 15 | ||
81 | #define SOUND_NUMSETTINGS 16 | ||
73 | 82 | ||
74 | #define MPEG_SOUND_STEREO 0 | 83 | #define MPEG_SOUND_STEREO 0 |
75 | #define MPEG_SOUND_STEREO_NARROW 1 | 84 | #define MPEG_SOUND_STEREO_NARROW 1 |
diff --git a/firmware/mp3_playback.c b/firmware/mp3_playback.c index 5d43458445..b890362776 100644 --- a/firmware/mp3_playback.c +++ b/firmware/mp3_playback.c | |||
@@ -68,12 +68,17 @@ static char *units[] = | |||
68 | "dB", /* Treble */ | 68 | "dB", /* Treble */ |
69 | "%", /* Balance */ | 69 | "%", /* Balance */ |
70 | "dB", /* Loudness */ | 70 | "dB", /* Loudness */ |
71 | "%", /* Bass boost */ | ||
72 | "", /* AVC */ | 71 | "", /* AVC */ |
73 | "", /* Channels */ | 72 | "", /* Channels */ |
74 | "dB", /* Left gain */ | 73 | "dB", /* Left gain */ |
75 | "dB", /* Right gain */ | 74 | "dB", /* Right gain */ |
76 | "dB", /* Mic gain */ | 75 | "dB", /* Mic gain */ |
76 | "dB", /* MDB Strength */ | ||
77 | "%", /* MDB Harmonics */ | ||
78 | "Hz", /* MDB Center */ | ||
79 | "Hz", /* MDB Shape */ | ||
80 | "", /* MDB Enable */ | ||
81 | "", /* Super bass */ | ||
77 | }; | 82 | }; |
78 | 83 | ||
79 | static int numdecimals[] = | 84 | static int numdecimals[] = |
@@ -83,12 +88,37 @@ static int numdecimals[] = | |||
83 | 0, /* Treble */ | 88 | 0, /* Treble */ |
84 | 0, /* Balance */ | 89 | 0, /* Balance */ |
85 | 0, /* Loudness */ | 90 | 0, /* Loudness */ |
86 | 0, /* Bass boost */ | ||
87 | 0, /* AVC */ | 91 | 0, /* AVC */ |
88 | 0, /* Channels */ | 92 | 0, /* Channels */ |
89 | 1, /* Left gain */ | 93 | 1, /* Left gain */ |
90 | 1, /* Right gain */ | 94 | 1, /* Right gain */ |
91 | 1, /* Mic gain */ | 95 | 1, /* Mic gain */ |
96 | 0, /* MDB Strength */ | ||
97 | 0, /* MDB Harmonics */ | ||
98 | 0, /* MDB Center */ | ||
99 | 0, /* MDB Shape */ | ||
100 | 0, /* MDB Enable */ | ||
101 | 0, /* Super bass */ | ||
102 | }; | ||
103 | |||
104 | static int steps[] = | ||
105 | { | ||
106 | 1, /* Volume */ | ||
107 | 1, /* Bass */ | ||
108 | 1, /* Treble */ | ||
109 | 2, /* Balance */ | ||
110 | 1, /* Loudness */ | ||
111 | 1, /* AVC */ | ||
112 | 1, /* Channels */ | ||
113 | 1, /* Left gain */ | ||
114 | 1, /* Right gain */ | ||
115 | 1, /* Mic gain */ | ||
116 | 1, /* MDB Strength */ | ||
117 | 1, /* MDB Harmonics */ | ||
118 | 10, /* MDB Center */ | ||
119 | 10, /* MDB Shape */ | ||
120 | 1, /* MDB Enable */ | ||
121 | 1, /* Super bass */ | ||
92 | }; | 122 | }; |
93 | 123 | ||
94 | static int minval[] = | 124 | static int minval[] = |
@@ -103,12 +133,17 @@ static int minval[] = | |||
103 | #endif | 133 | #endif |
104 | -100, /* Balance */ | 134 | -100, /* Balance */ |
105 | 0, /* Loudness */ | 135 | 0, /* Loudness */ |
106 | 0, /* Bass boost */ | ||
107 | -1, /* AVC */ | 136 | -1, /* AVC */ |
108 | 0, /* Channels */ | 137 | 0, /* Channels */ |
109 | 0, /* Left gain */ | 138 | 0, /* Left gain */ |
110 | 0, /* Right gain */ | 139 | 0, /* Right gain */ |
111 | 0, /* Mic gain */ | 140 | 0, /* Mic gain */ |
141 | 0, /* MDB Strength */ | ||
142 | 0, /* MDB Harmonics */ | ||
143 | 20, /* MDB Center */ | ||
144 | 50, /* MDB Shape */ | ||
145 | 0, /* MDB Enable */ | ||
146 | 0, /* Super bass */ | ||
112 | }; | 147 | }; |
113 | 148 | ||
114 | static int maxval[] = | 149 | static int maxval[] = |
@@ -123,12 +158,17 @@ static int maxval[] = | |||
123 | #endif | 158 | #endif |
124 | 100, /* Balance */ | 159 | 100, /* Balance */ |
125 | 17, /* Loudness */ | 160 | 17, /* Loudness */ |
126 | 100, /* Bass boost */ | ||
127 | 4, /* AVC */ | 161 | 4, /* AVC */ |
128 | 6, /* Channels */ | 162 | 6, /* Channels */ |
129 | 15, /* Left gain */ | 163 | 15, /* Left gain */ |
130 | 15, /* Right gain */ | 164 | 15, /* Right gain */ |
131 | 15, /* Mic gain */ | 165 | 15, /* Mic gain */ |
166 | 127, /* MDB Strength */ | ||
167 | 100, /* MDB Harmonics */ | ||
168 | 300, /* MDB Center */ | ||
169 | 300, /* MDB Shape */ | ||
170 | 1, /* MDB Enable */ | ||
171 | 1, /* Super bass */ | ||
132 | }; | 172 | }; |
133 | 173 | ||
134 | static int defaultval[] = | 174 | static int defaultval[] = |
@@ -143,12 +183,17 @@ static int defaultval[] = | |||
143 | #endif | 183 | #endif |
144 | 0, /* Balance */ | 184 | 0, /* Balance */ |
145 | 0, /* Loudness */ | 185 | 0, /* Loudness */ |
146 | 0, /* Bass boost */ | ||
147 | 0, /* AVC */ | 186 | 0, /* AVC */ |
148 | 0, /* Channels */ | 187 | 0, /* Channels */ |
149 | 8, /* Left gain */ | 188 | 8, /* Left gain */ |
150 | 8, /* Right gain */ | 189 | 8, /* Right gain */ |
151 | 2, /* Mic gain */ | 190 | 2, /* Mic gain */ |
191 | 50, /* MDB Strength */ | ||
192 | 48, /* MDB Harmonics */ | ||
193 | 60, /* MDB Center */ | ||
194 | 90, /* MDB Shape */ | ||
195 | 0, /* MDB Enable */ | ||
196 | 0, /* Super bass */ | ||
152 | }; | 197 | }; |
153 | 198 | ||
154 | char *mpeg_sound_unit(int setting) | 199 | char *mpeg_sound_unit(int setting) |
@@ -161,6 +206,11 @@ int mpeg_sound_numdecimals(int setting) | |||
161 | return numdecimals[setting]; | 206 | return numdecimals[setting]; |
162 | } | 207 | } |
163 | 208 | ||
209 | int mpeg_sound_steps(int setting) | ||
210 | { | ||
211 | return steps[setting]; | ||
212 | } | ||
213 | |||
164 | int mpeg_sound_min(int setting) | 214 | int mpeg_sound_min(int setting) |
165 | { | 215 | { |
166 | return minval[setting]; | 216 | return minval[setting]; |
@@ -566,6 +616,11 @@ void set_prescaled_volume(void) | |||
566 | #endif /* HAVE_MAS3507D */ | 616 | #endif /* HAVE_MAS3507D */ |
567 | #endif /* !SIMULATOR */ | 617 | #endif /* !SIMULATOR */ |
568 | 618 | ||
619 | #ifdef HAVE_MAS3587F | ||
620 | unsigned long mdb_shape_shadow = 0; | ||
621 | unsigned long loudness_shadow = 0; | ||
622 | #endif | ||
623 | |||
569 | void mpeg_sound_set(int setting, int value) | 624 | void mpeg_sound_set(int setting, int value) |
570 | { | 625 | { |
571 | #ifdef SIMULATOR | 626 | #ifdef SIMULATOR |
@@ -645,30 +700,10 @@ void mpeg_sound_set(int setting, int value) | |||
645 | break; | 700 | break; |
646 | 701 | ||
647 | #ifdef HAVE_MAS3587F | 702 | #ifdef HAVE_MAS3587F |
648 | case SOUND_SUPERBASS: | ||
649 | if (value) { | ||
650 | tmp = MAX(MIN(value * 127 / 100, 0x7f), 0); | ||
651 | mas_codec_writereg(MAS_REG_KMDB_STR, (tmp & 0xff) << 8); | ||
652 | tmp = 0x30; /* MDB_HAR: Space for experiment here */ | ||
653 | mas_codec_writereg(MAS_REG_KMDB_HAR, (tmp & 0xff) << 8); | ||
654 | tmp = 60 / 10; /* calculate MDB_FC, 60hz - experiment here, | ||
655 | this would depend on the earphones... | ||
656 | perhaps make it tunable? */ | ||
657 | mas_codec_writereg(MAS_REG_KMDB_FC, (tmp & 0xff) << 8); | ||
658 | tmp = (3 * tmp) / 2; /* calculate MDB_SHAPE */ | ||
659 | mas_codec_writereg(MAS_REG_KMDB_SWITCH, | ||
660 | ((tmp & 0xff) << 8) /* MDB_SHAPE */ | ||
661 | | 2); /* MDB_SWITCH enable */ | ||
662 | } else { | ||
663 | mas_codec_writereg(MAS_REG_KMDB_STR, 0); | ||
664 | mas_codec_writereg(MAS_REG_KMDB_HAR, 0); | ||
665 | mas_codec_writereg(MAS_REG_KMDB_SWITCH, 0); /* MDB_SWITCH disable */ | ||
666 | } | ||
667 | break; | ||
668 | |||
669 | case SOUND_LOUDNESS: | 703 | case SOUND_LOUDNESS: |
670 | tmp = MAX(MIN(value * 4, 0x44), 0); | 704 | loudness_shadow = (loudness_shadow & 0x04) | |
671 | mas_codec_writereg(MAS_REG_KLOUDNESS, (tmp & 0xff) << 8); | 705 | (MAX(MIN(value * 4, 0x44), 0) << 8); |
706 | mas_codec_writereg(MAS_REG_KLOUDNESS, loudness_shadow); | ||
672 | break; | 707 | break; |
673 | 708 | ||
674 | case SOUND_AVC: | 709 | case SOUND_AVC: |
@@ -695,7 +730,36 @@ void mpeg_sound_set(int setting, int value) | |||
695 | } | 730 | } |
696 | mas_codec_writereg(MAS_REG_KAVC, tmp); | 731 | mas_codec_writereg(MAS_REG_KAVC, tmp); |
697 | break; | 732 | break; |
698 | #endif | 733 | |
734 | case SOUND_MDB_STRENGTH: | ||
735 | mas_codec_writereg(MAS_REG_KMDB_STR, (value & 0x7f) << 8); | ||
736 | break; | ||
737 | |||
738 | case SOUND_MDB_HARMONICS: | ||
739 | tmp = value * 127 / 100; | ||
740 | mas_codec_writereg(MAS_REG_KMDB_HAR, (tmp & 0x7f) << 8); | ||
741 | break; | ||
742 | |||
743 | case SOUND_MDB_CENTER: | ||
744 | mas_codec_writereg(MAS_REG_KMDB_FC, (value/10) << 8); | ||
745 | break; | ||
746 | |||
747 | case SOUND_MDB_SHAPE: | ||
748 | mdb_shape_shadow = (mdb_shape_shadow & 0x02) | ((value/10) << 8); | ||
749 | mas_codec_writereg(MAS_REG_KMDB_SWITCH, mdb_shape_shadow); | ||
750 | break; | ||
751 | |||
752 | case SOUND_MDB_ENABLE: | ||
753 | mdb_shape_shadow = (mdb_shape_shadow & ~0x02) | (value?2:0); | ||
754 | mas_codec_writereg(MAS_REG_KMDB_SWITCH, mdb_shape_shadow); | ||
755 | break; | ||
756 | |||
757 | case SOUND_SUPERBASS: | ||
758 | loudness_shadow = (loudness_shadow & ~0x04) | | ||
759 | (value?4:0); | ||
760 | mas_codec_writereg(MAS_REG_KLOUDNESS, loudness_shadow); | ||
761 | break; | ||
762 | #endif | ||
699 | case SOUND_CHANNELS: | 763 | case SOUND_CHANNELS: |
700 | mpeg_sound_channel_config(value); | 764 | mpeg_sound_channel_config(value); |
701 | break; | 765 | break; |
@@ -832,15 +896,36 @@ void mpeg_set_pitch(int pitch) | |||
832 | #endif | 896 | #endif |
833 | 897 | ||
834 | void mp3_init(int volume, int bass, int treble, int balance, int loudness, | 898 | void mp3_init(int volume, int bass, int treble, int balance, int loudness, |
835 | int bass_boost, int avc, int channel_config) | 899 | int avc, int channel_config, |
900 | int mdb_strength, int mdb_harmonics, | ||
901 | int mdb_center, int mdb_shape, bool mdb_enable, | ||
902 | bool superbass) | ||
836 | { | 903 | { |
837 | #ifdef SIMULATOR | 904 | #ifdef SIMULATOR |
838 | volume = bass = treble = balance = loudness | 905 | (void)volume; |
839 | = bass_boost = avc = channel_config; | 906 | (void)bass; |
907 | (void)treble; | ||
908 | (void)balance; | ||
909 | (void)loudness; | ||
910 | (void)avc; | ||
911 | (void)channel_config; | ||
912 | (void)mdb_strength; | ||
913 | (void)mdb_harmonics; | ||
914 | (void)mdb_center; | ||
915 | (void)mdb_shape; | ||
916 | (void)mdb_enable; | ||
917 | (void)superbass; | ||
840 | #else | 918 | #else |
841 | #ifdef HAVE_MAS3507D | 919 | #ifdef HAVE_MAS3507D |
842 | unsigned long val; | 920 | unsigned long val; |
843 | loudness = bass_boost = avc; | 921 | (void)loudness; |
922 | (void)avc; | ||
923 | (void)mdb_strength; | ||
924 | (void)mdb_harmonics; | ||
925 | (void)mdb_center; | ||
926 | (void)mdb_shape; | ||
927 | (void)mdb_enable; | ||
928 | (void)superbass; | ||
844 | #endif | 929 | #endif |
845 | 930 | ||
846 | setup_sci0(); | 931 | setup_sci0(); |
@@ -929,8 +1014,13 @@ void mp3_init(int volume, int bass, int treble, int balance, int loudness, | |||
929 | #ifdef HAVE_MAS3587F | 1014 | #ifdef HAVE_MAS3587F |
930 | mpeg_sound_channel_config(channel_config); | 1015 | mpeg_sound_channel_config(channel_config); |
931 | mpeg_sound_set(SOUND_LOUDNESS, loudness); | 1016 | mpeg_sound_set(SOUND_LOUDNESS, loudness); |
932 | mpeg_sound_set(SOUND_SUPERBASS, bass_boost); | ||
933 | mpeg_sound_set(SOUND_AVC, avc); | 1017 | mpeg_sound_set(SOUND_AVC, avc); |
1018 | mpeg_sound_set(SOUND_MDB_STRENGTH, mdb_strength); | ||
1019 | mpeg_sound_set(SOUND_MDB_HARMONICS, mdb_harmonics); | ||
1020 | mpeg_sound_set(SOUND_MDB_CENTER, mdb_center); | ||
1021 | mpeg_sound_set(SOUND_MDB_SHAPE, mdb_shape); | ||
1022 | mpeg_sound_set(SOUND_MDB_ENABLE, mdb_enable); | ||
1023 | mpeg_sound_set(SOUND_SUPERBASS, superbass); | ||
934 | #endif | 1024 | #endif |
935 | #endif /* !SIMULATOR */ | 1025 | #endif /* !SIMULATOR */ |
936 | 1026 | ||