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:
parent
3b97474978
commit
75d77155dc
4 changed files with 32 additions and 20 deletions
|
@ -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();
|
||||
}
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue