(PS3) don't use Griffin override for audio_flush anymore, but

do keep optimizations when we aren't using DSP audio plugins
This commit is contained in:
Twinaphex 2012-06-24 13:11:10 +02:00
parent 82b18e7cad
commit a62893610e
2 changed files with 9 additions and 68 deletions

View File

@ -1,58 +0,0 @@
/* 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_FUNC_HOOKS_H
#define _RARCH_FUNC_HOOKS_H
/*============================================================
PLAYSTATION3
============================================================ */
#ifdef __CELLOS_LV2__
#define HAVE_GRIFFIN_OVERRIDE_AUDIO_FLUSH_FUNC 1
static bool audio_flush(const int16_t *data, size_t samples)
{
const float *output_data = NULL;
unsigned output_frames = 0;
audio_convert_s16_to_float(g_extern.audio_data.data, data, samples);
struct resampler_data src_data = {0};
src_data.data_in = g_extern.audio_data.data;
src_data.data_out = g_extern.audio_data.outsamples;
src_data.input_frames = (samples / 2);
src_data.ratio = g_extern.audio_data.src_ratio;
if (g_extern.is_slowmotion)
src_data.ratio *= g_settings.slowmotion_ratio;
resampler_process(g_extern.audio_data.source, &src_data);
output_data = g_extern.audio_data.outsamples;
output_frames = src_data.output_frames;
if (audio_write_func(output_data, output_frames * sizeof(float) * 2) < 0)
return false;
return true;
}
#endif
#endif

View File

@ -250,10 +250,6 @@ static void video_frame(const void *data, unsigned width, unsigned height, size_
g_extern.frame_cache.pitch = pitch;
}
#ifdef HAVE_GRIFFIN
#include "console/griffin/rarch_func_hooks.h"
#endif
void rarch_render_cached_frame(void)
{
#ifdef HAVE_FFMPEG
@ -275,7 +271,6 @@ void rarch_render_cached_frame(void)
#endif
}
#ifndef HAVE_GRIFFIN_OVERRIDE_AUDIO_FLUSH_FUNC
static bool audio_flush(const int16_t *data, size_t samples)
{
#ifdef HAVE_FFMPEG
@ -298,24 +293,29 @@ static bool audio_flush(const int16_t *data, size_t samples)
audio_convert_s16_to_float(g_extern.audio_data.data, data, samples);
#ifdef HAVE_DYLIB
rarch_dsp_output_t dsp_output = {0};
dsp_output.should_resample = RARCH_TRUE;
#ifdef HAVE_DYLIB
rarch_dsp_input_t dsp_input = {0};
dsp_input.samples = g_extern.audio_data.data;
dsp_input.frames = samples / 2;
if (g_extern.audio_data.dsp_plugin)
g_extern.audio_data.dsp_plugin->process(g_extern.audio_data.dsp_handle, &dsp_output, &dsp_input);
#endif
if (dsp_output.should_resample)
{
#endif
struct resampler_data src_data = {0};
#ifdef HAVE_DYLIB
src_data.data_in = dsp_output.samples ? dsp_output.samples : g_extern.audio_data.data;
src_data.data_out = g_extern.audio_data.outsamples;
src_data.input_frames = dsp_output.samples ? dsp_output.frames : (samples / 2);
#else
src_data.data_in = g_extern.audio_data.data;
src_data.input_frames = (samples / 2);
#endif
src_data.data_out = g_extern.audio_data.outsamples;
if (g_extern.audio_data.rate_control)
readjust_audio_input_rate();
@ -328,8 +328,8 @@ static bool audio_flush(const int16_t *data, size_t samples)
output_data = g_extern.audio_data.outsamples;
output_frames = src_data.output_frames;
}
#ifdef HAVE_DYLIB
}
else
{
output_data = dsp_output.samples;
@ -370,7 +370,6 @@ static bool audio_flush(const int16_t *data, size_t samples)
return true;
}
#endif
static void audio_sample_rewind(int16_t left, int16_t right)
{