summaryrefslogtreecommitdiffstats
path: root/apps/recorder
diff options
context:
space:
mode:
authorWilliam Wilgus <me.theuser@yahoo.com>2018-12-08 01:17:17 -0600
committerWilliam Wilgus <me.theuser@yahoo.com>2018-12-08 16:03:47 -0600
commit7907eb894677e48cdd46861a6b0888b81e2c390d (patch)
treea41b16cd271c28cdacf70a0cfddf1d18277c04ba /apps/recorder
parented63ef077a8f6d95dd9038ca0503e8372144010a (diff)
downloadrockbox-7907eb894677e48cdd46861a6b0888b81e2c390d.tar.gz
rockbox-7907eb894677e48cdd46861a6b0888b81e2c390d.tar.bz2
rockbox-7907eb894677e48cdd46861a6b0888b81e2c390d.zip
Fix truncation warning recording.c->recording_screen
Limit buf2 to enough characters(16) to display signed int & label consolidate gain/volume settings Change-Id: I9ef6aa1e16ea2a17acc311a9b7e1c0556f58eff7
Diffstat (limited to 'apps/recorder')
-rw-r--r--apps/recorder/recording.c73
1 files changed, 37 insertions, 36 deletions
diff --git a/apps/recorder/recording.c b/apps/recorder/recording.c
index 7357b469f4..e99a1e08e2 100644
--- a/apps/recorder/recording.c
+++ b/apps/recorder/recording.c
@@ -959,6 +959,30 @@ static const char* reclist_get_name(int selected_item, void * data,
return buffer;
}
+void recording_step_levels(int setting_id, int steps)
+{
+ steps *= sound_steps(setting_id);
+ switch(setting_id)
+ {
+ case SOUND_VOLUME:
+ global_settings.volume += steps;
+ setvol();
+ break;
+ case SOUND_LEFT_GAIN:
+ global_settings.rec_left_gain += steps;
+ break;
+ case SOUND_RIGHT_GAIN:
+ global_settings.rec_right_gain += steps;
+ break;
+#ifdef HAVE_MIC_REC
+ case SOUND_MIC_GAIN:
+ global_settings.rec_mic_gain += steps;
+ break;
+#endif /* MIC */
+ default:
+ break;
+ }
+}
bool recording_start_automatic = false;
@@ -967,7 +991,7 @@ bool recording_screen(bool no_source)
int button;
int done = -1; /* negative to re-init, positive to quit, zero to run */
char buf[32]; /* for preparing strings */
- char buf2[32]; /* for preparing strings */
+ char buf2[16]; /* for preparing strings */
int w, h; /* character width/height */
int update_countdown = 0; /* refresh counter */
unsigned int seconds;
@@ -1330,34 +1354,24 @@ bool recording_screen(bool no_source)
switch (listid_to_enum[gui_synclist_get_sel_pos(&lists)])
{
case ITEM_VOLUME:
- global_settings.volume += sound_steps(SOUND_VOLUME);
- setvol();
+ recording_step_levels(SOUND_VOLUME, 1);
break;
case ITEM_GAIN:
#ifdef HAVE_MIC_REC
if(global_settings.rec_source == AUDIO_SRC_MIC)
- {
- global_settings.rec_mic_gain +=
- sound_steps(SOUND_MIC_GAIN);
- }
+ recording_step_levels(SOUND_MIC_GAIN, 1);
else
#endif /* MIC */
{
- global_settings.rec_left_gain +=
- sound_steps(SOUND_LEFT_GAIN);
- global_settings.rec_right_gain +=
- sound_steps(SOUND_RIGHT_GAIN);
+ recording_step_levels(SOUND_LEFT_GAIN, 1);
+ recording_step_levels(SOUND_RIGHT_GAIN, 1);
}
break;
case ITEM_GAIN_L:
- global_settings.rec_left_gain +=
- sound_steps(SOUND_LEFT_GAIN);
-
+ recording_step_levels(SOUND_LEFT_GAIN, 1);
break;
case ITEM_GAIN_R:
- global_settings.rec_right_gain +=
- sound_steps(SOUND_RIGHT_GAIN);
-
+ recording_step_levels(SOUND_RIGHT_GAIN, 1);
break;
#ifdef HAVE_AGC
case ITEM_AGC_MODE:
@@ -1400,37 +1414,24 @@ bool recording_screen(bool no_source)
switch (listid_to_enum[gui_synclist_get_sel_pos(&lists)])
{
case ITEM_VOLUME:
- global_settings.volume -= sound_steps(SOUND_VOLUME);
-
- /* check range and update */
- setvol();
+ recording_step_levels(SOUND_VOLUME, -1);
break;
case ITEM_GAIN:
#ifdef HAVE_MIC_REC
if(global_settings.rec_source == AUDIO_SRC_MIC)
- {
- global_settings.rec_mic_gain -=
- sound_steps(SOUND_MIC_GAIN);
- }
+ recording_step_levels(SOUND_MIC_GAIN, -1);
else
#endif /* MIC */
{
- global_settings.rec_left_gain -=
- sound_steps(SOUND_LEFT_GAIN);
-
- global_settings.rec_right_gain -=
- sound_steps(SOUND_RIGHT_GAIN);
+ recording_step_levels(SOUND_LEFT_GAIN, -1);
+ recording_step_levels(SOUND_RIGHT_GAIN, -1);
}
break;
case ITEM_GAIN_L:
- global_settings.rec_left_gain -=
- sound_steps(SOUND_LEFT_GAIN);
-
+ recording_step_levels(SOUND_LEFT_GAIN, -1);
break;
case ITEM_GAIN_R:
- global_settings.rec_right_gain -=
- sound_steps(SOUND_RIGHT_GAIN);
-
+ recording_step_levels(SOUND_RIGHT_GAIN, -1);
break;
#ifdef HAVE_AGC
case ITEM_AGC_MODE: