From bdba331096947b412e1659797cce4a89f2ee7a5c Mon Sep 17 00:00:00 2001 From: Twinaphex Date: Mon, 7 May 2012 23:52:15 +0200 Subject: [PATCH] (PS3) Preliminary rsound patches --- console/console_ext.c | 2 ++ general.h | 1 - ps3/main.c | 3 ++- ps3/menu.c | 23 ++++++++++++++++------- 4 files changed, 20 insertions(+), 9 deletions(-) diff --git a/console/console_ext.c b/console/console_ext.c index 618e4b8259..af63adc319 100644 --- a/console/console_ext.c +++ b/console/console_ext.c @@ -724,7 +724,9 @@ bool rarch_console_rsound_start(const char *ip) void rarch_console_rsound_stop(void) { + const char *default_audio = config_get_default_audio(); uninit_audio(); + strlcpy(g_settings.audio.driver, default_audio, sizeof(g_settings.audio.driver)); init_drivers_pre(); init_audio(); } diff --git a/general.h b/general.h index 10ca181ab3..9dbe2ef780 100644 --- a/general.h +++ b/general.h @@ -225,7 +225,6 @@ struct console_settings char cgp_path[PATH_MAX]; char input_cfg_path[PATH_MAX]; char rom_path[PATH_MAX]; - char rsound_ip_address[PATH_MAX]; char default_rom_startup_dir[PATH_MAX]; char default_savestate_dir[PATH_MAX]; char default_sram_dir[PATH_MAX]; diff --git a/ps3/main.c b/ps3/main.c index 7a2cd078e5..98320e5552 100644 --- a/ps3/main.c +++ b/ps3/main.c @@ -145,7 +145,6 @@ static void set_default_settings(void) g_console.custom_viewport_height = 0; g_console.custom_viewport_x = 0; g_console.custom_viewport_y = 0; - strlcpy(g_console.rsound_ip_address, "0.0.0.0", sizeof(g_console.rsound_ip_address)); g_console.custom_bgm_enable = true; // g_extern @@ -212,6 +211,7 @@ static void init_settings(bool load_libretro_path) CONFIG_GET_BOOL(video.smooth, "video_smooth"); CONFIG_GET_BOOL(video.vsync, "video_vsync"); CONFIG_GET_FLOAT(video.aspect_ratio, "video_aspect_ratio"); + CONFIG_GET_STRING(audio.device, "audio_device"); for (unsigned i = 0; i < 7; i++) { @@ -275,6 +275,7 @@ static void save_settings(void) config_set_bool(conf, "video_second_pass_smooth", g_settings.video.second_pass_smooth); config_set_bool(conf, "video_smooth", g_settings.video.smooth); config_set_bool(conf, "video_vsync", g_settings.video.vsync); + config_set_string(conf, "audio_device", g_settings.audio.device); for (unsigned i = 0; i < 7; i++) { diff --git a/ps3/menu.c b/ps3/menu.c index a098061cce..dc61673d79 100644 --- a/ps3/menu.c +++ b/ps3/menu.c @@ -552,12 +552,12 @@ static void set_setting_label(menu * menu_obj, uint64_t currentsetting) } break; case SETTING_RSOUND_SERVER_IP_ADDRESS: - if(strcmp(g_console.rsound_ip_address,"0.0.0.0") == 0) + if(strcmp(g_settings.audio.device,"0.0.0.0") == 0) menu_obj->items[currentsetting].text_color = GREEN; else menu_obj->items[currentsetting].text_color = ORANGE; - snprintf(menu_obj->items[currentsetting].setting_text, sizeof(menu_obj->items[currentsetting].setting_text), g_console.rsound_ip_address); + snprintf(menu_obj->items[currentsetting].setting_text, sizeof(menu_obj->items[currentsetting].setting_text), g_settings.audio.device); break; case SETTING_DEFAULT_AUDIO_ALL: break; @@ -1500,7 +1500,6 @@ static void producesettingentry(menu * menu_obj, uint64_t switchvalue) if(g_console.sound_mode != SOUND_MODE_NORMAL) { g_console.sound_mode--; - //emulator_toggle_sound(g_console.sound_mode); set_delay = DELAY_MEDIUM; } } @@ -1509,14 +1508,24 @@ static void producesettingentry(menu * menu_obj, uint64_t switchvalue) if(g_console.sound_mode < SOUND_MODE_HEADSET) { g_console.sound_mode++; - //emulator_toggle_sound(g_console.sound_mode); set_delay = DELAY_MEDIUM; } } + if(CTRL_UP(state) || CTRL_LSTICK_UP(state) || CTRL_DOWN(state) || CTRL_LSTICK_DOWN(state)) + { + if(g_console.sound_mode != SOUND_MODE_RSOUND) + { + rarch_console_rsound_stop(); + } + else + { + rarch_console_rsound_start(g_settings.audio.device); + } + } if(CTRL_START(state)) { g_console.sound_mode = SOUND_MODE_NORMAL; - //emulator_toggle_sound(g_console.sound_mode); + rarch_console_rsound_stop(); set_delay = DELAY_MEDIUM; } break; @@ -1534,10 +1543,10 @@ static void producesettingentry(menu * menu_obj, uint64_t switchvalue) } if(g_console.oskutil_handle.text_can_be_fetched) - strcpy(g_console.rsound_ip_address, OUTPUT_TEXT_STRING(g_console.oskutil_handle)); + strcpy(g_settings.audio.device, OUTPUT_TEXT_STRING(g_console.oskutil_handle)); } if(CTRL_START(state)) - strcpy(g_console.rsound_ip_address, "0.0.0.0"); + strcpy(g_settings.audio.device, "0.0.0.0"); break; case SETTING_DEFAULT_AUDIO_ALL: break;