diff options
Diffstat (limited to 'apps/sound_menu.c')
-rw-r--r-- | apps/sound_menu.c | 51 |
1 files changed, 0 insertions, 51 deletions
diff --git a/apps/sound_menu.c b/apps/sound_menu.c index 19dc57b1a7..f7ddc430cc 100644 --- a/apps/sound_menu.c +++ b/apps/sound_menu.c | |||
@@ -61,57 +61,6 @@ | |||
61 | #endif | 61 | #endif |
62 | #include "action.h" | 62 | #include "action.h" |
63 | 63 | ||
64 | static int selected_setting; /* Used by the callback */ | ||
65 | static void dec_sound_formatter(char *buffer, int buffer_size, int val, const char *unit) | ||
66 | { | ||
67 | val = sound_val2phys(selected_setting, val); | ||
68 | char sign = ' '; | ||
69 | if(val < 0) | ||
70 | { | ||
71 | sign = '-'; | ||
72 | val = abs(val); | ||
73 | } | ||
74 | int integer = val / 10; | ||
75 | int dec = val % 10; | ||
76 | snprintf(buffer, buffer_size, "%c%d.%d %s", sign, integer, dec, unit); | ||
77 | } | ||
78 | |||
79 | bool set_sound(const unsigned char * string, | ||
80 | int* variable, | ||
81 | int setting) | ||
82 | { | ||
83 | int talkunit = UNIT_INT; | ||
84 | const char* unit = sound_unit(setting); | ||
85 | int numdec = sound_numdecimals(setting); | ||
86 | int steps = sound_steps(setting); | ||
87 | int min = sound_min(setting); | ||
88 | int max = sound_max(setting); | ||
89 | sound_set_type* sound_callback = sound_get_fn(setting); | ||
90 | if (*unit == 'd') /* crude reconstruction */ | ||
91 | talkunit = UNIT_DB; | ||
92 | else if (*unit == '%') | ||
93 | talkunit = UNIT_PERCENT; | ||
94 | else if (*unit == 'H') | ||
95 | talkunit = UNIT_HERTZ; | ||
96 | if(!numdec) | ||
97 | #if CONFIG_CODEC == SWCODEC | ||
98 | /* We need to hijack this one and send it off to apps/dsp.c instead of | ||
99 | firmware/sound.c */ | ||
100 | if (setting == SOUND_STEREO_WIDTH) | ||
101 | return set_int(string, unit, talkunit, variable, &stereo_width_set, | ||
102 | steps, min, max, NULL ); | ||
103 | else | ||
104 | #endif | ||
105 | return set_int(string, unit, talkunit, variable, sound_callback, | ||
106 | steps, min, max, NULL ); | ||
107 | else | ||
108 | {/* Decimal number */ | ||
109 | selected_setting=setting; | ||
110 | return set_int(string, unit, talkunit, variable, sound_callback, | ||
111 | steps, min, max, &dec_sound_formatter ); | ||
112 | } | ||
113 | } | ||
114 | |||
115 | static bool volume(void) | 64 | static bool volume(void) |
116 | { | 65 | { |
117 | return set_sound(str(LANG_VOLUME), &global_settings.volume, SOUND_VOLUME); | 66 | return set_sound(str(LANG_VOLUME), &global_settings.volume, SOUND_VOLUME); |