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 };
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();
}

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(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,

View file

@ -74,7 +74,7 @@ static Menu sort_case(void)
static Menu resume(void)
{
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;
}
@ -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;
}
@ -177,7 +176,7 @@ static Menu ff_rewind_min_step(void)
"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;
}
@ -188,7 +187,7 @@ static Menu ff_rewind_accel(void)
"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;
}

View file

@ -182,11 +182,20 @@ 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);
set_option("AV decay time", &global_settings.avc, names, 4, set_avc );
return MENU_OK;
}
#endif /* ARCHOS_RECORDER */
@ -195,8 +204,7 @@ static Menu chanconf(void)
{
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;
}