(Wii) implement audio controll rate settings

have left/right act as page up/down in file browser
change "Start" to reset values in settings
This commit is contained in:
Toad King 2012-07-18 20:38:09 -04:00
parent 64260b8d33
commit f9d72f583e
5 changed files with 101 additions and 44 deletions

View File

@ -37,6 +37,19 @@ void rarch_settings_change(unsigned setting)
case S_AUDIO_MUTE:
g_extern.audio_data.mute = !g_extern.audio_data.mute;
break;
case S_AUDIO_CONTROL_RATE_DECREMENT:
if (g_settings.audio.rate_control_delta > 0.0)
g_settings.audio.rate_control_delta -= 0.001;
if (g_settings.audio.rate_control_delta == 0.0)
g_settings.audio.rate_control = false;
else
g_settings.audio.rate_control = true;
break;
case S_AUDIO_CONTROL_RATE_INCREMENT:
if (g_settings.audio.rate_control_delta < 0.2)
g_settings.audio.rate_control_delta += 0.001;
g_settings.audio.rate_control = true;
break;
case S_FRAME_ADVANCE:
g_console.frame_advance_enable = true;
g_console.menu_enable = false;
@ -153,6 +166,15 @@ void rarch_settings_default(unsigned setting)
case S_DEF_AUDIO_MUTE:
g_extern.audio_data.mute = false;
break;
case S_DEF_AUDIO_CONTROL_RATE:
#ifdef GEKKO
g_settings.audio.rate_control_delta = 0.004;
g_settings.audio.rate_control = true;
#else
g_settings.audio.rate_control_delta = 0.0;
g_settings.audio.rate_control = false;
#endif
break;
case S_DEF_HW_TEXTURE_FILTER:
g_settings.video.smooth = 1;
break;

View File

@ -32,6 +32,8 @@ enum
S_ASPECT_RATIO_DECREMENT = 0,
S_ASPECT_RATIO_INCREMENT,
S_AUDIO_MUTE,
S_AUDIO_CONTROL_RATE_DECREMENT,
S_AUDIO_CONTROL_RATE_INCREMENT,
S_FRAME_ADVANCE,
S_HW_TEXTURE_FILTER,
S_HW_TEXTURE_FILTER_2,
@ -61,6 +63,7 @@ enum
{
S_DEF_ASPECT_RATIO = 0,
S_DEF_AUDIO_MUTE,
S_DEF_AUDIO_CONTROL_RATE,
S_DEF_HW_TEXTURE_FILTER,
S_DEF_HW_TEXTURE_FILTER_2,
S_DEF_OVERSCAN,

View File

@ -119,6 +119,12 @@ static bool get_rom_path(rgui_handle_t *rgui)
action = RGUI_ACTION_UP;
else if (trigger_state & (1 << RETRO_DEVICE_ID_JOYPAD_DOWN))
action = RGUI_ACTION_DOWN;
else if (trigger_state & (1 << RETRO_DEVICE_ID_JOYPAD_LEFT))
action = RGUI_ACTION_LEFT;
else if (trigger_state & (1 << RETRO_DEVICE_ID_JOYPAD_RIGHT))
action = RGUI_ACTION_RIGHT;
else if (trigger_state & (1 << RETRO_DEVICE_ID_JOYPAD_START))
action = RGUI_ACTION_START;
else if (trigger_state & (1 << RETRO_DEVICE_ID_JOYPAD_SELECT) && !first) // don't catch start+select+l+r when exiting
action = RGUI_ACTION_SETTINGS;

View File

@ -42,7 +42,7 @@ struct rgui_handle
rgui_list_t *path_stack;
rgui_list_t *folder_buf;
size_t directory_ptr;
int directory_ptr;
bool need_refresh;
rgui_mode_t mode;
@ -209,32 +209,33 @@ static void render_text(rgui_handle_t *rgui, size_t begin, size_t end)
rgui_list_at(rgui->folder_buf, i, &path, &type, NULL);
char message[TERM_WIDTH + 1];
char *type_str;
int w;
char type_str[TERM_WIDTH + 1];
int w = 18;
switch (type)
{
case RGUI_FILE_PLAIN:
type_str = "(FILE)";
snprintf(type_str, sizeof(type_str), "(FILE)");
w = 6;
break;
case RGUI_FILE_DIRECTORY:
type_str = "(DIR)";
snprintf(type_str, sizeof(type_str), "(DIR)");
w = 5;
break;
case RGUI_FILE_DEVICE:
type_str = "(DEV)";
snprintf(type_str, sizeof(type_str), "(DEV)");
w = 5;
break;
case RGUI_SETTINGS_VIDEO_FILTER:
type_str = g_settings.video.smooth ? "Bilinear filtering" : "Point filtering";
w = 18;
snprintf(type_str, sizeof(type_str), g_settings.video.smooth ? "Bilinear filtering" : "Point filtering");
break;
case RGUI_SETTINGS_AUDIO_MUTE:
type_str = g_extern.audio_data.mute ? "ON" : "OFF";
w = 18;
snprintf(type_str, sizeof(type_str), g_extern.audio_data.mute ? "ON" : "OFF");
break;
case RGUI_SETTINGS_AUDIO_CONTROL_RATE:
snprintf(type_str, sizeof(type_str), "%.3f", g_settings.audio.rate_control_delta);
break;
default:
type_str = "";
type_str[0] = 0;
w = 0;
break;
}
@ -287,20 +288,30 @@ static void render_messagebox(rgui_handle_t *rgui, const char *message)
free(msg);
}
static void rgui_settings_toggle_setting(rgui_file_type_t setting)
static void rgui_settings_toggle_setting(rgui_file_type_t setting, rgui_action_t action)
{
switch (setting)
{
/*case RGUI_SETTINGS_VIDEO_STRETCH:
break;*/
case RGUI_SETTINGS_VIDEO_FILTER:
if (action == RGUI_ACTION_START)
rarch_settings_default(S_DEF_HW_TEXTURE_FILTER);
else
rarch_settings_change(S_HW_TEXTURE_FILTER);
break;
case RGUI_SETTINGS_AUDIO_MUTE:
if (action == RGUI_ACTION_START)
rarch_settings_default(S_DEF_AUDIO_MUTE);
else
rarch_settings_change(S_AUDIO_MUTE);
break;
case RGUI_SETTINGS_AUDIO_CONTROL_RATE:
if (action == RGUI_ACTION_START)
rarch_settings_default(S_DEF_AUDIO_CONTROL_RATE);
else if (action == RGUI_ACTION_LEFT)
rarch_settings_change(S_AUDIO_CONTROL_RATE_DECREMENT);
else if (action == RGUI_ACTION_RIGHT)
rarch_settings_change(S_AUDIO_CONTROL_RATE_INCREMENT);
break;
default:
break;
}
@ -312,6 +323,7 @@ static void rgui_settings_populate_entries(rgui_handle_t *rgui)
rgui_list_push(rgui->folder_buf, "Hardware filtering", RGUI_SETTINGS_VIDEO_FILTER, 0);
rgui_list_push(rgui->folder_buf, "Mute Audio", RGUI_SETTINGS_AUDIO_MUTE, 0);
rgui_list_push(rgui->folder_buf, "Audio Control Rate", RGUI_SETTINGS_AUDIO_CONTROL_RATE, 0);
}
static bool rgui_settings_iterate(rgui_handle_t *rgui, rgui_action_t action)
@ -332,19 +344,20 @@ static bool rgui_settings_iterate(rgui_handle_t *rgui, rgui_action_t action)
rgui->directory_ptr = 0;
break;
case RGUI_ACTION_LEFT:
case RGUI_ACTION_CANCEL:
case RGUI_ACTION_SETTINGS:
rgui->mode = RGUI_FILEBROWSER;
return true;
break;
case RGUI_ACTION_LEFT:
case RGUI_ACTION_RIGHT:
case RGUI_ACTION_OK:
case RGUI_ACTION_START:
{
rgui_file_type_t type;
rgui_list_at(rgui->folder_buf, rgui->directory_ptr, NULL, &type, NULL);
rgui_settings_toggle_setting(type);
rgui_settings_toggle_setting(type, action);
break;
}
@ -404,6 +417,19 @@ const char *rgui_iterate(rgui_handle_t *rgui, rgui_action_t action)
break;
case RGUI_ACTION_LEFT:
if (rgui->directory_ptr - 8 > 0)
rgui->directory_ptr -= 8;
else
rgui->directory_ptr = 0;
break;
case RGUI_ACTION_RIGHT:
if (rgui->directory_ptr + 8 < rgui_list_size(rgui->folder_buf))
rgui->directory_ptr += 8;
else
rgui->directory_ptr = rgui_list_size(rgui->folder_buf) - 1;
break;
case RGUI_ACTION_CANCEL:
if (rgui_list_size(rgui->path_stack) > 1)
{
@ -415,7 +441,6 @@ const char *rgui_iterate(rgui_handle_t *rgui, rgui_action_t action)
}
break;
case RGUI_ACTION_RIGHT:
case RGUI_ACTION_OK:
{
if (rgui_list_size(rgui->folder_buf) == 0)

View File

@ -32,9 +32,9 @@ typedef enum
RGUI_FILE_DEVICE,
// settings options are done here too
//RGUI_SETTINGS_VIDEO_STRETCH,
RGUI_SETTINGS_VIDEO_FILTER,
RGUI_SETTINGS_AUDIO_MUTE
RGUI_SETTINGS_AUDIO_MUTE,
RGUI_SETTINGS_AUDIO_CONTROL_RATE
} rgui_file_type_t;
typedef enum
@ -47,6 +47,7 @@ typedef enum
RGUI_ACTION_CANCEL,
RGUI_ACTION_REFRESH,
RGUI_ACTION_SETTINGS,
RGUI_ACTION_START,
RGUI_ACTION_NOOP
} rgui_action_t;