(RARCH_CONSOLE) Split up rsound helper functions into rarch_console_sound.c

This commit is contained in:
Twinaphex 2012-07-28 16:42:57 +02:00
parent a5beb54ad4
commit eef755d525
9 changed files with 95 additions and 60 deletions

View File

@ -33,6 +33,8 @@ CONSOLE EXTENSIONS
#include "../rarch_console_exec.c"
#endif
#include "../rarch_console_sound.c"
#include "../rarch_console.c"
#ifdef HAVE_CONFIGFILE

View File

@ -20,51 +20,14 @@
#include "../boolean.h"
#include "../compat/strl.h"
#include "../libretro.h"
#include "../general.h"
#include "../compat/strl.h"
#include "../file.h"
#include "../general.h"
#include "rarch_console.h"
default_paths_t default_paths;
#ifdef HAVE_RSOUND
bool rarch_console_rsound_start(const char *ip)
{
strlcpy(g_settings.audio.driver, "rsound", sizeof(g_settings.audio.driver));
strlcpy(g_settings.audio.device, ip, sizeof(g_settings.audio.device));
driver.audio_data = NULL;
// If driver already has started, it must be reinited.
if (driver.audio_data)
{
uninit_audio();
driver.audio_data = NULL;
init_drivers_pre();
init_audio();
}
return g_extern.audio_active;
}
void rarch_console_rsound_stop(void)
{
strlcpy(g_settings.audio.driver, config_get_default_audio(), sizeof(g_settings.audio.driver));
// If driver already has started, it must be reinited.
if (driver.audio_data)
{
uninit_audio();
driver.audio_data = NULL;
init_drivers_pre();
init_audio();
}
}
#endif
/*============================================================
STRING HANDLING
============================================================ */
void rarch_convert_char_to_wchar(wchar_t *buf, const char * str, size_t size)
{
mbstowcs(buf, str, size / sizeof(wchar_t));

View File

@ -17,23 +17,6 @@
#ifndef CONSOLE_EXT_H__
#define CONSOLE_EXT_H__
#ifdef HAVE_LIBRETRO_MANAGEMENT
#include "rarch_console_libretro_mgmt.h"
#endif
#include "../general.h"
enum
{
SOUND_MODE_NORMAL,
#ifdef HAVE_RSOUND
SOUND_MODE_RSOUND,
#endif
#ifdef HAVE_HEADSET
SOUND_MODE_HEADSET,
#endif
};
enum {
MENU_ITEM_LOAD_STATE = 0,
MENU_ITEM_SAVE_STATE,
@ -95,11 +78,6 @@ extern default_paths_t default_paths;
#define MENU_ITEM_LAST MENU_ITEM_RETURN_TO_DASHBOARD+1
#ifdef HAVE_RSOUND
bool rarch_console_rsound_start(const char *ip);
void rarch_console_rsound_stop(void);
#endif
void rarch_convert_char_to_wchar(wchar_t *buf, const char * str, size_t size);
const char * rarch_convert_wchar_to_const_char(const wchar_t * wstr);
void rarch_extract_directory(char *buf, const char *path, size_t size);

View File

@ -20,6 +20,7 @@
#include "../conf/config_file_macros.h"
#include "rarch_console_config.h"
#include "rarch_console_libretro_mgmt.h"
void rarch_config_create_default(const char * conf_name)
{

View File

@ -0,0 +1,52 @@
/* RetroArch - A frontend for libretro.
* Copyright (C) 2010-2012 - Hans-Kristian Arntzen
* Copyright (C) 2011-2012 - Daniel De Matteis
*
* RetroArch is free software: you can redistribute it and/or modify it under the terms
* of the GNU General Public License as published by the Free Software Found-
* ation, either version 3 of the License, or (at your option) any later version.
*
* RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with RetroArch.
* If not, see <http://www.gnu.org/licenses/>.
*/
#include <stdint.h>
#include "rarch_console_sound.h"
#ifdef HAVE_RSOUND
bool rarch_console_rsound_start(const char *ip)
{
strlcpy(g_settings.audio.driver, "rsound", sizeof(g_settings.audio.driver));
strlcpy(g_settings.audio.device, ip, sizeof(g_settings.audio.device));
driver.audio_data = NULL;
// If driver already has started, it must be reinited.
if (driver.audio_data)
{
uninit_audio();
driver.audio_data = NULL;
init_drivers_pre();
init_audio();
}
return g_extern.audio_active;
}
void rarch_console_rsound_stop(void)
{
strlcpy(g_settings.audio.driver, config_get_default_audio(), sizeof(g_settings.audio.driver));
// If driver already has started, it must be reinited.
if (driver.audio_data)
{
uninit_audio();
driver.audio_data = NULL;
init_drivers_pre();
init_audio();
}
}
#endif

View File

@ -0,0 +1,36 @@
/* RetroArch - A frontend for libretro.
* Copyright (C) 2010-2012 - Hans-Kristian Arntzen
* Copyright (C) 2011-2012 - Daniel De Matteis
*
* RetroArch is free software: you can redistribute it and/or modify it under the terms
* of the GNU General Public License as published by the Free Software Found-
* ation, either version 3 of the License, or (at your option) any later version.
*
* RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with RetroArch.
* If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef RARCH_CONSOLE_SOUND_H
#define RARCH_CONSOLE_SOUND_H
enum
{
SOUND_MODE_NORMAL,
#ifdef HAVE_RSOUND
SOUND_MODE_RSOUND,
#endif
#ifdef HAVE_HEADSET
SOUND_MODE_HEADSET,
#endif
};
#ifdef HAVE_RSOUND
bool rarch_console_rsound_start(const char *ip);
void rarch_console_rsound_stop(void);
#endif
#endif

View File

@ -47,6 +47,7 @@
#include "../../console/rarch_console.h"
#include "../../console/rarch_console_exec.h"
#include "../../console/rarch_console_libretro_mgmt.h"
#include "../../console/rarch_console_input.h"
#include "../../console/rarch_console_config.h"
#include "../../console/rarch_console_settings.h"

View File

@ -31,6 +31,7 @@
#include "../../console/rarch_console_input.h"
#include "../../console/rarch_console_config.h"
#include "../../console/rarch_console_settings.h"
#include "../../console/rarch_console_sound.h"
#include "../../console/rarch_console_video.h"
#ifdef HAVE_ZLIB

View File

@ -39,6 +39,7 @@
#include "../../console/rarch_console.h"
#include "../../console/rarch_console_exec.h"
#include "../../console/rarch_console_libretro_mgmt.h"
#include "../../console/rarch_console_config.h"
#include "../../console/rarch_console_main_wrap.h"
#include "../../conf/config_file.h"