summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--apps/settings.c8
-rw-r--r--apps/settings.h3
-rw-r--r--apps/settings_menu.c21
-rw-r--r--apps/sound_menu.c20
4 files changed, 32 insertions, 20 deletions
diff --git a/apps/settings.c b/apps/settings.c
index 3fbc7c69df..a1bbe4a3db 100644
--- a/apps/settings.c
+++ b/apps/settings.c
@@ -587,7 +587,7 @@ void set_bool_options(char* string, bool* variable, char* yes_str, char* no_str
{
char* names[] = { yes_str, no_str };
int value = !*variable;
- set_option(string, &value, names, 2);
+ set_option(string, &value, names, 2, NULL);
*variable = !value;
}
@@ -675,7 +675,8 @@ void set_int(char* string,
lcd_stop_scroll();
}
-void set_option(char* string, int* variable, char* options[], int numoptions )
+void set_option(char* string, int* variable, char* options[],
+ int numoptions, void (*function)(int))
{
bool done = false;
@@ -742,6 +743,9 @@ void set_option(char* string, int* variable, char* options[], int numoptions )
break;
#endif
}
+
+ if ( function )
+ function(*variable);
}
lcd_stop_scroll();
}
diff --git a/apps/settings.h b/apps/settings.h
index 2fab75b437..6ed0b167f4 100644
--- a/apps/settings.h
+++ b/apps/settings.h
@@ -114,7 +114,8 @@ bool settings_load_eq(char* file);
void set_bool_options(char* string, bool* variable, char* yes_str, char* no_str );
void set_bool(char* string, bool* variable );
-void set_option(char* string, int* variable, char* options[], int numoptions );
+void set_option(char* string, int* variable, char* options[],
+ int numoptions, void (*function)(int));
void set_int(char* string,
char* unit,
int* variable,
diff --git a/apps/settings_menu.c b/apps/settings_menu.c
index 03a59df776..5a4879aaa5 100644
--- a/apps/settings_menu.c
+++ b/apps/settings_menu.c
@@ -73,8 +73,8 @@ static Menu sort_case(void)
static Menu resume(void)
{
- char* names[] = { "off", "ask", "on " };
- set_option( "Resume", &global_settings.resume, names, 3 );
+ char* names[] = { "off", "ask", "on" };
+ set_option( "Resume", &global_settings.resume, names, 3, NULL );
return MENU_OK;
}
@@ -85,8 +85,7 @@ static Menu backlight_timer(void)
"6s ", "7s ", "8s ", "9s ", "10s",
"15s", "20s", "25s", "30s", "45s",
"60s", "90s"};
- set_option("Backlight", &global_settings.backlight, names, 19 );
- backlight_time(global_settings.backlight);
+ set_option("Backlight", &global_settings.backlight, names, 19, backlight_time );
return MENU_OK;
}
@@ -172,23 +171,23 @@ static Menu spindown(void)
static Menu ff_rewind_min_step(void)
{
- char* names[] = { "1s ", "2s ", "3s ", "4s ",
- "5s ", "6s ", "8s ", "10s",
+ char* names[] = { "1s", "2s", "3s", "4s",
+ "5s", "6s", "8s", "10s",
"15s", "20s", "25s", "30s",
"45s", "60s" };
set_option("FF/RW Min Step", &global_settings.ff_rewind_min_step,
- names, 14 );
+ names, 14, NULL );
return MENU_OK;
}
static Menu ff_rewind_accel(void)
{
- char* names[] = { "off ", "2x/1s ", "2x/2s ", "2x/3s ",
- "2x/4s ", "2x/5s ", "2x/6s ", "2x/7s ",
- "2x/8s ", "2x/9s ", "2x/10s", "2x/11s",
+ char* names[] = { "off", "2x/1s", "2x/2s", "2x/3s",
+ "2x/4s", "2x/5s", "2x/6s", "2x/7s",
+ "2x/8s", "2x/9s", "2x/10s", "2x/11s",
"2x/12s", "2x/13s", "2x/14s", "2x/15s", };
set_option("FF/RW Accel", &global_settings.ff_rewind_accel,
- names, 16 );
+ names, 16, NULL );
return MENU_OK;
}
diff --git a/apps/sound_menu.c b/apps/sound_menu.c
index 70a40e6691..d5881ab626 100644
--- a/apps/sound_menu.c
+++ b/apps/sound_menu.c
@@ -182,21 +182,29 @@ static Menu bass_boost(void)
return MENU_OK;
};
+static void set_chanconf(int val)
+{
+ mpeg_sound_set(SOUND_CHANNELS, val);
+}
+
+static void set_avc(int val)
+{
+ mpeg_sound_set(SOUND_AVC, val);
+}
+
static Menu avc(void)
{
- char* names[] = { "off", "2s ", "4s ", "8s " };
- set_option("AV decay time", &global_settings.avc, names, 4 );
- mpeg_sound_set(SOUND_AVC, global_settings.avc);
+ char* names[] = { "off", "2s", "4s", "8s" };
+ set_option("AV decay time", &global_settings.avc, names, 4, set_avc );
return MENU_OK;
}
#endif /* ARCHOS_RECORDER */
static Menu chanconf(void)
{
- char *names[] = {"Stereo ", "Mono ", "Mono Left ", "Mono Right" };
+ char *names[] = {"Stereo", "Mono", "Mono Left", "Mono Right" };
set_option("Channel configuration",
- &global_settings.channel_config, names, 4 );
- mpeg_sound_set(SOUND_CHANNELS, global_settings.channel_config);
+ &global_settings.channel_config, names, 4, set_chanconf );
return MENU_OK;
}