mirror of
https://github.com/libretro/RetroArch
synced 2025-01-29 18:32:44 +00:00
Split up audio code into new file audio/audio_driver.c (#13097)
* Split up audio code into new file audio/audio_driver.c * Fix build issues #1 * Small cleanup * Fix typo
This commit is contained in:
parent
177d05144a
commit
e7f182811a
@ -306,6 +306,7 @@ OBJ += \
|
||||
$(LIBRETRO_COMM_DIR)/file/file_path_io.o \
|
||||
file_path_special.o \
|
||||
$(LIBRETRO_COMM_DIR)/hash/lrc_hash.o \
|
||||
audio/audio_driver.o \
|
||||
input/input_driver.o \
|
||||
input/common/input_hid_common.o \
|
||||
led/led_driver.o \
|
||||
|
1789
audio/audio_driver.c
Normal file
1789
audio/audio_driver.c
Normal file
File diff suppressed because it is too large
Load Diff
427
audio/audio_driver.h
Normal file
427
audio/audio_driver.h
Normal file
@ -0,0 +1,427 @@
|
||||
/* 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 <stdlib.h>
|
||||
#include <stddef.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#include <boolean.h>
|
||||
#include <retro_common_api.h>
|
||||
#include <retro_inline.h>
|
||||
#include <libretro.h>
|
||||
#include <retro_miscellaneous.h>
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "../config.h"
|
||||
#endif /* HAVE_CONFIG_H */
|
||||
|
||||
#ifdef HAVE_DSP_FILTER
|
||||
#include <audio/dsp_filter.h>
|
||||
#endif
|
||||
#ifdef HAVE_AUDIOMIXER
|
||||
#include <audio/audio_mixer.h>
|
||||
#endif
|
||||
#include <audio/audio_resampler.h>
|
||||
|
||||
#include "audio_defines.h"
|
||||
|
||||
#define AUDIO_BUFFER_FREE_SAMPLES_COUNT (8 * 1024)
|
||||
|
||||
RETRO_BEGIN_DECLS
|
||||
|
||||
#ifdef HAVE_AUDIOMIXER
|
||||
typedef struct audio_mixer_stream
|
||||
{
|
||||
audio_mixer_sound_t *handle;
|
||||
audio_mixer_voice_t *voice;
|
||||
audio_mixer_stop_cb_t stop_cb;
|
||||
void *buf;
|
||||
char *name;
|
||||
size_t bufsize;
|
||||
float volume;
|
||||
enum audio_mixer_stream_type stream_type;
|
||||
enum audio_mixer_type type;
|
||||
enum audio_mixer_state state;
|
||||
} audio_mixer_stream_t;
|
||||
|
||||
typedef struct audio_mixer_stream_params
|
||||
{
|
||||
void *buf;
|
||||
char *basename;
|
||||
audio_mixer_stop_cb_t cb;
|
||||
size_t bufsize;
|
||||
unsigned slot_selection_idx;
|
||||
float volume;
|
||||
enum audio_mixer_slot_selection_type slot_selection_type;
|
||||
enum audio_mixer_stream_type stream_type;
|
||||
enum audio_mixer_type type;
|
||||
enum audio_mixer_state state;
|
||||
} audio_mixer_stream_params_t;
|
||||
#endif
|
||||
|
||||
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;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
double source_ratio_original;
|
||||
double source_ratio_current;
|
||||
|
||||
uint64_t free_samples_count;
|
||||
|
||||
struct string_list *devices_list;
|
||||
float *output_samples_buf;
|
||||
#ifdef HAVE_REWIND
|
||||
int16_t *rewind_buf;
|
||||
#endif
|
||||
int16_t *output_samples_conv_buf;
|
||||
#ifdef HAVE_DSP_FILTER
|
||||
retro_dsp_filter_t *dsp;
|
||||
#endif
|
||||
const retro_resampler_t *resampler;
|
||||
|
||||
void *resampler_data;
|
||||
const audio_driver_t *current_audio;
|
||||
void *context_audio_data;
|
||||
float *input_data;
|
||||
#ifdef HAVE_AUDIOMIXER
|
||||
struct audio_mixer_stream
|
||||
mixer_streams[AUDIO_MIXER_MAX_SYSTEM_STREAMS];
|
||||
#endif
|
||||
struct retro_audio_callback callback; /* ptr alignment */
|
||||
/* ptr alignment */
|
||||
size_t chunk_size;
|
||||
size_t chunk_nonblock_size;
|
||||
size_t chunk_block_size;
|
||||
|
||||
#ifdef HAVE_REWIND
|
||||
size_t rewind_ptr;
|
||||
size_t rewind_size;
|
||||
#endif
|
||||
size_t buffer_size;
|
||||
size_t data_ptr;
|
||||
|
||||
unsigned free_samples_buf[
|
||||
AUDIO_BUFFER_FREE_SAMPLES_COUNT];
|
||||
|
||||
#ifdef HAVE_AUDIOMIXER
|
||||
float mixer_volume_gain;
|
||||
#endif
|
||||
|
||||
float rate_control_delta;
|
||||
float input;
|
||||
float volume_gain;
|
||||
|
||||
enum resampler_quality resampler_quality;
|
||||
|
||||
char resampler_ident[64];
|
||||
|
||||
bool active;
|
||||
bool control;
|
||||
bool mute_enable;
|
||||
bool use_float;
|
||||
bool suspended;
|
||||
#ifdef HAVE_AUDIOMIXER
|
||||
bool mixer_mute_enable;
|
||||
bool mixer_active;
|
||||
#endif
|
||||
#ifdef HAVE_RUNAHEAD
|
||||
bool hard_disable;
|
||||
#endif
|
||||
} audio_driver_state_t;
|
||||
|
||||
bool audio_driver_enable_callback(void);
|
||||
|
||||
bool audio_driver_disable_callback(void);
|
||||
|
||||
bool audio_driver_mixer_extension_supported(const char *ext);
|
||||
|
||||
void audio_driver_dsp_filter_free(void);
|
||||
|
||||
bool 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_callback(void);
|
||||
|
||||
bool audio_driver_has_callback(void);
|
||||
|
||||
void audio_driver_frame_is_reverse(void);
|
||||
|
||||
void audio_set_float(enum audio_action action, float val);
|
||||
|
||||
float *audio_get_float_ptr(enum audio_action action);
|
||||
|
||||
bool *audio_get_bool_ptr(enum audio_action action);
|
||||
|
||||
#ifdef HAVE_AUDIOMIXER
|
||||
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);
|
||||
|
||||
void audio_driver_load_system_sounds(void);
|
||||
|
||||
#endif
|
||||
|
||||
bool audio_driver_start(bool is_shutdown);
|
||||
|
||||
bool audio_driver_stop(void);
|
||||
|
||||
#ifdef HAVE_TRANSLATE
|
||||
/* TODO/FIXME - Doesn't currently work. Fix this. */
|
||||
bool audio_driver_is_ai_service_speech_running(void);
|
||||
#endif
|
||||
|
||||
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;
|
||||
#ifdef HAVE_THREADS
|
||||
extern audio_driver_t audio_ctr_dsp_thread;
|
||||
#endif
|
||||
extern audio_driver_t audio_switch;
|
||||
extern audio_driver_t audio_switch_thread;
|
||||
extern audio_driver_t audio_switch_libnx_audren;
|
||||
extern audio_driver_t audio_switch_libnx_audren_thread;
|
||||
extern audio_driver_t audio_rwebaudio;
|
||||
|
||||
audio_driver_state_t *audio_state_get_ptr(void);
|
||||
|
||||
extern audio_driver_t *audio_drivers[];
|
||||
|
||||
/**
|
||||
* audio_driver_flush:
|
||||
* @data : pointer to audio buffer.
|
||||
* @right : amount of samples to write.
|
||||
*
|
||||
* Writes audio samples to audio driver. Will first
|
||||
* perform DSP processing (if enabled) and resampling.
|
||||
**/
|
||||
void audio_driver_flush(
|
||||
float slowmotion_ratio,
|
||||
bool audio_fastforward_mute,
|
||||
const int16_t *data, size_t samples,
|
||||
bool is_slowmotion, bool is_fastmotion);
|
||||
|
||||
/**
|
||||
* audio_compute_buffer_statistics:
|
||||
*
|
||||
* Computes audio buffer statistics.
|
||||
*
|
||||
**/
|
||||
bool audio_compute_buffer_statistics(audio_statistics_t *stats);
|
||||
|
||||
float audio_driver_monitor_adjust_system_rates(
|
||||
double input_sample_rate,
|
||||
double input_fps,
|
||||
float video_refresh_rate,
|
||||
unsigned video_swap_interval,
|
||||
float audio_max_timing_skew);
|
||||
|
||||
bool audio_driver_init_internal(
|
||||
void *settings_data,
|
||||
bool audio_cb_inited);
|
||||
|
||||
bool audio_driver_deinit(void *settings_data);
|
||||
|
||||
bool audio_driver_find_driver(
|
||||
void *settings_data,
|
||||
const char *prefix,
|
||||
bool verbosity_enabled);
|
||||
|
||||
/**
|
||||
* audio_driver_sample:
|
||||
* @left : value of the left audio channel.
|
||||
* @right : value of the right audio channel.
|
||||
*
|
||||
* Audio sample render callback function.
|
||||
**/
|
||||
void audio_driver_sample(int16_t left, int16_t right);
|
||||
|
||||
/**
|
||||
* audio_driver_sample_batch:
|
||||
* @data : pointer to audio buffer.
|
||||
* @frames : amount of audio frames to push.
|
||||
*
|
||||
* Batched audio sample render callback function.
|
||||
*
|
||||
* Returns: amount of frames sampled. Will be equal to @frames
|
||||
* unless @frames exceeds (AUDIO_CHUNK_SIZE_NONBLOCKING / 2).
|
||||
**/
|
||||
size_t audio_driver_sample_batch(const int16_t *data, size_t frames);
|
||||
|
||||
#ifdef HAVE_REWIND
|
||||
/**
|
||||
* audio_driver_sample_rewind:
|
||||
* @left : value of the left audio channel.
|
||||
* @right : value of the right audio channel.
|
||||
*
|
||||
* Audio sample render callback function (rewind version).
|
||||
* This callback function will be used instead of
|
||||
* audio_driver_sample when rewinding is activated.
|
||||
**/
|
||||
void audio_driver_sample_rewind(int16_t left, int16_t right);
|
||||
|
||||
/**
|
||||
* audio_driver_sample_batch_rewind:
|
||||
* @data : pointer to audio buffer.
|
||||
* @frames : amount of audio frames to push.
|
||||
*
|
||||
* Batched audio sample render callback function (rewind version).
|
||||
*
|
||||
* This callback function will be used instead of
|
||||
* audio_driver_sample_batch when rewinding is activated.
|
||||
*
|
||||
* Returns: amount of frames sampled. Will be equal to @frames
|
||||
* unless @frames exceeds (AUDIO_CHUNK_SIZE_NONBLOCKING / 2).
|
||||
**/
|
||||
size_t audio_driver_sample_batch_rewind(
|
||||
const int16_t *data, size_t frames);
|
||||
#endif
|
||||
|
||||
RETRO_END_DECLS
|
||||
|
||||
#endif /* __AUDIO_DRIVER__H */
|
@ -21,6 +21,7 @@
|
||||
#include <rthreads/rthreads.h>
|
||||
|
||||
#include "audio_thread_wrapper.h"
|
||||
#include "audio_driver.h"
|
||||
#include "../verbosity.h"
|
||||
|
||||
typedef struct audio_thread
|
||||
|
@ -19,7 +19,7 @@
|
||||
|
||||
#include <boolean.h>
|
||||
|
||||
#include "../retroarch.h"
|
||||
#include "audio_driver.h"
|
||||
|
||||
/**
|
||||
* audio_init_thread:
|
||||
|
@ -21,7 +21,7 @@
|
||||
|
||||
#include <alsa/asoundlib.h>
|
||||
|
||||
#include "../../retroarch.h"
|
||||
#include "../audio_driver.h"
|
||||
#include "../../verbosity.h"
|
||||
|
||||
typedef struct alsa
|
||||
|
@ -19,7 +19,7 @@
|
||||
#include <sys/asoundlib.h>
|
||||
#include <retro_math.h>
|
||||
|
||||
#include "../../retroarch.h"
|
||||
#include "../audio_driver.h"
|
||||
|
||||
#define MAX_FRAG_SIZE 3072
|
||||
#define DEFAULT_RATE 48000
|
||||
|
@ -24,7 +24,7 @@
|
||||
#include <queues/fifo_queue.h>
|
||||
#include <string/stdstring.h>
|
||||
|
||||
#include "../../retroarch.h"
|
||||
#include "../audio_driver.h"
|
||||
#include "../../verbosity.h"
|
||||
|
||||
#define TRY_ALSA(x) if (x < 0) \
|
||||
|
@ -27,7 +27,7 @@
|
||||
#include "../../config.h"
|
||||
#endif
|
||||
|
||||
#include "../../retroarch.h"
|
||||
#include "../audio_driver.h"
|
||||
#include "../../verbosity.h"
|
||||
|
||||
#define DEFAULT_DEV "/dev/audio"
|
||||
|
@ -31,7 +31,7 @@
|
||||
#include <retro_endianness.h>
|
||||
#include <string/stdstring.h>
|
||||
|
||||
#include "../../retroarch.h"
|
||||
#include "../audio_driver.h"
|
||||
#include "../../verbosity.h"
|
||||
|
||||
typedef struct coreaudio
|
||||
|
@ -22,7 +22,7 @@
|
||||
#include <stdlib.h>
|
||||
#include <memory.h>
|
||||
|
||||
#include "../../retroarch.h"
|
||||
#include "../audio_driver.h"
|
||||
#include "../../verbosity.h"
|
||||
|
||||
#pragma mark - ringbuffer
|
||||
|
@ -19,7 +19,7 @@
|
||||
#include <retro_miscellaneous.h>
|
||||
#include <retro_timers.h>
|
||||
|
||||
#include "../../retroarch.h"
|
||||
#include "../audio_driver.h"
|
||||
|
||||
typedef struct
|
||||
{
|
||||
|
@ -17,7 +17,7 @@
|
||||
#include <string.h>
|
||||
#include <malloc.h>
|
||||
|
||||
#include "../../retroarch.h"
|
||||
#include "../audio_driver.h"
|
||||
#include "../../ctr/ctr_debug.h"
|
||||
|
||||
typedef struct
|
||||
|
@ -19,7 +19,7 @@
|
||||
#include <queues/fifo_queue.h>
|
||||
#include <rthreads/rthreads.h>
|
||||
|
||||
#include "../../retroarch.h"
|
||||
#include "../audio_driver.h"
|
||||
#include "../../ctr/ctr_debug.h"
|
||||
|
||||
typedef struct
|
||||
|
@ -39,7 +39,7 @@
|
||||
#include <queues/fifo_queue.h>
|
||||
#include <string/stdstring.h>
|
||||
|
||||
#include "../../retroarch.h"
|
||||
#include "../audio_driver.h"
|
||||
#include "../../verbosity.h"
|
||||
|
||||
#ifdef _XBOX
|
||||
|
@ -27,9 +27,10 @@
|
||||
#include <boolean.h>
|
||||
#include <retro_inline.h>
|
||||
|
||||
#include "../../retroarch.h"
|
||||
#include <defines/gx_defines.h>
|
||||
|
||||
#include "../audio_driver.h"
|
||||
|
||||
typedef struct
|
||||
{
|
||||
size_t write_ptr;
|
||||
|
@ -26,7 +26,7 @@
|
||||
#include <rthreads/rthreads.h>
|
||||
|
||||
#include "../../configuration.h"
|
||||
#include "../../retroarch.h"
|
||||
#include "../audio_driver.h"
|
||||
#include "../../verbosity.h"
|
||||
|
||||
#define FRAMES(x) (x / (sizeof(float) * 2))
|
||||
|
@ -33,7 +33,7 @@
|
||||
#include <retro_miscellaneous.h>
|
||||
#include <retro_timers.h>
|
||||
|
||||
#include "../../retroarch.h"
|
||||
#include "../audio_driver.h"
|
||||
#include "../../verbosity.h"
|
||||
|
||||
#define BUFSIZE 1024
|
||||
|
@ -21,7 +21,7 @@
|
||||
|
||||
#include <rthreads/rthreads.h>
|
||||
|
||||
#include "../../retroarch.h"
|
||||
#include "../audio_driver.h"
|
||||
|
||||
/* Helper macros, COM-style. */
|
||||
#define SLObjectItf_Realize(a, ...) ((*(a))->Realize(a, __VA_ARGS__))
|
||||
|
@ -33,7 +33,7 @@
|
||||
#include "../../config.h"
|
||||
#endif
|
||||
|
||||
#include "../../retroarch.h"
|
||||
#include "../audio_driver.h"
|
||||
#include "../../verbosity.h"
|
||||
|
||||
#ifdef HAVE_OSS_BSD
|
||||
|
@ -20,7 +20,7 @@
|
||||
#include <kernel.h>
|
||||
#include <audsrv.h>
|
||||
|
||||
#include "../../retroarch.h"
|
||||
#include "../audio_driver.h"
|
||||
|
||||
#define AUDIO_BUFFER 128 * 1024
|
||||
#define AUDIO_CHANNELS 2
|
||||
|
@ -19,10 +19,10 @@
|
||||
|
||||
#include <queues/fifo_queue.h>
|
||||
|
||||
#include "../../retroarch.h"
|
||||
|
||||
#include <defines/ps3_defines.h>
|
||||
|
||||
#include "../audio_driver.h"
|
||||
|
||||
#define AUDIO_BLOCKS 8
|
||||
#define AUDIO_CHANNELS 2
|
||||
|
||||
|
@ -40,7 +40,7 @@
|
||||
#define SceUID uint32_t
|
||||
#endif
|
||||
|
||||
#include "../../retroarch.h"
|
||||
#include "../audio_driver.h"
|
||||
|
||||
typedef struct psp_audio
|
||||
{
|
||||
|
@ -23,7 +23,7 @@
|
||||
#include <retro_miscellaneous.h>
|
||||
#include <retro_endianness.h>
|
||||
|
||||
#include "../../retroarch.h"
|
||||
#include "../audio_driver.h"
|
||||
#include "../../verbosity.h"
|
||||
|
||||
typedef struct
|
||||
|
@ -23,7 +23,7 @@
|
||||
|
||||
#include <boolean.h>
|
||||
|
||||
#include "../../retroarch.h"
|
||||
#include "../audio_driver.h"
|
||||
#include "../../verbosity.h"
|
||||
|
||||
typedef struct
|
||||
|
@ -21,7 +21,7 @@
|
||||
#include <queues/fifo_queue.h>
|
||||
#include <rthreads/rthreads.h>
|
||||
|
||||
#include "../../retroarch.h"
|
||||
#include "../audio_driver.h"
|
||||
#include "rsound.h"
|
||||
|
||||
typedef struct rsd
|
||||
|
@ -18,7 +18,7 @@
|
||||
#include <unistd.h>
|
||||
#include <boolean.h>
|
||||
|
||||
#include "../../retroarch.h"
|
||||
#include "../audio_driver.h"
|
||||
|
||||
/* forward declarations */
|
||||
unsigned RWebAudioSampleRate(void);
|
||||
|
@ -25,12 +25,12 @@
|
||||
#include <retro_inline.h>
|
||||
#include <retro_math.h>
|
||||
|
||||
#include "../../retroarch.h"
|
||||
#include "../../verbosity.h"
|
||||
|
||||
#include "SDL.h"
|
||||
#include "SDL_audio.h"
|
||||
|
||||
#include "../audio_driver.h"
|
||||
#include "../../verbosity.h"
|
||||
|
||||
typedef struct sdl_audio
|
||||
{
|
||||
#ifdef HAVE_THREADS
|
||||
|
@ -20,7 +20,7 @@
|
||||
#include <stdint.h>
|
||||
|
||||
#include "switch_audio_compat.h"
|
||||
#include "../../retroarch.h"
|
||||
#include "../audio_driver.h"
|
||||
#include "../../verbosity.h"
|
||||
|
||||
#ifdef HAVE_LIBNX
|
||||
|
@ -23,7 +23,7 @@
|
||||
|
||||
#include <switch.h>
|
||||
|
||||
#include "../../retroarch.h"
|
||||
#include "../audio_driver.h"
|
||||
#include "../../verbosity.h"
|
||||
|
||||
#define BUFFER_COUNT 5
|
||||
|
@ -21,7 +21,8 @@
|
||||
#include <switch.h>
|
||||
|
||||
#include <queues/fifo_queue.h>
|
||||
#include "../../retroarch.h"
|
||||
|
||||
#include "../audio_driver.h"
|
||||
#include "../../verbosity.h"
|
||||
#include "../../tasks/tasks_internal.h"
|
||||
|
||||
|
@ -28,7 +28,8 @@
|
||||
#endif
|
||||
|
||||
#include <queues/fifo_queue.h>
|
||||
#include "../../retroarch.h"
|
||||
|
||||
#include "../audio_driver.h"
|
||||
#include "../../verbosity.h"
|
||||
|
||||
#include "../../tasks/tasks_internal.h"
|
||||
|
@ -64,7 +64,7 @@
|
||||
#include <retro_inline.h>
|
||||
#include <retro_endianness.h>
|
||||
|
||||
#include "../../retroarch.h"
|
||||
#include "../audio_driver.h"
|
||||
#include "../../verbosity.h"
|
||||
|
||||
/* Implementation tinyalsa pcm */
|
||||
|
@ -22,7 +22,7 @@
|
||||
#include "../common/mmdevice_common.h"
|
||||
#include "../common/mmdevice_common_inline.h"
|
||||
|
||||
#include "../../retroarch.h"
|
||||
#include "../audio_driver.h"
|
||||
#include "../../verbosity.h"
|
||||
#include "../../configuration.h"
|
||||
|
||||
|
@ -24,7 +24,7 @@
|
||||
#include "../../wiiu/wiiu_dbg.h"
|
||||
#include "../../wiiu/system/memory.h"
|
||||
|
||||
#include "../../retroarch.h"
|
||||
#include "../audio_driver.h"
|
||||
|
||||
typedef struct
|
||||
{
|
||||
|
@ -42,7 +42,7 @@
|
||||
#include "../common/mmdevice_common.h"
|
||||
#endif
|
||||
|
||||
#include "../../retroarch.h"
|
||||
#include "../audio_driver.h"
|
||||
#include "../../verbosity.h"
|
||||
|
||||
typedef struct xaudio2 xaudio2_t;
|
||||
|
@ -21,7 +21,7 @@
|
||||
|
||||
#include <retro_inline.h>
|
||||
|
||||
#include "../../retroarch.h"
|
||||
#include "../audio_driver.h"
|
||||
|
||||
#define SOUND_FREQUENCY 48000
|
||||
#define MAX_BUFFER 2048
|
||||
|
@ -54,6 +54,7 @@
|
||||
#include "cheevos_locals.h"
|
||||
#include "cheevos_parser.h"
|
||||
|
||||
#include "../audio/audio_driver.h"
|
||||
#include "../file_path_special.h"
|
||||
#include "../paths.h"
|
||||
#include "../command.h"
|
||||
|
@ -44,6 +44,7 @@
|
||||
#include "network/netplay/netplay.h"
|
||||
#endif
|
||||
|
||||
#include "audio/audio_driver.h"
|
||||
#include "command.h"
|
||||
#include "cheat_manager.h"
|
||||
#include "content.h"
|
||||
|
@ -46,6 +46,7 @@
|
||||
#include "retroarch.h"
|
||||
#include "verbosity.h"
|
||||
|
||||
#include "audio/audio_driver.h"
|
||||
#include "gfx/gfx_animation.h"
|
||||
|
||||
#include "tasks/task_content.h"
|
||||
|
@ -912,6 +912,7 @@ RSOUND
|
||||
/*============================================================
|
||||
AUDIO
|
||||
============================================================ */
|
||||
#include "../audio/audio_driver.c"
|
||||
#if defined(__PS3__) || defined (__PSL1GHT__)
|
||||
#include "../audio/drivers/ps3_audio.c"
|
||||
#elif defined(XENON)
|
||||
|
@ -18,6 +18,7 @@
|
||||
|
||||
#include "../menu_driver.h"
|
||||
#include "../menu_cbs.h"
|
||||
#include "../../audio/audio_driver.h"
|
||||
#include "../../configuration.h"
|
||||
#include "../../msg_hash.h"
|
||||
#ifdef HAVE_CHEATS
|
||||
|
@ -47,6 +47,7 @@
|
||||
#include "../../playlist.h"
|
||||
#include "../../manual_content_scan.h"
|
||||
#include "../misc/cpufreq/cpufreq.h"
|
||||
#include "../../audio/audio_driver.h"
|
||||
|
||||
#ifdef HAVE_NETWORKING
|
||||
#include "../../network/netplay/netplay.h"
|
||||
|
@ -20,6 +20,7 @@
|
||||
#include "../menu_dialog.h"
|
||||
|
||||
#include "../../configuration.h"
|
||||
#include "../../audio/audio_driver.h"
|
||||
|
||||
#ifdef HAVE_NETWORKING
|
||||
#include "../../network/netplay/netplay_discovery.h"
|
||||
|
@ -40,6 +40,7 @@
|
||||
#include "../../file_path_special.h"
|
||||
#include "../../driver.h"
|
||||
#include "../../retroarch.h"
|
||||
#include "../../audio/audio_driver.h"
|
||||
#include "../../network/netplay/netplay.h"
|
||||
#include "../../playlist.h"
|
||||
#include "../../manual_content_scan.h"
|
||||
|
@ -55,6 +55,7 @@
|
||||
#include "../../core.h"
|
||||
#include "../../configuration.h"
|
||||
#include "../../core_info.h"
|
||||
#include "../../audio/audio_driver.h"
|
||||
#include "../../frontend/frontend_driver.h"
|
||||
#include "../../defaults.h"
|
||||
#include "../../core_option_manager.h"
|
||||
|
@ -39,6 +39,7 @@
|
||||
#endif
|
||||
#include "../../file_path_special.h"
|
||||
#include "../../retroarch.h"
|
||||
#include "../../audio/audio_driver.h"
|
||||
#include "../../verbosity.h"
|
||||
#include "../../ui/ui_companion_driver.h"
|
||||
#include "../../network/netplay/netplay.h"
|
||||
|
@ -43,6 +43,7 @@
|
||||
#include "../../playlist.h"
|
||||
#include "../../manual_content_scan.h"
|
||||
|
||||
#include "../../audio/audio_driver.h"
|
||||
#include "../../input/input_remapping.h"
|
||||
|
||||
#include "../../config.def.h"
|
||||
|
@ -29,6 +29,7 @@
|
||||
#ifdef HAVE_CHEEVOS
|
||||
#include "../../cheevos/cheevos_menu.h"
|
||||
#endif
|
||||
#include "../../audio/audio_driver.h"
|
||||
#include "../../core_info.h"
|
||||
#include "../../verbosity.h"
|
||||
#include "../../bluetooth/bluetooth_driver.h"
|
||||
|
@ -31,6 +31,8 @@
|
||||
#include "../../cheevos/cheevos.h"
|
||||
#endif
|
||||
|
||||
#include "../../audio/audio_driver.h"
|
||||
|
||||
#ifndef BIND_ACTION_GET_TITLE
|
||||
#define BIND_ACTION_GET_TITLE(cbs, name) (cbs)->action_get_title = (name)
|
||||
#endif
|
||||
|
@ -76,6 +76,7 @@
|
||||
#include <media/media_detect_cd.h>
|
||||
#endif
|
||||
|
||||
#include "../audio/audio_driver.h"
|
||||
#include "menu_cbs.h"
|
||||
#include "menu_driver.h"
|
||||
#include "menu_entries.h"
|
||||
|
@ -79,6 +79,7 @@
|
||||
#include "../paths.h"
|
||||
#include "../dynamic.h"
|
||||
#include "../list_special.h"
|
||||
#include "../audio/audio_driver.h"
|
||||
#include "../bluetooth/bluetooth_driver.h"
|
||||
#include "../wifi/wifi_driver.h"
|
||||
#include "../midi_driver.h"
|
||||
|
2089
retroarch.c
2089
retroarch.c
File diff suppressed because it is too large
Load Diff
228
retroarch.h
228
retroarch.h
@ -34,11 +34,6 @@
|
||||
#include <lists/string_list.h>
|
||||
#include <queues/task_queue.h>
|
||||
#include <queues/message_queue.h>
|
||||
#ifdef HAVE_AUDIOMIXER
|
||||
#include <audio/audio_mixer.h>
|
||||
#endif
|
||||
|
||||
#include "audio/audio_defines.h"
|
||||
#include "gfx/video_driver.h"
|
||||
|
||||
#include "core.h"
|
||||
@ -151,122 +146,6 @@ void rarch_favorites_deinit(void);
|
||||
|
||||
/* Audio */
|
||||
|
||||
#ifdef HAVE_AUDIOMIXER
|
||||
typedef struct audio_mixer_stream
|
||||
{
|
||||
audio_mixer_sound_t *handle;
|
||||
audio_mixer_voice_t *voice;
|
||||
audio_mixer_stop_cb_t stop_cb;
|
||||
void *buf;
|
||||
char *name;
|
||||
size_t bufsize;
|
||||
float volume;
|
||||
enum audio_mixer_stream_type stream_type;
|
||||
enum audio_mixer_type type;
|
||||
enum audio_mixer_state state;
|
||||
} audio_mixer_stream_t;
|
||||
|
||||
typedef struct audio_mixer_stream_params
|
||||
{
|
||||
void *buf;
|
||||
char *basename;
|
||||
audio_mixer_stop_cb_t cb;
|
||||
size_t bufsize;
|
||||
unsigned slot_selection_idx;
|
||||
float volume;
|
||||
enum audio_mixer_slot_selection_type slot_selection_type;
|
||||
enum audio_mixer_stream_type stream_type;
|
||||
enum audio_mixer_type type;
|
||||
enum audio_mixer_state state;
|
||||
} audio_mixer_stream_params_t;
|
||||
#endif
|
||||
|
||||
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;
|
||||
|
||||
bool audio_driver_enable_callback(void);
|
||||
|
||||
bool audio_driver_disable_callback(void);
|
||||
|
||||
/**
|
||||
* config_get_audio_driver_options:
|
||||
*
|
||||
@ -276,95 +155,6 @@ bool audio_driver_disable_callback(void);
|
||||
**/
|
||||
const char* config_get_audio_driver_options(void);
|
||||
|
||||
bool audio_driver_mixer_extension_supported(const char *ext);
|
||||
|
||||
void audio_driver_dsp_filter_free(void);
|
||||
|
||||
bool 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_callback(void);
|
||||
|
||||
bool audio_driver_has_callback(void);
|
||||
|
||||
void audio_driver_frame_is_reverse(void);
|
||||
|
||||
void audio_set_float(enum audio_action action, float val);
|
||||
|
||||
float *audio_get_float_ptr(enum audio_action action);
|
||||
|
||||
bool *audio_get_bool_ptr(enum audio_action action);
|
||||
|
||||
#ifdef HAVE_AUDIOMIXER
|
||||
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);
|
||||
|
||||
void audio_driver_load_system_sounds(void);
|
||||
|
||||
#endif
|
||||
|
||||
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;
|
||||
#ifdef HAVE_THREADS
|
||||
extern audio_driver_t audio_ctr_dsp_thread;
|
||||
#endif
|
||||
extern audio_driver_t audio_switch;
|
||||
extern audio_driver_t audio_switch_thread;
|
||||
extern audio_driver_t audio_switch_libnx_audren;
|
||||
extern audio_driver_t audio_switch_libnx_audren_thread;
|
||||
extern audio_driver_t audio_rwebaudio;
|
||||
|
||||
/* Recording */
|
||||
|
||||
typedef struct record_driver
|
||||
@ -499,6 +289,24 @@ bool retroarch_get_current_savestate_path(char *path, size_t len);
|
||||
|
||||
runloop_state_t *runloop_state_get_ptr(void);
|
||||
|
||||
struct recording
|
||||
{
|
||||
const record_driver_t *driver;
|
||||
void *data;
|
||||
|
||||
size_t gpu_width;
|
||||
size_t gpu_height;
|
||||
|
||||
unsigned width;
|
||||
unsigned height;
|
||||
|
||||
bool enable;
|
||||
};
|
||||
|
||||
typedef struct recording recording_state_t;
|
||||
|
||||
recording_state_t *recording_state_get_ptr(void);
|
||||
|
||||
RETRO_END_DECLS
|
||||
|
||||
#endif
|
||||
|
195
retroarch_data.h
195
retroarch_data.h
@ -61,20 +61,6 @@
|
||||
|
||||
#define TIME_TO_FPS(last_time, new_time, frames) ((1000000.0f * (frames)) / ((new_time) - (last_time)))
|
||||
|
||||
#define AUDIO_BUFFER_FREE_SAMPLES_COUNT (8 * 1024)
|
||||
|
||||
#define MENU_SOUND_FORMATS "ogg|mod|xm|s3m|mp3|flac|wav"
|
||||
|
||||
/**
|
||||
* db_to_gain:
|
||||
* @db : Decibels.
|
||||
*
|
||||
* Converts decibels to voltage gain.
|
||||
*
|
||||
* Returns: voltage gain value.
|
||||
**/
|
||||
#define DB_TO_GAIN(db) (powf(10.0f, (db) / 20.0f))
|
||||
|
||||
#define DEFAULT_NETWORK_GAMEPAD_PORT 55400
|
||||
#define UDP_FRAME_PACKETS 16
|
||||
|
||||
@ -320,114 +306,6 @@ input_st->bsv_movie_state.eof_exit)
|
||||
|
||||
/* DRIVERS */
|
||||
|
||||
audio_driver_t audio_null = {
|
||||
NULL, /* init */
|
||||
NULL, /* write */
|
||||
NULL, /* stop */
|
||||
NULL, /* start */
|
||||
NULL, /* alive */
|
||||
NULL, /* set_nonblock_state */
|
||||
NULL, /* free */
|
||||
NULL, /* use_float */
|
||||
"null",
|
||||
NULL,
|
||||
NULL,
|
||||
NULL, /* write_avail */
|
||||
NULL
|
||||
};
|
||||
|
||||
static const audio_driver_t *audio_drivers[] = {
|
||||
#ifdef HAVE_ALSA
|
||||
&audio_alsa,
|
||||
#if !defined(__QNX__) && defined(HAVE_THREADS)
|
||||
&audio_alsathread,
|
||||
#endif
|
||||
#endif
|
||||
#ifdef HAVE_TINYALSA
|
||||
&audio_tinyalsa,
|
||||
#endif
|
||||
#if defined(HAVE_AUDIOIO)
|
||||
&audio_audioio,
|
||||
#endif
|
||||
#if defined(HAVE_OSS) || defined(HAVE_OSS_BSD)
|
||||
&audio_oss,
|
||||
#endif
|
||||
#ifdef HAVE_RSOUND
|
||||
&audio_rsound,
|
||||
#endif
|
||||
#ifdef HAVE_COREAUDIO
|
||||
&audio_coreaudio,
|
||||
#endif
|
||||
#ifdef HAVE_COREAUDIO3
|
||||
&audio_coreaudio3,
|
||||
#endif
|
||||
#ifdef HAVE_AL
|
||||
&audio_openal,
|
||||
#endif
|
||||
#ifdef HAVE_SL
|
||||
&audio_opensl,
|
||||
#endif
|
||||
#ifdef HAVE_ROAR
|
||||
&audio_roar,
|
||||
#endif
|
||||
#ifdef HAVE_JACK
|
||||
&audio_jack,
|
||||
#endif
|
||||
#if defined(HAVE_SDL) || defined(HAVE_SDL2)
|
||||
&audio_sdl,
|
||||
#endif
|
||||
#ifdef HAVE_XAUDIO
|
||||
&audio_xa,
|
||||
#endif
|
||||
#ifdef HAVE_DSOUND
|
||||
&audio_dsound,
|
||||
#endif
|
||||
#ifdef HAVE_WASAPI
|
||||
&audio_wasapi,
|
||||
#endif
|
||||
#ifdef HAVE_PULSE
|
||||
&audio_pulse,
|
||||
#endif
|
||||
#if defined(__PSL1GHT__) || defined(__PS3__)
|
||||
&audio_ps3,
|
||||
#endif
|
||||
#ifdef XENON
|
||||
&audio_xenon360,
|
||||
#endif
|
||||
#ifdef GEKKO
|
||||
&audio_gx,
|
||||
#endif
|
||||
#ifdef WIIU
|
||||
&audio_ax,
|
||||
#endif
|
||||
#ifdef EMSCRIPTEN
|
||||
&audio_rwebaudio,
|
||||
#endif
|
||||
#if defined(PSP) || defined(VITA) || defined(ORBIS)
|
||||
&audio_psp,
|
||||
#endif
|
||||
#if defined(PS2)
|
||||
&audio_ps2,
|
||||
#endif
|
||||
#ifdef _3DS
|
||||
&audio_ctr_csnd,
|
||||
&audio_ctr_dsp,
|
||||
#ifdef HAVE_THREADS
|
||||
&audio_ctr_dsp_thread,
|
||||
#endif
|
||||
#endif
|
||||
#ifdef SWITCH
|
||||
&audio_switch,
|
||||
&audio_switch_thread,
|
||||
#ifdef HAVE_LIBNX
|
||||
&audio_switch_libnx_audren,
|
||||
&audio_switch_libnx_audren_thread,
|
||||
#endif
|
||||
#endif
|
||||
&audio_null,
|
||||
NULL,
|
||||
};
|
||||
|
||||
static const video_display_server_t dispserv_null = {
|
||||
NULL, /* init */
|
||||
NULL, /* destroy */
|
||||
@ -762,8 +640,6 @@ typedef struct discord_state discord_state_t;
|
||||
|
||||
struct rarch_state
|
||||
{
|
||||
double audio_source_ratio_original;
|
||||
double audio_source_ratio_current;
|
||||
struct retro_system_av_info video_driver_av_info; /* double alignment */
|
||||
#ifdef HAVE_CRTSWITCHRES
|
||||
videocrt_switch_t crt_switch_st; /* double alignment */
|
||||
@ -788,8 +664,6 @@ struct rarch_state
|
||||
#endif
|
||||
#endif
|
||||
|
||||
uint64_t audio_driver_free_samples_count;
|
||||
|
||||
#ifdef HAVE_RUNAHEAD
|
||||
uint64_t runahead_last_frame_count;
|
||||
#endif
|
||||
@ -799,11 +673,9 @@ struct rarch_state
|
||||
struct retro_camera_callback camera_cb; /* uint64_t alignment */
|
||||
|
||||
struct string_list *subsystem_fullpaths;
|
||||
struct string_list *audio_driver_devices_list;
|
||||
|
||||
uint8_t *video_driver_record_gpu_buffer;
|
||||
bool *load_no_content_hook;
|
||||
float *audio_driver_output_samples_buf;
|
||||
#if defined(HAVE_RUNAHEAD)
|
||||
#if defined(HAVE_DYNAMIC) || defined(HAVE_DYLIB)
|
||||
char *secondary_library_path;
|
||||
@ -811,9 +683,6 @@ struct rarch_state
|
||||
retro_ctx_load_content_info_t *load_content_info;
|
||||
#endif
|
||||
|
||||
const record_driver_t *recording_driver;
|
||||
void *recording_data;
|
||||
|
||||
#ifdef HAVE_THREADS
|
||||
slock_t *display_lock;
|
||||
slock_t *context_lock;
|
||||
@ -861,20 +730,6 @@ struct rarch_state
|
||||
|
||||
void *video_context_data;
|
||||
|
||||
#ifdef HAVE_REWIND
|
||||
int16_t *audio_driver_rewind_buf;
|
||||
#endif
|
||||
int16_t *audio_driver_output_samples_conv_buf;
|
||||
|
||||
#ifdef HAVE_DSP_FILTER
|
||||
retro_dsp_filter_t *audio_driver_dsp;
|
||||
#endif
|
||||
const retro_resampler_t *audio_driver_resampler;
|
||||
|
||||
void *audio_driver_resampler_data;
|
||||
const audio_driver_t *current_audio;
|
||||
void *audio_driver_context_audio_data;
|
||||
|
||||
#ifdef HAVE_HID
|
||||
const void *hid_data;
|
||||
#endif
|
||||
@ -907,7 +762,6 @@ struct rarch_state
|
||||
content_state_t content_st; /* ptr alignment */
|
||||
struct retro_hw_render_callback hw_render; /* ptr alignment */
|
||||
retro_input_state_t input_state_callback_original; /* ptr alignment */
|
||||
struct retro_audio_callback audio_callback; /* ptr alignment */
|
||||
video_driver_frame_t frame_bak; /* ptr alignment */
|
||||
struct rarch_dir_shader_list dir_shader_list; /* ptr alignment */
|
||||
#ifdef HAVE_RUNAHEAD
|
||||
@ -923,11 +777,6 @@ struct rarch_state
|
||||
struct retro_callbacks secondary_callbacks; /* ptr alignment */
|
||||
#endif
|
||||
#endif
|
||||
#ifdef HAVE_AUDIOMIXER
|
||||
struct audio_mixer_stream
|
||||
audio_mixer_streams[AUDIO_MIXER_MAX_SYSTEM_STREAMS];
|
||||
/* ptr alignment */
|
||||
#endif
|
||||
#ifdef HAVE_NETWORKING
|
||||
struct netplay_room netplay_host_room; /* ptr alignment */
|
||||
#endif
|
||||
@ -948,22 +797,8 @@ struct rarch_state
|
||||
uintptr_t video_driver_display;
|
||||
uintptr_t video_driver_window;
|
||||
|
||||
size_t recording_gpu_width;
|
||||
size_t recording_gpu_height;
|
||||
|
||||
size_t frame_cache_pitch;
|
||||
|
||||
size_t audio_driver_chunk_size;
|
||||
size_t audio_driver_chunk_nonblock_size;
|
||||
size_t audio_driver_chunk_block_size;
|
||||
|
||||
#ifdef HAVE_REWIND
|
||||
size_t audio_driver_rewind_ptr;
|
||||
size_t audio_driver_rewind_size;
|
||||
#endif
|
||||
size_t audio_driver_buffer_size;
|
||||
size_t audio_driver_data_ptr;
|
||||
|
||||
#ifdef HAVE_RUNAHEAD
|
||||
size_t runahead_save_state_size;
|
||||
#endif
|
||||
@ -998,9 +833,6 @@ struct rarch_state
|
||||
#endif
|
||||
unsigned fastforward_after_frames;
|
||||
|
||||
unsigned recording_width;
|
||||
unsigned recording_height;
|
||||
|
||||
#ifdef HAVE_VIDEO_FILTER
|
||||
unsigned video_driver_state_scale;
|
||||
unsigned video_driver_state_out_bpp;
|
||||
@ -1013,24 +845,13 @@ struct rarch_state
|
||||
unsigned server_port_deferred;
|
||||
#endif
|
||||
|
||||
unsigned audio_driver_free_samples_buf[
|
||||
AUDIO_BUFFER_FREE_SAMPLES_COUNT];
|
||||
unsigned perf_ptr_rarch;
|
||||
unsigned perf_ptr_libretro;
|
||||
|
||||
float *audio_driver_input_data;
|
||||
float video_driver_core_hz;
|
||||
float video_driver_aspect_ratio;
|
||||
float video_refresh_rate_original;
|
||||
|
||||
#ifdef HAVE_AUDIOMIXER
|
||||
float audio_driver_mixer_volume_gain;
|
||||
#endif
|
||||
|
||||
float audio_driver_rate_control_delta;
|
||||
float audio_driver_input;
|
||||
float audio_driver_volume_gain;
|
||||
|
||||
enum rarch_core_type current_core_type;
|
||||
enum rarch_core_type explicit_current_core_type;
|
||||
enum rotation initial_screen_orientation;
|
||||
@ -1044,7 +865,6 @@ struct rarch_state
|
||||
#endif
|
||||
enum rarch_display_type video_driver_display_type;
|
||||
enum poll_type_override_t core_poll_type_override;
|
||||
enum resampler_quality audio_driver_resampler_quality;
|
||||
|
||||
/**
|
||||
* dynamic.c:dynamic_request_hw_context will try to set flag data when the context
|
||||
@ -1090,7 +910,6 @@ struct rarch_state
|
||||
char current_savefile_dir[PATH_MAX_LENGTH];
|
||||
char current_savestate_dir[PATH_MAX_LENGTH];
|
||||
char dir_savestate[PATH_MAX_LENGTH];
|
||||
char audio_driver_resampler_ident[64];
|
||||
|
||||
#ifdef HAVE_GFX_WIDGETS
|
||||
bool widgets_active;
|
||||
@ -1191,7 +1010,6 @@ struct rarch_state
|
||||
bool bluetooth_driver_active;
|
||||
bool wifi_driver_active;
|
||||
bool video_driver_active;
|
||||
bool audio_driver_active;
|
||||
bool camera_driver_active;
|
||||
#ifdef HAVE_VIDEO_FILTER
|
||||
bool video_driver_state_out_rgb32;
|
||||
@ -1201,16 +1019,9 @@ struct rarch_state
|
||||
|
||||
bool video_started_fullscreen;
|
||||
|
||||
bool audio_driver_control;
|
||||
bool audio_driver_mute_enable;
|
||||
bool audio_driver_use_float;
|
||||
|
||||
bool audio_suspended;
|
||||
|
||||
#ifdef HAVE_RUNAHEAD
|
||||
bool runahead_save_state_size_known;
|
||||
bool request_fast_savestate;
|
||||
bool hard_disable_audio;
|
||||
|
||||
bool input_is_dirty;
|
||||
#endif
|
||||
@ -1223,7 +1034,6 @@ struct rarch_state
|
||||
bool has_set_netplay_check_frames;
|
||||
#endif
|
||||
|
||||
bool recording_enable;
|
||||
bool streaming_enable;
|
||||
bool main_ui_companion_is_on_foreground;
|
||||
|
||||
@ -1236,9 +1046,4 @@ struct rarch_state
|
||||
bool runahead_secondary_core_available;
|
||||
bool runahead_force_input_dirty;
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_AUDIOMIXER
|
||||
bool audio_driver_mixer_mute_enable;
|
||||
bool audio_mixer_active;
|
||||
#endif
|
||||
};
|
||||
|
@ -73,23 +73,6 @@ static void ui_companion_driver_init_first(
|
||||
settings_t *settings,
|
||||
struct rarch_state *p_rarch);
|
||||
|
||||
static bool audio_driver_stop(struct rarch_state *p_rarch);
|
||||
static bool audio_driver_start(struct rarch_state *p_rarch,
|
||||
bool is_shutdown);
|
||||
|
||||
static bool recording_init(settings_t *settings,
|
||||
struct rarch_state *p_rarch);
|
||||
static bool recording_deinit(struct rarch_state *p_rarch);
|
||||
|
||||
#ifdef HAVE_AUDIOMIXER
|
||||
static void audio_mixer_play_stop_sequential_cb(
|
||||
audio_mixer_sound_t *sound, unsigned reason);
|
||||
static void audio_mixer_play_stop_cb(
|
||||
audio_mixer_sound_t *sound, unsigned reason);
|
||||
static void audio_mixer_menu_stop_cb(
|
||||
audio_mixer_sound_t *sound, unsigned reason);
|
||||
#endif
|
||||
|
||||
static void video_driver_gpu_record_deinit(struct rarch_state *p_rarch);
|
||||
static retro_proc_address_t video_driver_get_proc_address(const char *sym);
|
||||
static uintptr_t video_driver_get_current_framebuffer(void);
|
||||
|
@ -35,7 +35,7 @@
|
||||
|
||||
#include "core_option_manager.h"
|
||||
|
||||
enum runloop_state
|
||||
enum runloop_state_enum
|
||||
{
|
||||
RUNLOOP_STATE_ITERATE = 0,
|
||||
RUNLOOP_STATE_POLLED_AND_SLEEP,
|
||||
|
@ -33,6 +33,7 @@
|
||||
#include "retroarch.h"
|
||||
#include "verbosity.h"
|
||||
#include "content.h"
|
||||
#include "audio/audio_driver.h"
|
||||
|
||||
#ifdef HAVE_NETWORKING
|
||||
#include "network/netplay/netplay.h"
|
||||
|
@ -29,6 +29,7 @@
|
||||
#include <queues/task_queue.h>
|
||||
|
||||
#include "../file_path_special.h"
|
||||
#include "../audio/audio_driver.h"
|
||||
#include "../retroarch.h"
|
||||
#include "../verbosity.h"
|
||||
|
||||
|
@ -90,6 +90,7 @@
|
||||
#include "../playlist.h"
|
||||
#include "../paths.h"
|
||||
#include "../retroarch.h"
|
||||
#include "../runloop.h"
|
||||
#include "../verbosity.h"
|
||||
|
||||
#include "../msg_hash.h"
|
||||
|
Loading…
x
Reference in New Issue
Block a user