(Audio drivers) Get rid of global state dependencies

This commit is contained in:
twinaphex 2015-05-20 23:01:03 +02:00
parent 6e327a3b8d
commit dcf4037582
3 changed files with 9 additions and 10 deletions

View File

@ -185,6 +185,8 @@ static bool ctr_audio_alive(void *data)
static bool ctr_audio_start(void *data)
{
ctr_audio_t* ctr = (ctr_audio_t*)data;
/* TODO/FIXME - we should not depend upon global state
* in audio/video/input drivers. */
global_t *global = global_get_ptr();
/* prevents restarting audio when the menu

View File

@ -81,7 +81,6 @@ static void *ps3_audio_init(const char *device,
{
CellAudioPortParam params;
ps3_audio_t *data = NULL;
global_t *global = global_get_ptr();
(void)latency;
(void)device;
@ -95,10 +94,12 @@ static void *ps3_audio_init(const char *device,
params.numChannels = AUDIO_CHANNELS;
params.numBlocks = AUDIO_BLOCKS;
#if 0
#ifdef HAVE_HEADSET
if(global->console.sound.mode == SOUND_MODE_HEADSET)
params.param_attrib = CELL_AUDIO_PORTATTR_OUT_SECONDARY;
else
#endif
#endif
params.param_attrib = 0;

View File

@ -77,6 +77,7 @@ struct xaudio2 : public IXAudio2VoiceCallback
unsigned write_buffer;
};
#if 0
static void xaudio2_enumerate_devices(xaudio2_t *xa)
{
uint32_t dev_count = 0;
@ -97,6 +98,7 @@ static void xaudio2_enumerate_devices(xaudio2_t *xa)
}
#endif
}
#endif
static void xaudio2_set_wavefmt(WAVEFORMATEX *wfx,
unsigned channels, unsigned samplerate)
@ -226,17 +228,14 @@ static size_t xaudio2_write(xaudio2_t *handle, const void *buf, size_t bytes_)
static void *xa_init(const char *device, unsigned rate, unsigned latency)
{
size_t bufsize;
xa_t *xa = NULL;
unsigned device_index = 0;
global_t *global = global_get_ptr();
xa_t *xa = (xa_t*)calloc(1, sizeof(*xa));
if (!xa)
return NULL;
if (latency < 8)
latency = 8; /* Do not allow shenanigans. */
xa = (xa_t*)calloc(1, sizeof(*xa));
if (!xa)
return NULL;
bufsize = latency * rate / 1000;
RARCH_LOG("XAudio2: Requesting %u ms latency, using %d ms latency.\n",
@ -255,9 +254,6 @@ static void *xa_init(const char *device, unsigned rate, unsigned latency)
return NULL;
}
if (global->verbosity)
xaudio2_enumerate_devices(xa->xa);
return xa;
}