diff options
Diffstat (limited to 'firmware/sound.c')
-rw-r--r-- | firmware/sound.c | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/firmware/sound.c b/firmware/sound.c index 701b008fc3..fc1b6e025c 100644 --- a/firmware/sound.c +++ b/firmware/sound.c | |||
@@ -35,6 +35,17 @@ | |||
35 | #endif | 35 | #endif |
36 | #endif | 36 | #endif |
37 | 37 | ||
38 | #if CONFIG_CODEC == MAS3507D /* volume/balance/treble/bass interdependency */ | ||
39 | #define VOLUME_MIN -780 | ||
40 | #define VOLUME_MAX 180 | ||
41 | #else | ||
42 | #define VOLUME_MIN -400 | ||
43 | #define VOLUME_MAX 600 | ||
44 | #endif | ||
45 | |||
46 | /* volume/balance/treble/bass interdependency main part */ | ||
47 | #define VOLUME_RANGE (VOLUME_MAX - VOLUME_MIN) | ||
48 | |||
38 | #ifndef SIMULATOR | 49 | #ifndef SIMULATOR |
39 | extern bool audio_is_initialized; | 50 | extern bool audio_is_initialized; |
40 | 51 | ||
@@ -179,8 +190,6 @@ void sound_set_dsp_callback(int (*func)(int, intptr_t)) | |||
179 | 190 | ||
180 | #ifndef SIMULATOR | 191 | #ifndef SIMULATOR |
181 | #if CONFIG_CODEC == MAS3507D /* volume/balance/treble/bass interdependency */ | 192 | #if CONFIG_CODEC == MAS3507D /* volume/balance/treble/bass interdependency */ |
182 | #define VOLUME_MIN -780 | ||
183 | #define VOLUME_MAX 180 | ||
184 | 193 | ||
185 | static const unsigned int bass_table[] = | 194 | static const unsigned int bass_table[] = |
186 | { | 195 | { |
@@ -286,8 +295,6 @@ static int tenthdb2reg(int db) | |||
286 | || defined HAVE_WM8975 || defined HAVE_WM8758 || defined(HAVE_WM8731) \ | 295 | || defined HAVE_WM8975 || defined HAVE_WM8758 || defined(HAVE_WM8731) \ |
287 | || defined(HAVE_WM8721) || defined(HAVE_TLV320) || defined(HAVE_WM8751) \ | 296 | || defined(HAVE_WM8721) || defined(HAVE_TLV320) || defined(HAVE_WM8751) \ |
288 | || defined(HAVE_AS3514) | 297 | || defined(HAVE_AS3514) |
289 | /* volume/balance/treble/bass interdependency main part */ | ||
290 | #define VOLUME_RANGE (VOLUME_MAX - VOLUME_MIN) | ||
291 | 298 | ||
292 | /* all values in tenth of dB MAS3507D UDA1380 */ | 299 | /* all values in tenth of dB MAS3507D UDA1380 */ |
293 | int current_volume = 0; /* -780..+180 -840.. 0 */ | 300 | int current_volume = 0; /* -780..+180 -840.. 0 */ |
@@ -667,7 +674,7 @@ int sim_volume; | |||
667 | void sound_set_volume(int value) | 674 | void sound_set_volume(int value) |
668 | { | 675 | { |
669 | /* 128 is SDL_MIX_MAXVOLUME */ | 676 | /* 128 is SDL_MIX_MAXVOLUME */ |
670 | sim_volume = 128 * (value - VOLUME_MIN / 10) / ((VOLUME_MAX - VOLUME_MIN) / 10); | 677 | sim_volume = 128 * (value - VOLUME_MIN / 10) / (VOLUME_RANGE / 10); |
671 | } | 678 | } |
672 | 679 | ||
673 | void sound_set_balance(int value) | 680 | void sound_set_balance(int value) |