mirror of
https://github.com/libretro/RetroArch
synced 2025-02-28 12:40:23 +00:00
roar_vs support.
This commit is contained in:
parent
9cebdc51cc
commit
3e9bedffed
6
Makefile
6
Makefile
@ -16,6 +16,10 @@ ifeq ($(BUILD_ALSA), 1)
|
||||
OBJ += alsa.o
|
||||
LIBS += -lasound
|
||||
endif
|
||||
ifeq ($(BUILD_ROAR), 1)
|
||||
OBJ += roar.o
|
||||
LIBS += -lroar
|
||||
endif
|
||||
|
||||
ifeq ($(BUILD_OPENGL), 1)
|
||||
OBJ += gl.o
|
||||
@ -25,7 +29,7 @@ ifeq ($(BUILD_FILTER), 1)
|
||||
OBJ += hqflt/hq.o
|
||||
endif
|
||||
|
||||
CFLAGS = -Wall -O3 -march=native -std=c99
|
||||
CFLAGS = -Wall -O3 -march=native -std=gnu99
|
||||
|
||||
|
||||
|
||||
|
1
config.h
1
config.h
@ -35,6 +35,7 @@
|
||||
#define AUDIO_RSOUND 1
|
||||
#define AUDIO_OSS 2
|
||||
#define AUDIO_ALSA 3
|
||||
#define AUDIO_ROAR 4
|
||||
////////////////////////
|
||||
|
||||
// Chooses which video and audio subsystem to use. Remember to update config.mk if you change these.
|
||||
|
@ -5,6 +5,7 @@ BUILD_FILTER = 0
|
||||
BUILD_RSOUND = 0
|
||||
BUILD_OSS = 0
|
||||
BUILD_ALSA = 1
|
||||
BUILD_ROAR = 0
|
||||
|
||||
|
||||
PREFIX = /usr/local
|
||||
|
92
roar.c
Normal file
92
roar.c
Normal file
@ -0,0 +1,92 @@
|
||||
/* SSNES - A Super Ninteno Entertainment System (SNES) Emulator frontend for libsnes.
|
||||
* Copyright (C) 2010 - Hans-Kristian Arntzen
|
||||
*
|
||||
* Some code herein may be based on code found in BSNES.
|
||||
*
|
||||
* SSNES 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.
|
||||
*
|
||||
* SSNES 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 SSNES.
|
||||
* If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
|
||||
#include "driver.h"
|
||||
#include <stdlib.h>
|
||||
#include <roaraudio.h>
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
|
||||
static void* __roar_init(const char* device, int rate, int latency)
|
||||
{
|
||||
int err;
|
||||
roar_vs_t *vss;
|
||||
if ( (vss = roar_vs_new_simple(NULL, NULL, rate, 2, ROAR_CODEC_PCM_S_LE, 16, ROAR_DIR_PLAY, &err)) == NULL )
|
||||
{
|
||||
fprintf(stderr, "roar_vs: \"%s\"\n", roar_vs_strerr(err));
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return vss;
|
||||
}
|
||||
|
||||
static ssize_t __roar_write(void* data, const void* buf, size_t size)
|
||||
{
|
||||
roar_vs_t *vss = data;
|
||||
|
||||
if ( size == 0 )
|
||||
return 0;
|
||||
|
||||
int err;
|
||||
if (roar_vs_write(vss, buf, size, &err) < 0)
|
||||
{
|
||||
if (err == ROAR_ERROR_NONE)
|
||||
return 0;
|
||||
return -1;
|
||||
}
|
||||
|
||||
return size;
|
||||
}
|
||||
|
||||
static bool __roar_stop(void *data)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
static void __roar_set_nonblock_state(void *data, bool state)
|
||||
{
|
||||
roar_vs_t *vss = data;
|
||||
if (roar_vs_blocking(vss, (state) ? ROAR_VS_FALSE : ROAR_VS_TRUE, NULL) < 0)
|
||||
fprintf(stderr, "SSNES [ERROR]: Can't set nonblocking. Will not be able to fast-forward.\n");
|
||||
}
|
||||
|
||||
static bool __roar_start(void *data)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
static void __roar_free(void *data)
|
||||
{
|
||||
roar_vs_t *vss = data;
|
||||
roar_vs_close(vss, ROAR_VS_TRUE, NULL);
|
||||
}
|
||||
|
||||
const audio_driver_t audio_roar = {
|
||||
.init = __roar_init,
|
||||
.write = __roar_write,
|
||||
.stop = __roar_stop,
|
||||
.start = __roar_start,
|
||||
.set_nonblock_state = __roar_set_nonblock_state,
|
||||
.free = __roar_free
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
3
ssnes.c
3
ssnes.c
@ -36,6 +36,7 @@ static SRC_STATE* source = NULL;
|
||||
extern const audio_driver_t audio_rsound;
|
||||
extern const audio_driver_t audio_oss;
|
||||
extern const audio_driver_t audio_alsa;
|
||||
extern const audio_driver_t audio_roar;
|
||||
extern const video_driver_t video_gl;
|
||||
////////////////////////////////////////////////
|
||||
|
||||
@ -52,6 +53,8 @@ static driver_t driver = {
|
||||
.audio = &audio_oss,
|
||||
#elif AUDIO_DRIVER == AUDIO_ALSA
|
||||
.audio = &audio_alsa,
|
||||
#elif AUDIO_DRIVER == AUDIO_ROAR
|
||||
.audio = &audio_roar,
|
||||
#else
|
||||
#error "Define a valid audio driver in config.h"
|
||||
#endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user