1
0
Fork 0
forked from len0rd/rockbox

Added function pointer argument to set_option(). This allows for instantaneous response from the AVC and Channels sound options

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@2253 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Linus Nielsen Feltzing 2002-09-10 05:31:12 +00:00
parent 3b97474978
commit 75d77155dc
4 changed files with 32 additions and 20 deletions

View file

@ -587,7 +587,7 @@ void set_bool_options(char* string, bool* variable, char* yes_str, char* no_str
{ {
char* names[] = { yes_str, no_str }; char* names[] = { yes_str, no_str };
int value = !*variable; int value = !*variable;
set_option(string, &value, names, 2); set_option(string, &value, names, 2, NULL);
*variable = !value; *variable = !value;
} }
@ -675,7 +675,8 @@ void set_int(char* string,
lcd_stop_scroll(); 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; bool done = false;
@ -742,6 +743,9 @@ void set_option(char* string, int* variable, char* options[], int numoptions )
break; break;
#endif #endif
} }
if ( function )
function(*variable);
} }
lcd_stop_scroll(); lcd_stop_scroll();
} }

View file

@ -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_options(char* string, bool* variable, char* yes_str, char* no_str );
void set_bool(char* string, bool* variable ); 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, void set_int(char* string,
char* unit, char* unit,
int* variable, int* variable,

View file

@ -73,8 +73,8 @@ static Menu sort_case(void)
static Menu resume(void) static Menu resume(void)
{ {
char* names[] = { "off", "ask", "on " }; char* names[] = { "off", "ask", "on" };
set_option( "Resume", &global_settings.resume, names, 3 ); set_option( "Resume", &global_settings.resume, names, 3, NULL );
return MENU_OK; return MENU_OK;
} }
@ -85,8 +85,7 @@ static Menu backlight_timer(void)
"6s ", "7s ", "8s ", "9s ", "10s", "6s ", "7s ", "8s ", "9s ", "10s",
"15s", "20s", "25s", "30s", "45s", "15s", "20s", "25s", "30s", "45s",
"60s", "90s"}; "60s", "90s"};
set_option("Backlight", &global_settings.backlight, names, 19 ); set_option("Backlight", &global_settings.backlight, names, 19, backlight_time );
backlight_time(global_settings.backlight);
return MENU_OK; return MENU_OK;
} }
@ -172,23 +171,23 @@ static Menu spindown(void)
static Menu ff_rewind_min_step(void) static Menu ff_rewind_min_step(void)
{ {
char* names[] = { "1s ", "2s ", "3s ", "4s ", char* names[] = { "1s", "2s", "3s", "4s",
"5s ", "6s ", "8s ", "10s", "5s", "6s", "8s", "10s",
"15s", "20s", "25s", "30s", "15s", "20s", "25s", "30s",
"45s", "60s" }; "45s", "60s" };
set_option("FF/RW Min Step", &global_settings.ff_rewind_min_step, set_option("FF/RW Min Step", &global_settings.ff_rewind_min_step,
names, 14 ); names, 14, NULL );
return MENU_OK; return MENU_OK;
} }
static Menu ff_rewind_accel(void) static Menu ff_rewind_accel(void)
{ {
char* names[] = { "off ", "2x/1s ", "2x/2s ", "2x/3s ", char* names[] = { "off", "2x/1s", "2x/2s", "2x/3s",
"2x/4s ", "2x/5s ", "2x/6s ", "2x/7s ", "2x/4s", "2x/5s", "2x/6s", "2x/7s",
"2x/8s ", "2x/9s ", "2x/10s", "2x/11s", "2x/8s", "2x/9s", "2x/10s", "2x/11s",
"2x/12s", "2x/13s", "2x/14s", "2x/15s", }; "2x/12s", "2x/13s", "2x/14s", "2x/15s", };
set_option("FF/RW Accel", &global_settings.ff_rewind_accel, set_option("FF/RW Accel", &global_settings.ff_rewind_accel,
names, 16 ); names, 16, NULL );
return MENU_OK; return MENU_OK;
} }

View file

@ -182,21 +182,29 @@ static Menu bass_boost(void)
return MENU_OK; 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) static Menu avc(void)
{ {
char* names[] = { "off", "2s ", "4s ", "8s " }; char* names[] = { "off", "2s", "4s", "8s" };
set_option("AV decay time", &global_settings.avc, names, 4 ); set_option("AV decay time", &global_settings.avc, names, 4, set_avc );
mpeg_sound_set(SOUND_AVC, global_settings.avc);
return MENU_OK; return MENU_OK;
} }
#endif /* ARCHOS_RECORDER */ #endif /* ARCHOS_RECORDER */
static Menu chanconf(void) static Menu chanconf(void)
{ {
char *names[] = {"Stereo ", "Mono ", "Mono Left ", "Mono Right" }; char *names[] = {"Stereo", "Mono", "Mono Left", "Mono Right" };
set_option("Channel configuration", set_option("Channel configuration",
&global_settings.channel_config, names, 4 ); &global_settings.channel_config, names, 4, set_chanconf );
mpeg_sound_set(SOUND_CHANNELS, global_settings.channel_config);
return MENU_OK; return MENU_OK;
} }