summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
Diffstat (limited to 'apps')
-rw-r--r--apps/gui/gwps-common.c7
-rw-r--r--apps/gui/statusbar.c39
-rw-r--r--apps/gui/statusbar.h2
-rw-r--r--apps/lang/english.lang30
-rw-r--r--apps/settings.c17
-rw-r--r--apps/settings.h3
-rw-r--r--apps/sound_menu.c18
7 files changed, 33 insertions, 83 deletions
diff --git a/apps/gui/gwps-common.c b/apps/gui/gwps-common.c
index 7590f493e8..307036eda4 100644
--- a/apps/gui/gwps-common.c
+++ b/apps/gui/gwps-common.c
@@ -569,7 +569,10 @@ static char* get_tag(struct wps_data* wps_data,
569 case 'v': /* volume */ 569 case 'v': /* volume */
570 *flags |= WPS_REFRESH_DYNAMIC; 570 *flags |= WPS_REFRESH_DYNAMIC;
571 snprintf(buf, buf_size, "%d", global_settings.volume); 571 snprintf(buf, buf_size, "%d", global_settings.volume);
572 *intval = global_settings.volume / 10 + 1; 572 *intval = 10 * (global_settings.volume
573 - sound_min(SOUND_VOLUME))
574 / (sound_max(SOUND_VOLUME)
575 - sound_min(SOUND_VOLUME)) + 1;
573 return buf; 576 return buf;
574 577
575 } 578 }
@@ -1892,7 +1895,7 @@ bool update_onvol_change(struct gui_wps * gwps)
1892 gui_wps_refresh(gwps, 0, WPS_REFRESH_NON_STATIC); 1895 gui_wps_refresh(gwps, 0, WPS_REFRESH_NON_STATIC);
1893 1896
1894#ifdef HAVE_LCD_CHARCELLS 1897#ifdef HAVE_LCD_CHARCELLS
1895 gui_splash(gwps->display,0, false, "Vol: %d %% ", 1898 gui_splash(gwps->display,0, false, "Vol: %d dB ",
1896 sound_val2phys(SOUND_VOLUME, global_settings.volume)); 1899 sound_val2phys(SOUND_VOLUME, global_settings.volume));
1897 return true; 1900 return true;
1898#endif 1901#endif
diff --git a/apps/gui/statusbar.c b/apps/gui/statusbar.c
index fda54a610e..56d1647d9b 100644
--- a/apps/gui/statusbar.c
+++ b/apps/gui/statusbar.c
@@ -102,7 +102,7 @@ struct gui_syncstatusbar statusbars;
102 102
103void gui_statusbar_init(struct gui_statusbar * bar) 103void gui_statusbar_init(struct gui_statusbar * bar)
104{ 104{
105 bar->last_volume = -1; /* -1 means "first update ever" */ 105 bar->last_volume = -1000; /* -1000 means "first update ever" */
106 bar->battery_icon_switch_tick = 0; 106 bar->battery_icon_switch_tick = 0;
107#ifdef HAVE_CHARGING 107#ifdef HAVE_CHARGING
108 bar->battery_charge_step = 0; 108 bar->battery_charge_step = 0;
@@ -117,6 +117,7 @@ void gui_statusbar_draw(struct gui_statusbar * bar, bool force_redraw)
117#endif /* CONFIG_RTC */ 117#endif /* CONFIG_RTC */
118 118
119#ifdef HAVE_LCD_CHARCELLS 119#ifdef HAVE_LCD_CHARCELLS
120 int vol;
120 (void)force_redraw; /* players always "redraw" */ 121 (void)force_redraw; /* players always "redraw" */
121#endif /* HAVE_LCD_CHARCELLS */ 122#endif /* HAVE_LCD_CHARCELLS */
122 123
@@ -277,12 +278,14 @@ void gui_statusbar_draw(struct gui_statusbar * bar, bool force_redraw)
277 display->icon(ICON_BATTERY_2, bar->info.battlevel > 50); 278 display->icon(ICON_BATTERY_2, bar->info.battlevel > 50);
278 display->icon(ICON_BATTERY_3, bar->info.battlevel > 75); 279 display->icon(ICON_BATTERY_3, bar->info.battlevel > 75);
279 280
281 vol = 100 * (bar->info.volume - sound_min(SOUND_VOLUME))
282 / (sound_max(SOUND_VOLUME) - sound_min(SOUND_VOLUME));
280 display->icon(ICON_VOLUME, true); 283 display->icon(ICON_VOLUME, true);
281 display->icon(ICON_VOLUME_1, bar->info.volume > 10); 284 display->icon(ICON_VOLUME_1, vol > 10);
282 display->icon(ICON_VOLUME_2, bar->info.volume > 30); 285 display->icon(ICON_VOLUME_2, vol > 30);
283 display->icon(ICON_VOLUME_3, bar->info.volume > 50); 286 display->icon(ICON_VOLUME_3, vol > 50);
284 display->icon(ICON_VOLUME_4, bar->info.volume > 70); 287 display->icon(ICON_VOLUME_4, vol > 70);
285 display->icon(ICON_VOLUME_5, bar->info.volume > 90); 288 display->icon(ICON_VOLUME_5, vol > 90);
286 289
287 display->icon(ICON_PLAY, current_playmode() == STATUS_PLAY); 290 display->icon(ICON_PLAY, current_playmode() == STATUS_PLAY);
288 display->icon(ICON_PAUSE, current_playmode() == STATUS_PAUSE); 291 display->icon(ICON_PAUSE, current_playmode() == STATUS_PAUSE);
@@ -356,31 +359,31 @@ void gui_statusbar_icon_battery(struct screen * display, int percent)
356/* 359/*
357 * Print volume gauge to status bar 360 * Print volume gauge to status bar
358 */ 361 */
359bool gui_statusbar_icon_volume(struct gui_statusbar * bar, int percent) 362bool gui_statusbar_icon_volume(struct gui_statusbar * bar, int volume)
360{ 363{
361 int i; 364 int i;
362 int volume;
363 int vol; 365 int vol;
364 char buffer[4]; 366 char buffer[4];
365 unsigned int width, height; 367 unsigned int width, height;
366 bool needs_redraw = false; 368 bool needs_redraw = false;
367 int type = global_settings.volume_type; 369 int type = global_settings.volume_type;
368 struct screen * display=bar->display; 370 struct screen * display=bar->display;
371 int minvol = sound_min(SOUND_VOLUME);
372 int maxvol = sound_max(SOUND_VOLUME);
369 373
370 volume = percent; 374 if (volume < minvol)
371 if (volume < 0) 375 volume = minvol;
372 volume = 0; 376 if (volume > maxvol)
373 if (volume > 100) 377 volume = maxvol;
374 volume = 100;
375 378
376 if (volume == 0) { 379 if (volume == minvol) {
377 display->mono_bitmap(bitmap_icons_7x8[Icon_Mute], 380 display->mono_bitmap(bitmap_icons_7x8[Icon_Mute],
378 STATUSBAR_VOLUME_X_POS + STATUSBAR_VOLUME_WIDTH / 2 - 4, 381 STATUSBAR_VOLUME_X_POS + STATUSBAR_VOLUME_WIDTH / 2 - 4,
379 STATUSBAR_Y_POS, 7, STATUSBAR_HEIGHT); 382 STATUSBAR_Y_POS, 7, STATUSBAR_HEIGHT);
380 } 383 }
381 else { 384 else {
382 /* We want to redraw the icon later on */ 385 /* We want to redraw the icon later on */
383 if (bar->last_volume != volume && bar->last_volume >= 0) { 386 if (bar->last_volume != volume && bar->last_volume >= minvol) {
384 bar->volume_icon_switch_tick = current_tick + HZ; 387 bar->volume_icon_switch_tick = current_tick + HZ;
385 } 388 }
386 389
@@ -395,7 +398,7 @@ bool gui_statusbar_icon_volume(struct gui_statusbar * bar, int percent)
395 if (type) 398 if (type)
396 { 399 {
397 display->setfont(FONT_SYSFIXED); 400 display->setfont(FONT_SYSFIXED);
398 snprintf(buffer, sizeof(buffer), "%2d", percent); 401 snprintf(buffer, sizeof(buffer), "%2d", volume);
399 display->getstringsize(buffer, &width, &height); 402 display->getstringsize(buffer, &width, &height);
400 if (height <= STATUSBAR_HEIGHT) 403 if (height <= STATUSBAR_HEIGHT)
401 { 404 {
@@ -406,7 +409,7 @@ bool gui_statusbar_icon_volume(struct gui_statusbar * bar, int percent)
406 display->setfont(FONT_UI); 409 display->setfont(FONT_UI);
407 } else { 410 } else {
408 /* display volume bar */ 411 /* display volume bar */
409 vol = volume * 14 / 100; 412 vol = (volume - minvol) * 14 / (maxvol - minvol);
410 for(i=0; i < vol; i++) { 413 for(i=0; i < vol; i++) {
411 display->vline(STATUSBAR_VOLUME_X_POS + i, 414 display->vline(STATUSBAR_VOLUME_X_POS + i,
412 STATUSBAR_Y_POS + 6 - i / 2, 415 STATUSBAR_Y_POS + 6 - i / 2,
diff --git a/apps/gui/statusbar.h b/apps/gui/statusbar.h
index 6b8e49a838..650b49d63b 100644
--- a/apps/gui/statusbar.h
+++ b/apps/gui/statusbar.h
@@ -102,7 +102,7 @@ extern void gui_statusbar_init(struct gui_statusbar * bar);
102extern void gui_statusbar_draw(struct gui_statusbar * bar, bool force_redraw); 102extern void gui_statusbar_draw(struct gui_statusbar * bar, bool force_redraw);
103 103
104void gui_statusbar_icon_battery(struct screen * display, int percent); 104void gui_statusbar_icon_battery(struct screen * display, int percent);
105bool gui_statusbar_icon_volume(struct gui_statusbar * bar, int percent); 105bool gui_statusbar_icon_volume(struct gui_statusbar * bar, int volume);
106void gui_statusbar_icon_play_state(struct screen * display, int state); 106void gui_statusbar_icon_play_state(struct screen * display, int state);
107void gui_statusbar_icon_play_mode(struct screen * display, int mode); 107void gui_statusbar_icon_play_mode(struct screen * display, int mode);
108void gui_statusbar_icon_shuffle(struct screen * display); 108void gui_statusbar_icon_shuffle(struct screen * display);
diff --git a/apps/lang/english.lang b/apps/lang/english.lang
index 3595281209..1f0ef87ca4 100644
--- a/apps/lang/english.lang
+++ b/apps/lang/english.lang
@@ -3550,33 +3550,3 @@ desc: in radio screen / menu
3550eng: "Mode:" 3550eng: "Mode:"
3551voice: "" 3551voice: ""
3552new: 3552new:
3553
3554id: LANG_SCALING_MODE
3555desc: in sound_settings. How to scale volume/bass to prevent clipping
3556eng: "Prevent clipping"
3557voice: "Prevent clipping"
3558new:
3559
3560id: LANG_SCALE_OFF
3561desc: in sound_settings. Do not reduce volume/bass
3562eng: "Off"
3563voice: "Off"
3564new:
3565
3566id: LANG_SCALE_VOLUME
3567desc: in sound_settings. Reduce volume
3568eng: "Adjust volume"
3569voice: "Adjust volume"
3570new:
3571
3572id: LANG_SCALE_BASS
3573desc: in sound_settings. Reduce bass
3574eng: "Adjust bass"
3575voice: "Adjust bass"
3576new:
3577
3578id: LANG_SCALE_CURRENT
3579desc: in sound_settings. Reduce other metric than currently modified
3580eng: "Adjust current"
3581voice: "Adjust current"
3582new:
diff --git a/apps/settings.c b/apps/settings.c
index d3441630fd..bd6076dc93 100644
--- a/apps/settings.c
+++ b/apps/settings.c
@@ -85,7 +85,7 @@ const char rec_base_directory[] = REC_BASE_DIR;
85#include "dsp.h" 85#include "dsp.h"
86#endif 86#endif
87 87
88#define CONFIG_BLOCK_VERSION 35 88#define CONFIG_BLOCK_VERSION 36
89#define CONFIG_BLOCK_SIZE 512 89#define CONFIG_BLOCK_SIZE 512
90#define RTC_BLOCK_SIZE 44 90#define RTC_BLOCK_SIZE 44
91 91
@@ -193,7 +193,11 @@ static const struct bit_entry rtc_bits[] =
193 193
194 /* # of bits, offset+size, default, .cfg name, .cfg values */ 194 /* # of bits, offset+size, default, .cfg name, .cfg values */
195 /* sound */ 195 /* sound */
196 {7, S_O(volume), 70, "volume", NULL }, /* 0...100 */ 196#if CONFIG_CODEC == MAS3507D
197 {8 | SIGNED, S_O(volume), -18, "volume", NULL }, /* -78...+18 */
198#else
199 {8 | SIGNED, S_O(volume), -25, "volume", NULL }, /* -100...+12 / -84...0 */
200#endif
197 {8 | SIGNED, S_O(balance), 0, "balance", NULL }, /* -100...100 */ 201 {8 | SIGNED, S_O(balance), 0, "balance", NULL }, /* -100...100 */
198#if CONFIG_CODEC != SWCODEC /* any MAS */ 202#if CONFIG_CODEC != SWCODEC /* any MAS */
199 {5 | SIGNED, S_O(bass), 0, "bass", NULL }, /* -15..+15 / -12..+12 */ 203 {5 | SIGNED, S_O(bass), 0, "bass", NULL }, /* -15..+15 / -12..+12 */
@@ -210,9 +214,6 @@ static const struct bit_entry rtc_bits[] =
210 {3, S_O(channel_config), 0, "channels", 214 {3, S_O(channel_config), 0, "channels",
211 "stereo,mono,custom,mono left,mono right,karaoke" }, 215 "stereo,mono,custom,mono left,mono right,karaoke" },
212 {8, S_O(stereo_width), 100, "stereo width", NULL}, 216 {8, S_O(stereo_width), 100, "stereo width", NULL},
213#ifdef HAVE_UDA1380
214 {2, S_O(sound_scaling), SOUND_SCALE_VOLUME, "prevent clipping", "adjust volume,adjust bass,adjust current,off"},
215#endif
216 /* playback */ 217 /* playback */
217 {1, S_O(resume), false, "resume", off_on }, 218 {1, S_O(resume), false, "resume", off_on },
218 {1, S_O(playlist_shuffle), false, "shuffle", off_on }, 219 {1, S_O(playlist_shuffle), false, "shuffle", off_on },
@@ -842,9 +843,6 @@ void sound_settings_apply(void)
842 sound_set(SOUND_VOLUME, global_settings.volume); 843 sound_set(SOUND_VOLUME, global_settings.volume);
843 sound_set(SOUND_CHANNELS, global_settings.channel_config); 844 sound_set(SOUND_CHANNELS, global_settings.channel_config);
844 sound_set(SOUND_STEREO_WIDTH, global_settings.stereo_width); 845 sound_set(SOUND_STEREO_WIDTH, global_settings.stereo_width);
845#ifdef HAVE_UDA1380
846 sound_set(SOUND_SCALING, global_settings.sound_scaling);
847#endif
848#if (CONFIG_CODEC == MAS3587F) || (CONFIG_CODEC == MAS3539F) 846#if (CONFIG_CODEC == MAS3587F) || (CONFIG_CODEC == MAS3539F)
849 sound_set(SOUND_LOUDNESS, global_settings.loudness); 847 sound_set(SOUND_LOUDNESS, global_settings.loudness);
850 sound_set(SOUND_AVC, global_settings.avc); 848 sound_set(SOUND_AVC, global_settings.avc);
@@ -1429,9 +1427,6 @@ void settings_reset(void) {
1429 global_settings.treble = sound_default(SOUND_TREBLE); 1427 global_settings.treble = sound_default(SOUND_TREBLE);
1430 global_settings.channel_config = sound_default(SOUND_CHANNELS); 1428 global_settings.channel_config = sound_default(SOUND_CHANNELS);
1431 global_settings.stereo_width = sound_default(SOUND_STEREO_WIDTH); 1429 global_settings.stereo_width = sound_default(SOUND_STEREO_WIDTH);
1432#ifdef HAVE_UDA1380
1433 global_settings.sound_scaling = sound_default(SOUND_SCALING);
1434#endif
1435#if (CONFIG_CODEC == MAS3587F) || (CONFIG_CODEC == MAS3539F) 1430#if (CONFIG_CODEC == MAS3587F) || (CONFIG_CODEC == MAS3539F)
1436 global_settings.loudness = sound_default(SOUND_LOUDNESS); 1431 global_settings.loudness = sound_default(SOUND_LOUDNESS);
1437 global_settings.avc = sound_default(SOUND_AVC); 1432 global_settings.avc = sound_default(SOUND_AVC);
diff --git a/apps/settings.h b/apps/settings.h
index 6b34543c27..b1e8c9e2e8 100644
--- a/apps/settings.h
+++ b/apps/settings.h
@@ -157,9 +157,6 @@ struct user_settings
157 int avc; /* auto volume correct: 0=off, 1=20ms, 2=2s 3=4s 4=8s */ 157 int avc; /* auto volume correct: 0=off, 1=20ms, 2=2s 3=4s 4=8s */
158 int channel_config; /* Stereo, Mono, Custom, Mono left, Mono right, Karaoke */ 158 int channel_config; /* Stereo, Mono, Custom, Mono left, Mono right, Karaoke */
159 int stereo_width; /* 0-255% */ 159 int stereo_width; /* 0-255% */
160#ifdef HAVE_UDA1380
161 int sound_scaling; /* Off, Volume, Bass, Current metric */
162#endif
163 int mdb_strength; /* 0-127dB */ 160 int mdb_strength; /* 0-127dB */
164 int mdb_harmonics; /* 0-100% */ 161 int mdb_harmonics; /* 0-100% */
165 int mdb_center; /* 20-300Hz */ 162 int mdb_center; /* 20-300Hz */
diff --git a/apps/sound_menu.c b/apps/sound_menu.c
index f97cdde2ab..e44aa68231 100644
--- a/apps/sound_menu.c
+++ b/apps/sound_menu.c
@@ -366,21 +366,6 @@ static bool stereo_width(void)
366 SOUND_STEREO_WIDTH); 366 SOUND_STEREO_WIDTH);
367} 367}
368 368
369#ifdef HAVE_UDA1380
370static bool sound_scaling(void)
371{
372 static const struct opt_items names[] = {
373 { STR(LANG_SCALE_VOLUME) },
374 { STR(LANG_SCALE_BASS) },
375 { STR(LANG_SCALE_CURRENT)},
376 { STR(LANG_SCALE_OFF) }
377 };
378
379 return set_option(str(LANG_SCALING_MODE), &global_settings.sound_scaling, INT,
380 names, 4, sound_set_scaling);
381}
382#endif
383
384bool sound_menu(void) 369bool sound_menu(void)
385{ 370{
386 int m; 371 int m;
@@ -395,9 +380,6 @@ bool sound_menu(void)
395#if CONFIG_CODEC == SWCODEC 380#if CONFIG_CODEC == SWCODEC
396 { ID2P(LANG_CROSSFEED), crossfeed }, 381 { ID2P(LANG_CROSSFEED), crossfeed },
397#endif 382#endif
398#ifdef HAVE_UDA1380
399 { ID2P(LANG_SCALING_MODE), sound_scaling },
400#endif
401#if (CONFIG_CODEC == MAS3587F) || (CONFIG_CODEC == MAS3539F) 383#if (CONFIG_CODEC == MAS3587F) || (CONFIG_CODEC == MAS3539F)
402 { ID2P(LANG_LOUDNESS), loudness }, 384 { ID2P(LANG_LOUDNESS), loudness },
403 { ID2P(LANG_AUTOVOL), avc }, 385 { ID2P(LANG_AUTOVOL), avc },