diff options
-rw-r--r-- | apps/lang/english-us.lang | 51 | ||||
-rw-r--r-- | apps/lang/english.lang | 51 | ||||
-rw-r--r-- | apps/menus/sound_menu.c | 7 | ||||
-rw-r--r-- | apps/settings.c | 3 | ||||
-rw-r--r-- | apps/settings.h | 4 | ||||
-rw-r--r-- | apps/settings_list.c | 6 | ||||
-rw-r--r-- | firmware/drivers/audio/sdl.c | 4 | ||||
-rw-r--r-- | firmware/export/audiohw.h | 15 | ||||
-rw-r--r-- | firmware/export/audiohw_settings.h | 3 | ||||
-rw-r--r-- | firmware/export/sound.h | 4 | ||||
-rw-r--r-- | firmware/sound.c | 13 |
11 files changed, 161 insertions, 0 deletions
diff --git a/apps/lang/english-us.lang b/apps/lang/english-us.lang index cd7bfe0abf..0dc53e7110 100644 --- a/apps/lang/english-us.lang +++ b/apps/lang/english-us.lang | |||
@@ -12015,6 +12015,57 @@ | |||
12015 | </voice> | 12015 | </voice> |
12016 | </phrase> | 12016 | </phrase> |
12017 | <phrase> | 12017 | <phrase> |
12018 | id: LANG_DAC_POWER_MODE | ||
12019 | desc: in sound settings | ||
12020 | user: core | ||
12021 | <source> | ||
12022 | *: none | ||
12023 | dac_power_mode: "DAC's power mode" | ||
12024 | </source> | ||
12025 | <dest> | ||
12026 | *: none | ||
12027 | dac_power_mode: "DAC power mode" | ||
12028 | </dest> | ||
12029 | <voice> | ||
12030 | *: none | ||
12031 | dac_power_mode: "DAC power mode" | ||
12032 | </voice> | ||
12033 | </phrase> | ||
12034 | <phrase> | ||
12035 | id: LANG_DAC_POWER_HIGH | ||
12036 | desc: in sound settings | ||
12037 | user: core | ||
12038 | <source> | ||
12039 | *: none | ||
12040 | dac_power_mode: "High performance" | ||
12041 | </source> | ||
12042 | <dest> | ||
12043 | *: none | ||
12044 | dac_power_mode: "High performance" | ||
12045 | </dest> | ||
12046 | <voice> | ||
12047 | *: none | ||
12048 | dac_power_mode: "High performance" | ||
12049 | </voice> | ||
12050 | </phrase> | ||
12051 | <phrase> | ||
12052 | id: LANG_DAC_POWER_LOW | ||
12053 | desc: in sound settings | ||
12054 | user: core | ||
12055 | <source> | ||
12056 | *: none | ||
12057 | dac_power_mode: "Save battery" | ||
12058 | </source> | ||
12059 | <dest> | ||
12060 | *: none | ||
12061 | dac_power_mode: "Save battery" | ||
12062 | </dest> | ||
12063 | <voice> | ||
12064 | *: none | ||
12065 | dac_power_mode: "Save battery" | ||
12066 | </voice> | ||
12067 | </phrase> | ||
12068 | <phrase> | ||
12018 | id: VOICE_BLACK | 12069 | id: VOICE_BLACK |
12019 | desc: spoken only, for announcing chess piece color | 12070 | desc: spoken only, for announcing chess piece color |
12020 | user: core | 12071 | user: core |
diff --git a/apps/lang/english.lang b/apps/lang/english.lang index 8365e9d265..5b8391b859 100644 --- a/apps/lang/english.lang +++ b/apps/lang/english.lang | |||
@@ -12208,6 +12208,57 @@ | |||
12208 | </voice> | 12208 | </voice> |
12209 | </phrase> | 12209 | </phrase> |
12210 | <phrase> | 12210 | <phrase> |
12211 | id: LANG_DAC_POWER_MODE | ||
12212 | desc: in sound settings | ||
12213 | user: core | ||
12214 | <source> | ||
12215 | *: none | ||
12216 | dac_power_mode: "DAC's power mode" | ||
12217 | </source> | ||
12218 | <dest> | ||
12219 | *: none | ||
12220 | dac_power_mode: "DAC's power mode" | ||
12221 | </dest> | ||
12222 | <voice> | ||
12223 | *: none | ||
12224 | dac_power_mode: "DAC's power mode" | ||
12225 | </voice> | ||
12226 | </phrase> | ||
12227 | <phrase> | ||
12228 | id: LANG_DAC_POWER_HIGH | ||
12229 | desc: in sound settings | ||
12230 | user: core | ||
12231 | <source> | ||
12232 | *: none | ||
12233 | dac_power_mode: "High performance" | ||
12234 | </source> | ||
12235 | <dest> | ||
12236 | *: none | ||
12237 | dac_power_mode: "High performance" | ||
12238 | </dest> | ||
12239 | <voice> | ||
12240 | *: none | ||
12241 | dac_power_mode: "High performance" | ||
12242 | </voice> | ||
12243 | </phrase> | ||
12244 | <phrase> | ||
12245 | id: LANG_DAC_POWER_LOW | ||
12246 | desc: in sound settings | ||
12247 | user: core | ||
12248 | <source> | ||
12249 | *: none | ||
12250 | dac_power_mode: "Save battery" | ||
12251 | </source> | ||
12252 | <dest> | ||
12253 | *: none | ||
12254 | dac_power_mode: "Save battery" | ||
12255 | </dest> | ||
12256 | <voice> | ||
12257 | *: none | ||
12258 | dac_power_mode: "Save battery" | ||
12259 | </voice> | ||
12260 | </phrase> | ||
12261 | <phrase> | ||
12211 | id: LANG_VOLUME_LIMIT | 12262 | id: LANG_VOLUME_LIMIT |
12212 | desc: in sound_settings | 12263 | desc: in sound_settings |
12213 | user: core | 12264 | user: core |
diff --git a/apps/menus/sound_menu.c b/apps/menus/sound_menu.c index 174329fcc8..9cbc76e474 100644 --- a/apps/menus/sound_menu.c +++ b/apps/menus/sound_menu.c | |||
@@ -122,6 +122,10 @@ MENUITEM_SETTING(depth_3d, &global_settings.depth_3d, NULL); | |||
122 | MENUITEM_SETTING(roll_off, &global_settings.roll_off, NULL); | 122 | MENUITEM_SETTING(roll_off, &global_settings.roll_off, NULL); |
123 | #endif | 123 | #endif |
124 | 124 | ||
125 | #ifdef AUDIOHW_HAVE_POWER_MODE | ||
126 | MENUITEM_SETTING(power_mode, &global_settings.power_mode, NULL); | ||
127 | #endif | ||
128 | |||
125 | #ifdef AUDIOHW_HAVE_FUNCTIONAL_MODE | 129 | #ifdef AUDIOHW_HAVE_FUNCTIONAL_MODE |
126 | MENUITEM_SETTING(func_mode, &global_settings.func_mode, NULL); | 130 | MENUITEM_SETTING(func_mode, &global_settings.func_mode, NULL); |
127 | #endif | 131 | #endif |
@@ -240,6 +244,9 @@ MAKE_MENU(sound_settings, ID2P(LANG_SOUND_SETTINGS), NULL, Icon_Audio, | |||
240 | #ifdef AUDIOHW_HAVE_FILTER_ROLL_OFF | 244 | #ifdef AUDIOHW_HAVE_FILTER_ROLL_OFF |
241 | ,&roll_off | 245 | ,&roll_off |
242 | #endif | 246 | #endif |
247 | #ifdef AUDIOHW_HAVE_POWER_MODE | ||
248 | ,&power_mode | ||
249 | #endif | ||
243 | #ifdef AUDIOHW_HAVE_FUNCTIONAL_MODE | 250 | #ifdef AUDIOHW_HAVE_FUNCTIONAL_MODE |
244 | ,&func_mode | 251 | ,&func_mode |
245 | #endif | 252 | #endif |
diff --git a/apps/settings.c b/apps/settings.c index 43a010aeb2..99cede382b 100644 --- a/apps/settings.c +++ b/apps/settings.c | |||
@@ -746,6 +746,9 @@ void sound_settings_apply(void) | |||
746 | #ifdef AUDIOHW_HAVE_FILTER_ROLL_OFF | 746 | #ifdef AUDIOHW_HAVE_FILTER_ROLL_OFF |
747 | sound_set(SOUND_FILTER_ROLL_OFF, global_settings.roll_off); | 747 | sound_set(SOUND_FILTER_ROLL_OFF, global_settings.roll_off); |
748 | #endif | 748 | #endif |
749 | #ifdef AUDIOHW_HAVE_POWER_MODE | ||
750 | sound_set(SOUND_POWER_MODE, global_settings.power_mode); | ||
751 | #endif | ||
749 | #ifdef AUDIOHW_HAVE_EQ | 752 | #ifdef AUDIOHW_HAVE_EQ |
750 | int b; | 753 | int b; |
751 | 754 | ||
diff --git a/apps/settings.h b/apps/settings.h index cc60617de4..1ff7bbe5d1 100644 --- a/apps/settings.h +++ b/apps/settings.h | |||
@@ -782,6 +782,10 @@ struct user_settings | |||
782 | int roll_off; | 782 | int roll_off; |
783 | #endif | 783 | #endif |
784 | 784 | ||
785 | #ifdef AUDIOHW_HAVE_POWER_MODE | ||
786 | int power_mode; | ||
787 | #endif | ||
788 | |||
785 | #ifdef AUDIOHW_HAVE_FUNCTIONAL_MODE | 789 | #ifdef AUDIOHW_HAVE_FUNCTIONAL_MODE |
786 | int func_mode; | 790 | int func_mode; |
787 | #endif | 791 | #endif |
diff --git a/apps/settings_list.c b/apps/settings_list.c index e5c02f6bf3..1b06bfe11c 100644 --- a/apps/settings_list.c +++ b/apps/settings_list.c | |||
@@ -859,6 +859,12 @@ const struct settings_list settings[] = { | |||
859 | #endif | 859 | #endif |
860 | #endif | 860 | #endif |
861 | 861 | ||
862 | #ifdef AUDIOHW_HAVE_POWER_MODE | ||
863 | CHOICE_SETTING(F_SOUNDSETTING, power_mode, LANG_DAC_POWER_MODE, 0, | ||
864 | "dac_power_mode", "high,low", sound_set_power_mode, | ||
865 | 2, ID2P(LANG_DAC_POWER_HIGH), ID2P(LANG_DAC_POWER_LOW)), | ||
866 | #endif | ||
867 | |||
862 | /* playback */ | 868 | /* playback */ |
863 | OFFON_SETTING(0, playlist_shuffle, LANG_SHUFFLE, false, "shuffle", NULL), | 869 | OFFON_SETTING(0, playlist_shuffle, LANG_SHUFFLE, false, "shuffle", NULL), |
864 | SYSTEM_SETTING(NVRAM(4), resume_index, -1), | 870 | SYSTEM_SETTING(NVRAM(4), resume_index, -1), |
diff --git a/firmware/drivers/audio/sdl.c b/firmware/drivers/audio/sdl.c index fb49a291d1..89f40baedf 100644 --- a/firmware/drivers/audio/sdl.c +++ b/firmware/drivers/audio/sdl.c | |||
@@ -118,6 +118,10 @@ void audiohw_set_lineout_volume(int vol_l, int vol_r) | |||
118 | void audiohw_set_filter_roll_off(int value) | 118 | void audiohw_set_filter_roll_off(int value) |
119 | { (void)value; } | 119 | { (void)value; } |
120 | #endif | 120 | #endif |
121 | #if defined(AUDIOHW_HAVE_POWER_MODE) | ||
122 | void audiohw_set_power_mode(int value) | ||
123 | { (void)value; } | ||
124 | #endif | ||
121 | 125 | ||
122 | void audiohw_close(void) {} | 126 | void audiohw_close(void) {} |
123 | 127 | ||
diff --git a/firmware/export/audiohw.h b/firmware/export/audiohw.h index 8a46cbea78..d862c977db 100644 --- a/firmware/export/audiohw.h +++ b/firmware/export/audiohw.h | |||
@@ -41,6 +41,7 @@ | |||
41 | #define LIN_GAIN_CAP (1 << 11) | 41 | #define LIN_GAIN_CAP (1 << 11) |
42 | #define MIC_GAIN_CAP (1 << 12) | 42 | #define MIC_GAIN_CAP (1 << 12) |
43 | #define FILTER_ROLL_OFF_CAP (1 << 13) | 43 | #define FILTER_ROLL_OFF_CAP (1 << 13) |
44 | #define POWER_MODE_CAP (1 << 14) | ||
44 | 45 | ||
45 | /* Used by every driver to export its min/max/default values for its audio | 46 | /* Used by every driver to export its min/max/default values for its audio |
46 | settings. */ | 47 | settings. */ |
@@ -391,6 +392,10 @@ enum AUDIOHW_EQ_SETTINGS | |||
391 | #define AUDIOHW_HAVE_FILTER_ROLL_OFF | 392 | #define AUDIOHW_HAVE_FILTER_ROLL_OFF |
392 | #endif | 393 | #endif |
393 | 394 | ||
395 | #if (AUDIOHW_CAPS & POWER_MODE_CAP) | ||
396 | #define AUDIOHW_HAVE_POWER_MODE | ||
397 | #endif | ||
398 | |||
394 | #endif /* AUDIOHW_CAPS */ | 399 | #endif /* AUDIOHW_CAPS */ |
395 | 400 | ||
396 | #ifdef HAVE_SW_TONE_CONTROLS | 401 | #ifdef HAVE_SW_TONE_CONTROLS |
@@ -586,6 +591,16 @@ void audiohw_set_depth_3d(int val); | |||
586 | void audiohw_set_filter_roll_off(int val); | 591 | void audiohw_set_filter_roll_off(int val); |
587 | #endif | 592 | #endif |
588 | 593 | ||
594 | #ifdef AUDIOHW_HAVE_POWER_MODE | ||
595 | /** | ||
596 | * Set DAC's power saving mode. | ||
597 | * @param enable 0 - highest performance, 1 - battery saving | ||
598 | * NOTE: AUDIOHW_CAPS need to contain | ||
599 | * POWER_MODE_CAP | ||
600 | */ | ||
601 | void audiohw_set_power_mode(int mode); | ||
602 | #endif | ||
603 | |||
589 | void audiohw_set_frequency(int fsel); | 604 | void audiohw_set_frequency(int fsel); |
590 | 605 | ||
591 | #ifdef HAVE_RECORDING | 606 | #ifdef HAVE_RECORDING |
diff --git a/firmware/export/audiohw_settings.h b/firmware/export/audiohw_settings.h index 1d3e0dc12f..8010963ea4 100644 --- a/firmware/export/audiohw_settings.h +++ b/firmware/export/audiohw_settings.h | |||
@@ -103,6 +103,9 @@ AUDIOHW_SETTINGS( | |||
103 | #if defined(AUDIOHW_HAVE_FILTER_ROLL_OFF) | 103 | #if defined(AUDIOHW_HAVE_FILTER_ROLL_OFF) |
104 | AUDIOHW_SETTING_ENT(FILTER_ROLL_OFF, sound_set_filter_roll_off) | 104 | AUDIOHW_SETTING_ENT(FILTER_ROLL_OFF, sound_set_filter_roll_off) |
105 | #endif | 105 | #endif |
106 | #if defined(AUDIOHW_HAVE_POWER_MODE) | ||
107 | AUDIOHW_SETTING_ENT(POWER_MODE, sound_set_power_mode) | ||
108 | #endif | ||
106 | /* Hardware EQ tone controls */ | 109 | /* Hardware EQ tone controls */ |
107 | #if defined(AUDIOHW_HAVE_EQ) | 110 | #if defined(AUDIOHW_HAVE_EQ) |
108 | AUDIOHW_SETTING_ENT(EQ_BAND1_GAIN, sound_set_hw_eq_band1_gain) | 111 | AUDIOHW_SETTING_ENT(EQ_BAND1_GAIN, sound_set_hw_eq_band1_gain) |
diff --git a/firmware/export/sound.h b/firmware/export/sound.h index 2e04cac854..8e79dd0aed 100644 --- a/firmware/export/sound.h +++ b/firmware/export/sound.h | |||
@@ -57,6 +57,10 @@ void sound_set_depth_3d(int value); | |||
57 | void sound_set_filter_roll_off(int value); | 57 | void sound_set_filter_roll_off(int value); |
58 | #endif | 58 | #endif |
59 | 59 | ||
60 | #if defined(AUDIOHW_HAVE_POWER_MODE) | ||
61 | void sound_set_power_mode(int value); | ||
62 | #endif | ||
63 | |||
60 | #ifdef AUDIOHW_HAVE_EQ | 64 | #ifdef AUDIOHW_HAVE_EQ |
61 | /* | 65 | /* |
62 | * band = SOUND_EQ_BANDb | 66 | * band = SOUND_EQ_BANDb |
diff --git a/firmware/sound.c b/firmware/sound.c index 71bdc25003..6fe6115406 100644 --- a/firmware/sound.c +++ b/firmware/sound.c | |||
@@ -145,6 +145,9 @@ int sound_current(int setting) | |||
145 | #if defined(AUDIOHW_HAVE_FILTER_ROLL_OFF) | 145 | #if defined(AUDIOHW_HAVE_FILTER_ROLL_OFF) |
146 | SOUND_CUR_SET(FILTER_ROLL_OFF, global_settings.roll_off) | 146 | SOUND_CUR_SET(FILTER_ROLL_OFF, global_settings.roll_off) |
147 | #endif | 147 | #endif |
148 | #if defined(AUDIOHW_HAVE_POWER_MODE) | ||
149 | SOUND_CUR_SET(POWER_MODE, global_settings.power_mode) | ||
150 | #endif | ||
148 | 151 | ||
149 | #if 0 /*WRONG -- these need to index the hw_eq_bands[AUDIOHW_EQ_BAND_NUM] struct*/ | 152 | #if 0 /*WRONG -- these need to index the hw_eq_bands[AUDIOHW_EQ_BAND_NUM] struct*/ |
150 | /* Hardware EQ tone controls */ | 153 | /* Hardware EQ tone controls */ |
@@ -425,6 +428,16 @@ void sound_set_filter_roll_off(int value) | |||
425 | } | 428 | } |
426 | #endif | 429 | #endif |
427 | 430 | ||
431 | #if defined(AUDIOHW_HAVE_POWER_MODE) | ||
432 | void sound_set_power_mode(int value) | ||
433 | { | ||
434 | if (!audio_is_initialized) | ||
435 | return; | ||
436 | |||
437 | audiohw_set_power_mode(value); | ||
438 | } | ||
439 | #endif | ||
440 | |||
428 | #if defined(AUDIOHW_HAVE_EQ) | 441 | #if defined(AUDIOHW_HAVE_EQ) |
429 | int sound_enum_hw_eq_band_setting(unsigned int band, | 442 | int sound_enum_hw_eq_band_setting(unsigned int band, |
430 | unsigned int band_setting) | 443 | unsigned int band_setting) |