mirror of
https://github.com/libretro/RetroArch.git
synced 2024-11-23 07:59:42 +00:00
Merge audio_driver.c into retroarch.c
This commit is contained in:
parent
eedc6a6092
commit
127bf556c7
@ -205,7 +205,6 @@ OBJ += frontend/frontend.o \
|
||||
file_path_special.o \
|
||||
file_path_str.o \
|
||||
$(LIBRETRO_COMM_DIR)/hash/rhash.o \
|
||||
audio/audio_driver.o \
|
||||
$(LIBRETRO_COMM_DIR)/audio/audio_mixer.o \
|
||||
input/common/input_hid_common.o \
|
||||
input/input_driver.o \
|
||||
|
1861
audio/audio_driver.c
1861
audio/audio_driver.c
File diff suppressed because it is too large
Load Diff
@ -1,319 +0,0 @@
|
||||
/* RetroArch - A frontend for libretro.
|
||||
* Copyright (C) 2010-2014 - Hans-Kristian Arntzen
|
||||
* Copyright (C) 2011-2017 - 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 __AUDIO_DRIVER__H
|
||||
#define __AUDIO_DRIVER__H
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#include <boolean.h>
|
||||
#include <retro_common_api.h>
|
||||
|
||||
#include <audio/audio_mixer.h>
|
||||
|
||||
#include "audio_defines.h"
|
||||
|
||||
RETRO_BEGIN_DECLS
|
||||
|
||||
typedef struct audio_mixer_stream
|
||||
{
|
||||
audio_mixer_sound_t *handle;
|
||||
audio_mixer_voice_t *voice;
|
||||
audio_mixer_stop_cb_t stop_cb;
|
||||
enum audio_mixer_stream_type stream_type;
|
||||
enum audio_mixer_type type;
|
||||
enum audio_mixer_state state;
|
||||
float volume;
|
||||
void *buf;
|
||||
char *name;
|
||||
size_t bufsize;
|
||||
} audio_mixer_stream_t;
|
||||
|
||||
typedef struct audio_mixer_stream_params
|
||||
{
|
||||
float volume;
|
||||
enum audio_mixer_slot_selection_type slot_selection_type;
|
||||
unsigned slot_selection_idx;
|
||||
enum audio_mixer_stream_type stream_type;
|
||||
enum audio_mixer_type type;
|
||||
enum audio_mixer_state state;
|
||||
void *buf;
|
||||
char *basename;
|
||||
size_t bufsize;
|
||||
audio_mixer_stop_cb_t cb;
|
||||
} audio_mixer_stream_params_t;
|
||||
|
||||
typedef struct audio_driver
|
||||
{
|
||||
/* Creates and initializes handle to audio driver.
|
||||
*
|
||||
* Returns: audio driver handle on success, otherwise NULL.
|
||||
**/
|
||||
void *(*init)(const char *device, unsigned rate,
|
||||
unsigned latency, unsigned block_frames, unsigned *new_rate);
|
||||
|
||||
/*
|
||||
* @data : Pointer to audio data handle.
|
||||
* @buf : Audio buffer data.
|
||||
* @size : Size of audio buffer.
|
||||
*
|
||||
* Write samples to audio driver.
|
||||
*
|
||||
* Write data in buffer to audio driver.
|
||||
* A frame here is defined as one combined sample of left and right
|
||||
* channels. (I.e. 44.1kHz, 16-bit stereo has 88.2k samples/s, and
|
||||
* 44.1k frames/s.)
|
||||
*
|
||||
* Samples are interleaved in format LRLRLRLRLR ...
|
||||
* If the driver returns true in use_float(), a floating point
|
||||
* format will be used, with range [-1.0, 1.0].
|
||||
* If not, signed 16-bit samples in native byte ordering will be used.
|
||||
*
|
||||
* This function returns the number of frames successfully written.
|
||||
* If an error occurs, -1 should be returned.
|
||||
* Note that non-blocking behavior that cannot write at this time
|
||||
* should return 0 as returning -1 will terminate the driver.
|
||||
*
|
||||
* Unless said otherwise with set_nonblock_state(), all writes
|
||||
* are blocking, and it should block till it has written all frames.
|
||||
*/
|
||||
ssize_t (*write)(void *data, const void *buf, size_t size);
|
||||
|
||||
/* Temporarily pauses the audio driver. */
|
||||
bool (*stop)(void *data);
|
||||
|
||||
/* Resumes audio driver from the paused state. */
|
||||
bool (*start)(void *data, bool is_shutdown);
|
||||
|
||||
/* Is the audio driver currently running? */
|
||||
bool (*alive)(void *data);
|
||||
|
||||
/* Should we care about blocking in audio thread? Fast forwarding.
|
||||
*
|
||||
* If state is true, nonblocking operation is assumed.
|
||||
* This is typically used for fast-forwarding. If driver cannot
|
||||
* implement nonblocking writes, this can be disregarded, but should
|
||||
* log a message to stderr.
|
||||
* */
|
||||
void (*set_nonblock_state)(void *data, bool toggle);
|
||||
|
||||
/* Stops and frees driver data. */
|
||||
void (*free)(void *data);
|
||||
|
||||
/* Defines if driver will take standard floating point samples,
|
||||
* or int16_t samples.
|
||||
*
|
||||
* If true is returned, the audio driver is capable of using
|
||||
* floating point data. This will likely increase performance as the
|
||||
* resampler unit uses floating point. The sample range is
|
||||
* [-1.0, 1.0].
|
||||
* */
|
||||
bool (*use_float)(void *data);
|
||||
|
||||
/* Human-readable identifier. */
|
||||
const char *ident;
|
||||
|
||||
/* Optional. Get audio device list (allocates, caller has to free this) */
|
||||
void *(*device_list_new)(void *data);
|
||||
|
||||
/* Optional. Frees audio device list */
|
||||
void (*device_list_free)(void *data, void *data2);
|
||||
|
||||
/* Optional. */
|
||||
size_t (*write_avail)(void *data);
|
||||
|
||||
size_t (*buffer_size)(void *data);
|
||||
} audio_driver_t;
|
||||
|
||||
void audio_driver_destroy_data(void);
|
||||
|
||||
void audio_driver_suspend(void);
|
||||
|
||||
bool audio_driver_is_suspended(void);
|
||||
|
||||
void audio_driver_resume(void);
|
||||
|
||||
void audio_driver_set_active(void);
|
||||
|
||||
bool audio_driver_is_active(void);
|
||||
|
||||
void audio_driver_destroy(void);
|
||||
|
||||
void audio_driver_deinit_resampler(void);
|
||||
|
||||
bool audio_driver_free_devices_list(void);
|
||||
|
||||
bool audio_driver_new_devices_list(void);
|
||||
|
||||
bool audio_driver_enable_callback(void);
|
||||
|
||||
bool audio_driver_disable_callback(void);
|
||||
|
||||
/**
|
||||
* audio_driver_find_handle:
|
||||
* @index : index of driver to get handle to.
|
||||
*
|
||||
* Returns: handle to audio driver at index. Can be NULL
|
||||
* if nothing found.
|
||||
**/
|
||||
const void *audio_driver_find_handle(int index);
|
||||
|
||||
/**
|
||||
* audio_driver_find_ident:
|
||||
* @index : index of driver to get handle to.
|
||||
*
|
||||
* Returns: Human-readable identifier of audio driver at index. Can be NULL
|
||||
* if nothing found.
|
||||
**/
|
||||
const char *audio_driver_find_ident(int index);
|
||||
|
||||
void audio_driver_set_nonblocking_state(bool enable);
|
||||
|
||||
/**
|
||||
* config_get_audio_driver_options:
|
||||
*
|
||||
* Get an enumerated list of all audio driver names, separated by '|'.
|
||||
*
|
||||
* Returns: string listing of all audio driver names, separated by '|'.
|
||||
**/
|
||||
const char* config_get_audio_driver_options(void);
|
||||
|
||||
void audio_driver_sample(int16_t left, int16_t right);
|
||||
|
||||
size_t audio_driver_sample_batch(const int16_t *data, size_t frames);
|
||||
|
||||
void audio_driver_sample_rewind(int16_t left, int16_t right);
|
||||
|
||||
size_t audio_driver_sample_batch_rewind(const int16_t *data, size_t frames);
|
||||
|
||||
bool audio_driver_mixer_extension_supported(const char *ext);
|
||||
|
||||
void audio_driver_dsp_filter_free(void);
|
||||
|
||||
void audio_driver_dsp_filter_init(const char *device);
|
||||
|
||||
void audio_driver_set_buffer_size(size_t bufsize);
|
||||
|
||||
bool audio_driver_get_devices_list(void **ptr);
|
||||
|
||||
void audio_driver_setup_rewind(void);
|
||||
|
||||
void audio_driver_monitor_adjust_system_rates(void);
|
||||
|
||||
bool audio_driver_set_callback(const void *data);
|
||||
|
||||
bool audio_driver_callback(void);
|
||||
|
||||
bool audio_driver_has_callback(void);
|
||||
|
||||
/* Sets audio monitor rate to new value. */
|
||||
void audio_driver_monitor_set_rate(void);
|
||||
|
||||
bool audio_driver_find_driver(void);
|
||||
|
||||
bool audio_driver_toggle_mute(void);
|
||||
|
||||
bool audio_driver_start(bool is_shutdown);
|
||||
|
||||
bool audio_driver_stop(void);
|
||||
|
||||
void audio_driver_unset_callback(void);
|
||||
|
||||
void audio_driver_frame_is_reverse(void);
|
||||
|
||||
void audio_set_float(enum audio_action action, float val);
|
||||
|
||||
void audio_set_bool(enum audio_action action, bool val);
|
||||
|
||||
void audio_unset_bool(enum audio_action action, bool val);
|
||||
|
||||
float *audio_get_float_ptr(enum audio_action action);
|
||||
|
||||
bool *audio_get_bool_ptr(enum audio_action action);
|
||||
|
||||
bool audio_driver_deinit(void);
|
||||
|
||||
bool audio_driver_init(void);
|
||||
|
||||
void audio_driver_menu_sample(void);
|
||||
|
||||
audio_mixer_stream_t *audio_driver_mixer_get_stream(unsigned i);
|
||||
|
||||
bool audio_driver_mixer_add_stream(audio_mixer_stream_params_t *params);
|
||||
|
||||
void audio_driver_mixer_play_stream(unsigned i);
|
||||
|
||||
void audio_driver_mixer_play_menu_sound(unsigned i);
|
||||
|
||||
void audio_driver_mixer_play_menu_sound_looped(unsigned i);
|
||||
|
||||
void audio_driver_mixer_play_stream_sequential(unsigned i);
|
||||
|
||||
void audio_driver_mixer_play_stream_looped(unsigned i);
|
||||
|
||||
void audio_driver_mixer_stop_stream(unsigned i);
|
||||
|
||||
float audio_driver_mixer_get_stream_volume(unsigned i);
|
||||
|
||||
void audio_driver_mixer_set_stream_volume(unsigned i, float vol);
|
||||
|
||||
void audio_driver_mixer_remove_stream(unsigned i);
|
||||
|
||||
enum audio_mixer_state audio_driver_mixer_get_stream_state(unsigned i);
|
||||
|
||||
const char *audio_driver_mixer_get_stream_name(unsigned i);
|
||||
|
||||
bool compute_audio_buffer_statistics(audio_statistics_t *stats);
|
||||
|
||||
void audio_driver_load_menu_sounds(void);
|
||||
|
||||
const char* audio_driver_get_ident(void);
|
||||
|
||||
extern audio_driver_t audio_rsound;
|
||||
extern audio_driver_t audio_audioio;
|
||||
extern audio_driver_t audio_oss;
|
||||
extern audio_driver_t audio_alsa;
|
||||
extern audio_driver_t audio_alsathread;
|
||||
extern audio_driver_t audio_tinyalsa;
|
||||
extern audio_driver_t audio_roar;
|
||||
extern audio_driver_t audio_openal;
|
||||
extern audio_driver_t audio_opensl;
|
||||
extern audio_driver_t audio_jack;
|
||||
extern audio_driver_t audio_sdl;
|
||||
extern audio_driver_t audio_xa;
|
||||
extern audio_driver_t audio_pulse;
|
||||
extern audio_driver_t audio_dsound;
|
||||
extern audio_driver_t audio_wasapi;
|
||||
extern audio_driver_t audio_coreaudio;
|
||||
extern audio_driver_t audio_coreaudio3;
|
||||
extern audio_driver_t audio_xenon360;
|
||||
extern audio_driver_t audio_ps3;
|
||||
extern audio_driver_t audio_gx;
|
||||
extern audio_driver_t audio_ax;
|
||||
extern audio_driver_t audio_psp;
|
||||
extern audio_driver_t audio_ps2;
|
||||
extern audio_driver_t audio_ctr_csnd;
|
||||
extern audio_driver_t audio_ctr_dsp;
|
||||
extern audio_driver_t audio_switch;
|
||||
extern audio_driver_t audio_switch_thread;
|
||||
extern audio_driver_t audio_rwebaudio;
|
||||
extern audio_driver_t audio_null;
|
||||
|
||||
RETRO_END_DECLS
|
||||
|
||||
#endif
|
@ -19,7 +19,7 @@
|
||||
|
||||
#include <boolean.h>
|
||||
|
||||
#include "audio_driver.h"
|
||||
#include "../retroarch.h"
|
||||
|
||||
/**
|
||||
* audio_init_thread:
|
||||
|
@ -21,7 +21,7 @@
|
||||
|
||||
#include <alsa/asoundlib.h>
|
||||
|
||||
#include "../audio_driver.h"
|
||||
#include "../../retroarch.h"
|
||||
#include "../../verbosity.h"
|
||||
|
||||
typedef struct alsa
|
||||
|
@ -19,7 +19,7 @@
|
||||
#include <sys/asoundlib.h>
|
||||
#include <retro_math.h>
|
||||
|
||||
#include "../audio_driver.h"
|
||||
#include "../../retroarch.h"
|
||||
|
||||
#define MAX_FRAG_SIZE 3072
|
||||
#define DEFAULT_RATE 48000
|
||||
|
@ -24,7 +24,7 @@
|
||||
#include <queues/fifo_queue.h>
|
||||
#include <string/stdstring.h>
|
||||
|
||||
#include "../audio_driver.h"
|
||||
#include "../../retroarch.h"
|
||||
#include "../../verbosity.h"
|
||||
|
||||
#define TRY_ALSA(x) if (x < 0) \
|
||||
|
@ -27,7 +27,7 @@
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include "../audio_driver.h"
|
||||
#include "../../retroarch.h"
|
||||
#include "../../verbosity.h"
|
||||
|
||||
#define DEFAULT_DEV "/dev/audio"
|
||||
|
@ -31,7 +31,7 @@
|
||||
#include <retro_endianness.h>
|
||||
#include <string/stdstring.h>
|
||||
|
||||
#include "../audio_driver.h"
|
||||
#include "../../retroarch.h"
|
||||
#include "../../verbosity.h"
|
||||
|
||||
typedef struct coreaudio
|
||||
|
@ -22,7 +22,7 @@
|
||||
#include <stdlib.h>
|
||||
#include <memory.h>
|
||||
|
||||
#include "../audio_driver.h"
|
||||
#include "../../retroarch.h"
|
||||
|
||||
#pragma mark - ringbuffer
|
||||
|
||||
|
@ -19,7 +19,7 @@
|
||||
#include <retro_miscellaneous.h>
|
||||
#include <retro_timers.h>
|
||||
|
||||
#include "../audio_driver.h"
|
||||
#include "../../retroarch.h"
|
||||
|
||||
typedef struct
|
||||
{
|
||||
|
@ -17,7 +17,7 @@
|
||||
#include <string.h>
|
||||
#include <malloc.h>
|
||||
|
||||
#include "../audio_driver.h"
|
||||
#include "../../retroarch.h"
|
||||
#include "../../ctr/ctr_debug.h"
|
||||
|
||||
typedef struct
|
||||
|
@ -37,7 +37,7 @@
|
||||
#endif
|
||||
#include <queues/fifo_queue.h>
|
||||
|
||||
#include "../audio_driver.h"
|
||||
#include "../../retroarch.h"
|
||||
#include "../../verbosity.h"
|
||||
|
||||
#ifdef _XBOX
|
||||
|
@ -27,7 +27,7 @@
|
||||
#include <boolean.h>
|
||||
#include <retro_inline.h>
|
||||
|
||||
#include "../audio_driver.h"
|
||||
#include "../../retroarch.h"
|
||||
#include "../../defines/gx_defines.h"
|
||||
|
||||
typedef struct
|
||||
|
@ -25,7 +25,7 @@
|
||||
#include <boolean.h>
|
||||
#include <rthreads/rthreads.h>
|
||||
|
||||
#include "../audio_driver.h"
|
||||
#include "../../retroarch.h"
|
||||
#include "../../configuration.h"
|
||||
#include "../../verbosity.h"
|
||||
|
||||
|
@ -14,7 +14,7 @@
|
||||
* If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "../audio_driver.h"
|
||||
#include "../../retroarch.h"
|
||||
#include "../../verbosity.h"
|
||||
|
||||
static void *null_audio_init(const char *device, unsigned rate, unsigned latency,
|
||||
|
@ -33,7 +33,7 @@
|
||||
#include <retro_miscellaneous.h>
|
||||
#include <retro_timers.h>
|
||||
|
||||
#include "../audio_driver.h"
|
||||
#include "../../retroarch.h"
|
||||
#include "../../verbosity.h"
|
||||
|
||||
#define BUFSIZE 1024
|
||||
|
@ -21,7 +21,7 @@
|
||||
|
||||
#include <rthreads/rthreads.h>
|
||||
|
||||
#include "../audio_driver.h"
|
||||
#include "../../retroarch.h"
|
||||
|
||||
/* Helper macros, COM-style. */
|
||||
#define SLObjectItf_Realize(a, ...) ((*(a))->Realize(a, __VA_ARGS__))
|
||||
|
@ -33,7 +33,7 @@
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include "../audio_driver.h"
|
||||
#include "../../retroarch.h"
|
||||
#include "../../verbosity.h"
|
||||
|
||||
#ifdef HAVE_OSS_BSD
|
||||
|
@ -21,7 +21,7 @@
|
||||
#include <kernel.h>
|
||||
#include <audsrv.h>
|
||||
|
||||
#include "../audio_driver.h"
|
||||
#include "../../retroarch.h"
|
||||
|
||||
#define AUDIO_BUFFER 128 * 1024
|
||||
#define AUDIO_CHANNELS 2
|
||||
|
@ -19,7 +19,7 @@
|
||||
|
||||
#include <queues/fifo_queue.h>
|
||||
|
||||
#include "../audio_driver.h"
|
||||
#include "../../retroarch.h"
|
||||
|
||||
#include "../../defines/ps3_defines.h"
|
||||
|
||||
|
@ -40,7 +40,7 @@
|
||||
#define SceUID uint32_t
|
||||
#endif
|
||||
|
||||
#include "../audio_driver.h"
|
||||
#include "../../retroarch.h"
|
||||
|
||||
typedef struct psp_audio
|
||||
{
|
||||
|
@ -23,7 +23,7 @@
|
||||
#include <retro_miscellaneous.h>
|
||||
#include <retro_endianness.h>
|
||||
|
||||
#include "../audio_driver.h"
|
||||
#include "../../retroarch.h"
|
||||
#include "../../verbosity.h"
|
||||
|
||||
typedef struct
|
||||
|
@ -23,7 +23,7 @@
|
||||
|
||||
#include <boolean.h>
|
||||
|
||||
#include "../audio_driver.h"
|
||||
#include "../../retroarch.h"
|
||||
#include "../../verbosity.h"
|
||||
|
||||
typedef struct
|
||||
|
@ -21,7 +21,7 @@
|
||||
#include <queues/fifo_queue.h>
|
||||
#include <rthreads/rthreads.h>
|
||||
|
||||
#include "../audio_driver.h"
|
||||
#include "../../retroarch.h"
|
||||
#include "rsound.h"
|
||||
|
||||
typedef struct rsd
|
||||
|
@ -18,7 +18,7 @@
|
||||
#include <unistd.h>
|
||||
#include <boolean.h>
|
||||
|
||||
#include "../audio_driver.h"
|
||||
#include "../../retroarch.h"
|
||||
|
||||
/* forward declarations */
|
||||
unsigned RWebAudioSampleRate(void);
|
||||
|
@ -14,20 +14,20 @@
|
||||
* If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <boolean.h>
|
||||
#include <rthreads/rthreads.h>
|
||||
#include <queues/fifo_queue.h>
|
||||
#include <retro_inline.h>
|
||||
#include <retro_math.h>
|
||||
|
||||
#include "../audio_driver.h"
|
||||
#include "../../retroarch.h"
|
||||
#include "../../verbosity.h"
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "SDL.h"
|
||||
#include "SDL_audio.h"
|
||||
|
||||
|
@ -20,7 +20,7 @@
|
||||
#include <stdint.h>
|
||||
|
||||
#include "switch_audio_compat.h"
|
||||
#include "../audio_driver.h"
|
||||
#include "../../retroarch.h"
|
||||
#include "../../verbosity.h"
|
||||
|
||||
#ifdef HAVE_LIBNX
|
||||
|
@ -28,7 +28,7 @@
|
||||
#endif
|
||||
|
||||
#include <queues/fifo_queue.h>
|
||||
#include "../audio_driver.h"
|
||||
#include "../../retroarch.h"
|
||||
#include "../../verbosity.h"
|
||||
|
||||
#include "../../tasks/tasks_internal.h"
|
||||
|
@ -64,7 +64,7 @@
|
||||
#include <retro_inline.h>
|
||||
#include <retro_endianness.h>
|
||||
|
||||
#include "../audio_driver.h"
|
||||
#include "../../retroarch.h"
|
||||
#include "../../verbosity.h"
|
||||
|
||||
/* Implementation tinyalsa pcm */
|
||||
|
@ -41,7 +41,7 @@ DEFINE_GUID(KSDATAFORMAT_SUBTYPE_IEEE_FLOAT, 0x00000003, 0x0000, 0x0010, 0x80, 0
|
||||
#include <lists/string_list.h>
|
||||
#include <queues/fifo_queue.h>
|
||||
|
||||
#include "../audio_driver.h"
|
||||
#include "../../retroarch.h"
|
||||
#include "../../verbosity.h"
|
||||
#include "../../configuration.h"
|
||||
|
||||
|
@ -21,10 +21,10 @@
|
||||
#include <wiiu/os.h>
|
||||
#include <wiiu/ax.h>
|
||||
|
||||
#include "wiiu/wiiu_dbg.h"
|
||||
#include "wiiu/system/memory.h"
|
||||
#include "../../wiiu/wiiu_dbg.h"
|
||||
#include "../../wiiu/system/memory.h"
|
||||
|
||||
#include "audio/audio_driver.h"
|
||||
#include "../../retroarch.h"
|
||||
|
||||
typedef struct
|
||||
{
|
||||
|
@ -36,7 +36,7 @@
|
||||
|
||||
#include "xaudio.h"
|
||||
|
||||
#include "../audio_driver.h"
|
||||
#include "../../retroarch.h"
|
||||
#include "../../verbosity.h"
|
||||
|
||||
typedef struct xaudio2 xaudio2_t;
|
||||
|
@ -21,7 +21,7 @@
|
||||
|
||||
#include <retro_inline.h>
|
||||
|
||||
#include "../audio_driver.h"
|
||||
#include "../../retroarch.h"
|
||||
|
||||
#define SOUND_FREQUENCY 48000
|
||||
#define MAX_BUFFER 2048
|
||||
|
@ -74,7 +74,6 @@
|
||||
#include "driver.h"
|
||||
#include "input/input_driver.h"
|
||||
#include "frontend/frontend_driver.h"
|
||||
#include "audio/audio_driver.h"
|
||||
#include "record/record_driver.h"
|
||||
#include "file_path_special.h"
|
||||
#include "autosave.h"
|
||||
|
@ -33,7 +33,6 @@
|
||||
#endif
|
||||
|
||||
#include "file_path_special.h"
|
||||
#include "audio/audio_driver.h"
|
||||
#include "gfx/video_driver.h"
|
||||
#include "input/input_driver.h"
|
||||
#include "configuration.h"
|
||||
|
@ -42,7 +42,7 @@
|
||||
#include "managers/state_manager.h"
|
||||
#include "verbosity.h"
|
||||
#include "gfx/video_driver.h"
|
||||
#include "audio/audio_driver.h"
|
||||
#include "retroarch.h"
|
||||
#include "tasks/tasks_internal.h"
|
||||
|
||||
#ifdef HAVE_RUNAHEAD
|
||||
|
@ -52,7 +52,6 @@
|
||||
#include "dynamic.h"
|
||||
#include "command.h"
|
||||
|
||||
#include "audio/audio_driver.h"
|
||||
#include "record/record_driver.h"
|
||||
#include "driver.h"
|
||||
#include "performance_counters.h"
|
||||
|
@ -46,7 +46,6 @@
|
||||
#include "../../paths.h"
|
||||
#include "retroarch.h"
|
||||
#include "file_path_special.h"
|
||||
#include "audio/audio_driver.h"
|
||||
|
||||
#include "ctr/ctr_debug.h"
|
||||
#include "ctr/exec-3dsx/exec_3dsx.h"
|
||||
|
@ -30,14 +30,14 @@
|
||||
#include <lists/file_list.h>
|
||||
#endif
|
||||
|
||||
#include <string/stdstring.h>
|
||||
|
||||
#include "../frontend_driver.h"
|
||||
#include "../../verbosity.h"
|
||||
#include "../../defaults.h"
|
||||
#include "../../paths.h"
|
||||
#include "../../retroarch.h"
|
||||
#include "../../file_path_special.h"
|
||||
#include "../../audio/audio_driver.h"
|
||||
#include <string/stdstring.h>
|
||||
|
||||
#ifndef IS_SALAMANDER
|
||||
#ifdef HAVE_MENU
|
||||
|
@ -32,7 +32,6 @@
|
||||
#include <gfx/video_frame.h>
|
||||
#include <formats/image.h>
|
||||
|
||||
#include "../audio/audio_driver.h"
|
||||
#include "../menu/menu_shader.h"
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
|
@ -890,7 +890,6 @@ DRIVERS
|
||||
#include "../gfx/video_display_server.c"
|
||||
#include "../gfx/video_coord_array.c"
|
||||
#include "../input/input_driver.c"
|
||||
#include "../audio/audio_driver.c"
|
||||
#include "../libretro-common/audio/audio_mixer.c"
|
||||
|
||||
/*============================================================
|
||||
|
@ -40,7 +40,6 @@
|
||||
#include "core_info.h"
|
||||
#include "gfx/video_driver.h"
|
||||
#include "input/input_driver.h"
|
||||
#include "audio/audio_driver.h"
|
||||
#include "record/record_driver.h"
|
||||
#include "midi/midi_driver.h"
|
||||
#include "configuration.h"
|
||||
|
@ -32,7 +32,6 @@
|
||||
#include "../core.h"
|
||||
#include "../retroarch.h"
|
||||
#include "../verbosity.h"
|
||||
#include "../audio/audio_driver.h"
|
||||
|
||||
#ifdef HAVE_NETWORKING
|
||||
#include "../network/netplay/netplay.h"
|
||||
|
@ -30,7 +30,6 @@
|
||||
#include "../../tasks/tasks_internal.h"
|
||||
#include "../../input/input_driver.h"
|
||||
|
||||
#include "../../audio/audio_driver.h"
|
||||
#include "../../core.h"
|
||||
#include "../../core_info.h"
|
||||
#include "../../configuration.h"
|
||||
|
@ -36,7 +36,6 @@
|
||||
#include "../../managers/cheat_manager.h"
|
||||
#include "../../file_path_special.h"
|
||||
#include "../../driver.h"
|
||||
#include "../../audio/audio_driver.h"
|
||||
#include "../../gfx/video_driver.h"
|
||||
#include "../../retroarch.h"
|
||||
#include "../../network/netplay/netplay.h"
|
||||
|
@ -49,7 +49,6 @@
|
||||
#include "../menu_content.h"
|
||||
#include "../menu_shader.h"
|
||||
|
||||
#include "../../audio/audio_driver.h"
|
||||
#include "../../core.h"
|
||||
#include "../../configuration.h"
|
||||
#include "../../core_info.h"
|
||||
|
@ -30,7 +30,6 @@
|
||||
#include "../menu_setting.h"
|
||||
#include "../menu_shader.h"
|
||||
|
||||
#include "../../audio/audio_driver.h"
|
||||
#include "../../configuration.h"
|
||||
#include "../../core.h"
|
||||
#include "../../core_info.h"
|
||||
|
@ -28,7 +28,6 @@
|
||||
#include "../menu_setting.h"
|
||||
#include "../menu_shader.h"
|
||||
|
||||
#include "../../audio/audio_driver.h"
|
||||
#include "../../configuration.h"
|
||||
#include "../../core.h"
|
||||
#include "../../core_info.h"
|
||||
|
@ -15,20 +15,21 @@
|
||||
|
||||
#include <compat/strl.h>
|
||||
|
||||
#include "../../audio/audio_driver.h"
|
||||
#include <string.h>
|
||||
#include <string/stdstring.h>
|
||||
#include <file/file_path.h>
|
||||
|
||||
#include "../menu_driver.h"
|
||||
#include "../menu_cbs.h"
|
||||
|
||||
#include "../../retroarch.h"
|
||||
|
||||
#ifdef HAVE_CHEEVOS
|
||||
#include "../../cheevos-new/cheevos.h"
|
||||
#endif
|
||||
#include "../../core_info.h"
|
||||
#include "../../verbosity.h"
|
||||
|
||||
#include <string.h>
|
||||
#include <string/stdstring.h>
|
||||
#include <file/file_path.h>
|
||||
|
||||
#ifndef BIND_ACTION_SUBLABEL
|
||||
#define BIND_ACTION_SUBLABEL(cbs, name) \
|
||||
cbs->action_sublabel = name; \
|
||||
|
@ -19,11 +19,11 @@
|
||||
|
||||
#include <compat/strl.h>
|
||||
|
||||
#include "../../audio/audio_driver.h"
|
||||
|
||||
#include "../menu_driver.h"
|
||||
#include "../menu_cbs.h"
|
||||
|
||||
#include "../../retroarch.h"
|
||||
|
||||
#ifndef BIND_ACTION_GET_TITLE
|
||||
#define BIND_ACTION_GET_TITLE(cbs, name) \
|
||||
cbs->action_get_title = name; \
|
||||
|
@ -69,7 +69,6 @@
|
||||
#include "widgets/menu_dialog.h"
|
||||
#include "widgets/menu_filebrowser.h"
|
||||
|
||||
#include "../audio/audio_driver.h"
|
||||
#include "../configuration.h"
|
||||
#include "../file_path_special.h"
|
||||
#include "../defaults.h"
|
||||
|
@ -33,7 +33,7 @@
|
||||
#include "menu_input.h"
|
||||
#include "menu_entries.h"
|
||||
|
||||
#include "../audio/audio_driver.h"
|
||||
#include "../retroarch.h"
|
||||
#include "../file_path_special.h"
|
||||
#include "../gfx/font_driver.h"
|
||||
#include "../gfx/video_coord_array.h"
|
||||
|
@ -76,7 +76,6 @@
|
||||
#include "../list_special.h"
|
||||
#include "../wifi/wifi_driver.h"
|
||||
#include "../record/record_driver.h"
|
||||
#include "../audio/audio_driver.h"
|
||||
#include "../input/input_driver.h"
|
||||
#include "../midi/midi_driver.h"
|
||||
#include "../tasks/tasks_internal.h"
|
||||
|
1793
retroarch.c
1793
retroarch.c
File diff suppressed because it is too large
Load Diff
262
retroarch.h
262
retroarch.h
@ -26,6 +26,9 @@
|
||||
|
||||
#include <queues/task_queue.h>
|
||||
#include <queues/message_queue.h>
|
||||
#include <audio/audio_mixer.h>
|
||||
|
||||
#include "audio/audio_defines.h"
|
||||
|
||||
#include "core_type.h"
|
||||
#include "core.h"
|
||||
@ -445,6 +448,265 @@ void rarch_log_file_deinit(void);
|
||||
|
||||
enum retro_language rarch_get_language_from_iso(const char *lang);
|
||||
|
||||
/* Audio */
|
||||
|
||||
typedef struct audio_mixer_stream
|
||||
{
|
||||
audio_mixer_sound_t *handle;
|
||||
audio_mixer_voice_t *voice;
|
||||
audio_mixer_stop_cb_t stop_cb;
|
||||
enum audio_mixer_stream_type stream_type;
|
||||
enum audio_mixer_type type;
|
||||
enum audio_mixer_state state;
|
||||
float volume;
|
||||
void *buf;
|
||||
char *name;
|
||||
size_t bufsize;
|
||||
} audio_mixer_stream_t;
|
||||
|
||||
typedef struct audio_mixer_stream_params
|
||||
{
|
||||
float volume;
|
||||
enum audio_mixer_slot_selection_type slot_selection_type;
|
||||
unsigned slot_selection_idx;
|
||||
enum audio_mixer_stream_type stream_type;
|
||||
enum audio_mixer_type type;
|
||||
enum audio_mixer_state state;
|
||||
void *buf;
|
||||
char *basename;
|
||||
size_t bufsize;
|
||||
audio_mixer_stop_cb_t cb;
|
||||
} audio_mixer_stream_params_t;
|
||||
|
||||
typedef struct audio_driver
|
||||
{
|
||||
/* Creates and initializes handle to audio driver.
|
||||
*
|
||||
* Returns: audio driver handle on success, otherwise NULL.
|
||||
**/
|
||||
void *(*init)(const char *device, unsigned rate,
|
||||
unsigned latency, unsigned block_frames, unsigned *new_rate);
|
||||
|
||||
/*
|
||||
* @data : Pointer to audio data handle.
|
||||
* @buf : Audio buffer data.
|
||||
* @size : Size of audio buffer.
|
||||
*
|
||||
* Write samples to audio driver.
|
||||
*
|
||||
* Write data in buffer to audio driver.
|
||||
* A frame here is defined as one combined sample of left and right
|
||||
* channels. (I.e. 44.1kHz, 16-bit stereo has 88.2k samples/s, and
|
||||
* 44.1k frames/s.)
|
||||
*
|
||||
* Samples are interleaved in format LRLRLRLRLR ...
|
||||
* If the driver returns true in use_float(), a floating point
|
||||
* format will be used, with range [-1.0, 1.0].
|
||||
* If not, signed 16-bit samples in native byte ordering will be used.
|
||||
*
|
||||
* This function returns the number of frames successfully written.
|
||||
* If an error occurs, -1 should be returned.
|
||||
* Note that non-blocking behavior that cannot write at this time
|
||||
* should return 0 as returning -1 will terminate the driver.
|
||||
*
|
||||
* Unless said otherwise with set_nonblock_state(), all writes
|
||||
* are blocking, and it should block till it has written all frames.
|
||||
*/
|
||||
ssize_t (*write)(void *data, const void *buf, size_t size);
|
||||
|
||||
/* Temporarily pauses the audio driver. */
|
||||
bool (*stop)(void *data);
|
||||
|
||||
/* Resumes audio driver from the paused state. */
|
||||
bool (*start)(void *data, bool is_shutdown);
|
||||
|
||||
/* Is the audio driver currently running? */
|
||||
bool (*alive)(void *data);
|
||||
|
||||
/* Should we care about blocking in audio thread? Fast forwarding.
|
||||
*
|
||||
* If state is true, nonblocking operation is assumed.
|
||||
* This is typically used for fast-forwarding. If driver cannot
|
||||
* implement nonblocking writes, this can be disregarded, but should
|
||||
* log a message to stderr.
|
||||
* */
|
||||
void (*set_nonblock_state)(void *data, bool toggle);
|
||||
|
||||
/* Stops and frees driver data. */
|
||||
void (*free)(void *data);
|
||||
|
||||
/* Defines if driver will take standard floating point samples,
|
||||
* or int16_t samples.
|
||||
*
|
||||
* If true is returned, the audio driver is capable of using
|
||||
* floating point data. This will likely increase performance as the
|
||||
* resampler unit uses floating point. The sample range is
|
||||
* [-1.0, 1.0].
|
||||
* */
|
||||
bool (*use_float)(void *data);
|
||||
|
||||
/* Human-readable identifier. */
|
||||
const char *ident;
|
||||
|
||||
/* Optional. Get audio device list (allocates, caller has to free this) */
|
||||
void *(*device_list_new)(void *data);
|
||||
|
||||
/* Optional. Frees audio device list */
|
||||
void (*device_list_free)(void *data, void *data2);
|
||||
|
||||
/* Optional. */
|
||||
size_t (*write_avail)(void *data);
|
||||
|
||||
size_t (*buffer_size)(void *data);
|
||||
} audio_driver_t;
|
||||
|
||||
void audio_driver_suspend(void);
|
||||
|
||||
bool audio_driver_is_suspended(void);
|
||||
|
||||
void audio_driver_resume(void);
|
||||
|
||||
void audio_driver_set_active(void);
|
||||
|
||||
bool audio_driver_is_active(void);
|
||||
|
||||
bool audio_driver_enable_callback(void);
|
||||
|
||||
bool audio_driver_disable_callback(void);
|
||||
|
||||
/**
|
||||
* audio_driver_find_handle:
|
||||
* @index : index of driver to get handle to.
|
||||
*
|
||||
* Returns: handle to audio driver at index. Can be NULL
|
||||
* if nothing found.
|
||||
**/
|
||||
const void *audio_driver_find_handle(int index);
|
||||
|
||||
/**
|
||||
* audio_driver_find_ident:
|
||||
* @index : index of driver to get handle to.
|
||||
*
|
||||
* Returns: Human-readable identifier of audio driver at index. Can be NULL
|
||||
* if nothing found.
|
||||
**/
|
||||
const char *audio_driver_find_ident(int index);
|
||||
|
||||
void audio_driver_set_nonblocking_state(bool enable);
|
||||
|
||||
/**
|
||||
* config_get_audio_driver_options:
|
||||
*
|
||||
* Get an enumerated list of all audio driver names, separated by '|'.
|
||||
*
|
||||
* Returns: string listing of all audio driver names, separated by '|'.
|
||||
**/
|
||||
const char* config_get_audio_driver_options(void);
|
||||
|
||||
void audio_driver_sample(int16_t left, int16_t right);
|
||||
|
||||
size_t audio_driver_sample_batch(const int16_t *data, size_t frames);
|
||||
|
||||
void audio_driver_sample_rewind(int16_t left, int16_t right);
|
||||
|
||||
size_t audio_driver_sample_batch_rewind(const int16_t *data, size_t frames);
|
||||
|
||||
bool audio_driver_mixer_extension_supported(const char *ext);
|
||||
|
||||
void audio_driver_dsp_filter_free(void);
|
||||
|
||||
void audio_driver_dsp_filter_init(const char *device);
|
||||
|
||||
void audio_driver_set_buffer_size(size_t bufsize);
|
||||
|
||||
bool audio_driver_get_devices_list(void **ptr);
|
||||
|
||||
void audio_driver_setup_rewind(void);
|
||||
|
||||
bool audio_driver_set_callback(const void *data);
|
||||
|
||||
bool audio_driver_callback(void);
|
||||
|
||||
bool audio_driver_has_callback(void);
|
||||
|
||||
bool audio_driver_toggle_mute(void);
|
||||
|
||||
bool audio_driver_start(bool is_shutdown);
|
||||
|
||||
bool audio_driver_stop(void);
|
||||
|
||||
void audio_driver_frame_is_reverse(void);
|
||||
|
||||
void audio_set_float(enum audio_action action, float val);
|
||||
|
||||
void audio_set_bool(enum audio_action action, bool val);
|
||||
|
||||
void audio_unset_bool(enum audio_action action, bool val);
|
||||
|
||||
float *audio_get_float_ptr(enum audio_action action);
|
||||
|
||||
bool *audio_get_bool_ptr(enum audio_action action);
|
||||
|
||||
audio_mixer_stream_t *audio_driver_mixer_get_stream(unsigned i);
|
||||
|
||||
bool audio_driver_mixer_add_stream(audio_mixer_stream_params_t *params);
|
||||
|
||||
void audio_driver_mixer_play_stream(unsigned i);
|
||||
|
||||
void audio_driver_mixer_play_menu_sound(unsigned i);
|
||||
|
||||
void audio_driver_mixer_play_menu_sound_looped(unsigned i);
|
||||
|
||||
void audio_driver_mixer_play_stream_sequential(unsigned i);
|
||||
|
||||
void audio_driver_mixer_play_stream_looped(unsigned i);
|
||||
|
||||
void audio_driver_mixer_stop_stream(unsigned i);
|
||||
|
||||
float audio_driver_mixer_get_stream_volume(unsigned i);
|
||||
|
||||
void audio_driver_mixer_set_stream_volume(unsigned i, float vol);
|
||||
|
||||
void audio_driver_mixer_remove_stream(unsigned i);
|
||||
|
||||
enum audio_mixer_state audio_driver_mixer_get_stream_state(unsigned i);
|
||||
|
||||
const char *audio_driver_mixer_get_stream_name(unsigned i);
|
||||
|
||||
bool compute_audio_buffer_statistics(audio_statistics_t *stats);
|
||||
|
||||
void audio_driver_load_menu_sounds(void);
|
||||
|
||||
extern audio_driver_t audio_rsound;
|
||||
extern audio_driver_t audio_audioio;
|
||||
extern audio_driver_t audio_oss;
|
||||
extern audio_driver_t audio_alsa;
|
||||
extern audio_driver_t audio_alsathread;
|
||||
extern audio_driver_t audio_tinyalsa;
|
||||
extern audio_driver_t audio_roar;
|
||||
extern audio_driver_t audio_openal;
|
||||
extern audio_driver_t audio_opensl;
|
||||
extern audio_driver_t audio_jack;
|
||||
extern audio_driver_t audio_sdl;
|
||||
extern audio_driver_t audio_xa;
|
||||
extern audio_driver_t audio_pulse;
|
||||
extern audio_driver_t audio_dsound;
|
||||
extern audio_driver_t audio_wasapi;
|
||||
extern audio_driver_t audio_coreaudio;
|
||||
extern audio_driver_t audio_coreaudio3;
|
||||
extern audio_driver_t audio_xenon360;
|
||||
extern audio_driver_t audio_ps3;
|
||||
extern audio_driver_t audio_gx;
|
||||
extern audio_driver_t audio_ax;
|
||||
extern audio_driver_t audio_psp;
|
||||
extern audio_driver_t audio_ps2;
|
||||
extern audio_driver_t audio_ctr_csnd;
|
||||
extern audio_driver_t audio_ctr_dsp;
|
||||
extern audio_driver_t audio_switch;
|
||||
extern audio_driver_t audio_switch_thread;
|
||||
extern audio_driver_t audio_rwebaudio;
|
||||
extern audio_driver_t audio_null;
|
||||
|
||||
/* BSV Movie */
|
||||
|
||||
enum rarch_movie_type
|
||||
|
@ -11,7 +11,6 @@
|
||||
|
||||
#include "../core.h"
|
||||
#include "../dynamic.h"
|
||||
#include "../audio/audio_driver.h"
|
||||
#include "../gfx/video_driver.h"
|
||||
#include "../configuration.h"
|
||||
#include "../retroarch.h"
|
||||
|
@ -28,9 +28,8 @@
|
||||
#include <retro_miscellaneous.h>
|
||||
#include <queues/task_queue.h>
|
||||
|
||||
#include "../audio/audio_driver.h"
|
||||
|
||||
#include "../file_path_special.h"
|
||||
#include "../retroarch.h"
|
||||
#include "../verbosity.h"
|
||||
|
||||
#include "task_file_transfer.h"
|
||||
|
@ -28,7 +28,7 @@
|
||||
#include "../config.h"
|
||||
#endif
|
||||
|
||||
#include "../audio/audio_driver.h"
|
||||
#include "../retroarch.h"
|
||||
|
||||
RETRO_BEGIN_DECLS
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user