mirror of
https://github.com/libretro/RetroArch.git
synced 2025-02-18 00:18:22 +00:00
(DSP Filters) Cleanups
This commit is contained in:
parent
a716070cdc
commit
47f6cc40ba
@ -52,13 +52,10 @@ struct echo_filter_data
|
||||
};
|
||||
|
||||
#ifdef RARCH_INTERNAL
|
||||
#define rarch_dsp_init echo_sse_dsp_init
|
||||
#define rarch_dsp_process echo_sse_dsp_process
|
||||
#define rarch_dsp_free echo_sse_dsp_free
|
||||
#define rarch_dsp_config echo_sse_dsp_config
|
||||
#define rarch_dsp_plugin_init echo_dsp_plugin_init
|
||||
#endif
|
||||
|
||||
void echo_init(void *data)
|
||||
static void echo_init(void *data)
|
||||
{
|
||||
unsigned i, j;
|
||||
struct echo_filter_data *echo = (struct echo_filter_data*)data;
|
||||
@ -85,7 +82,7 @@ void echo_init(void *data)
|
||||
echo->buffer[i] = 0.0f;
|
||||
}
|
||||
|
||||
unsigned echo_sse2_process(void *data, const float *input, unsigned frames)
|
||||
static unsigned echo_sse2_process(void *data, const float *input, unsigned frames)
|
||||
{
|
||||
unsigned frames_out, i;
|
||||
float *buffer_out;
|
||||
@ -156,7 +153,7 @@ unsigned echo_sse2_process(void *data, const float *input, unsigned frames)
|
||||
return frames_out;
|
||||
}
|
||||
|
||||
static void rarch_dsp_process(void *data, rarch_dsp_output_t *output,
|
||||
static void echo_sse_dsp_process(void *data, rarch_dsp_output_t *output,
|
||||
const rarch_dsp_input_t *input)
|
||||
{
|
||||
struct echo_filter_data *echo = (struct echo_filter_data*)data;
|
||||
@ -164,7 +161,7 @@ static void rarch_dsp_process(void *data, rarch_dsp_output_t *output,
|
||||
output->frames = echo_sse2_process(echo, input->samples, input->frames);
|
||||
}
|
||||
|
||||
static void rarch_dsp_free(void *data)
|
||||
static void echo_sse_dsp_free(void *data)
|
||||
{
|
||||
struct echo_filter_data *echo = (struct echo_filter_data*)data;
|
||||
|
||||
@ -172,7 +169,7 @@ static void rarch_dsp_free(void *data)
|
||||
free(echo);
|
||||
}
|
||||
|
||||
static void *rarch_dsp_init(const rarch_dsp_info_t *info)
|
||||
static void *echo_sse_dsp_init(const rarch_dsp_info_t *info)
|
||||
{
|
||||
struct echo_filter_data *echo = (struct echo_filter_data*)calloc(1, sizeof(*echo));;
|
||||
|
||||
@ -191,30 +188,26 @@ static void *rarch_dsp_init(const rarch_dsp_info_t *info)
|
||||
return echo;
|
||||
}
|
||||
|
||||
static void rarch_dsp_config(void *data)
|
||||
static void echo_sse_dsp_config(void *data)
|
||||
{
|
||||
(void)data;
|
||||
}
|
||||
|
||||
static const rarch_dsp_plugin_t dsp_plug = {
|
||||
rarch_dsp_init,
|
||||
rarch_dsp_process,
|
||||
rarch_dsp_free,
|
||||
echo_sse_dsp_init,
|
||||
echo_sse_dsp_process,
|
||||
echo_sse_dsp_free,
|
||||
RARCH_DSP_API_VERSION,
|
||||
rarch_dsp_config,
|
||||
echo_sse_dsp_config,
|
||||
"Echo (SSE2)",
|
||||
NULL
|
||||
};
|
||||
|
||||
RARCH_API_EXPORT const rarch_dsp_plugin_t* RARCH_API_CALLTYPE
|
||||
rarch_dsp_plugin_init(void)
|
||||
const rarch_dsp_plugin_t *rarch_dsp_plugin_init(void)
|
||||
{
|
||||
return &dsp_plug;
|
||||
}
|
||||
|
||||
#ifdef RARCH_INTERNAL
|
||||
#undef rarch_dsp_init
|
||||
#undef rarch_dsp_process
|
||||
#undef rarch_dsp_free
|
||||
#undef rarch_dsp_config
|
||||
#undef rarch_dsp_plugin_init
|
||||
#endif
|
||||
|
@ -1,211 +0,0 @@
|
||||
/* RetroArch - A frontend for libretro.
|
||||
* Copyright (C) 2010-2014 - Hans-Kristian Arntzen
|
||||
* Copyright (C) 2011-2014 - 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/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <math.h>
|
||||
#include <unistd.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdint.h>
|
||||
#include "rarch_dsp.h"
|
||||
#include <algorithm>
|
||||
#include <iterator>
|
||||
#include <type_traits>
|
||||
|
||||
#include <emmintrin.h>
|
||||
|
||||
// 4 source echo.
|
||||
|
||||
#define ALIGNED __attribute__((aligned(16))) // Should use C++11 alignas(), but doesn't seem to work :(
|
||||
|
||||
#define ECHO_MS 150
|
||||
#define AMP 0.0
|
||||
|
||||
#ifdef RARCH_INTERNAL
|
||||
#define rarch_dsp_init echo_sse_dsp_init
|
||||
#define rarch_dsp_process echo_sse_dsp_process
|
||||
#define rarch_dsp_free echo_sse_dsp_free
|
||||
#define rarch_dsp_config echo_sse_dsp_config
|
||||
#endif
|
||||
|
||||
struct EchoFilter
|
||||
{
|
||||
float echo_buffer[4][0x10000] ALIGNED;
|
||||
float buffer[4096] ALIGNED;
|
||||
float scratch_buf[4] ALIGNED;
|
||||
|
||||
unsigned buf_size[4];
|
||||
unsigned ptr[4];
|
||||
|
||||
unsigned scratch_ptr;
|
||||
__m128 amp[4] ALIGNED;
|
||||
__m128 feedback ALIGNED;
|
||||
float input_rate;
|
||||
|
||||
EchoFilter()
|
||||
{
|
||||
unsigned i, j;
|
||||
|
||||
for (i = 0; i < 4; i++)
|
||||
{
|
||||
ptr[i] = 0.0f;
|
||||
amp[i] = _mm_set1_ps(AMP);
|
||||
}
|
||||
|
||||
scratch_ptr = 0;
|
||||
feedback = _mm_set1_ps(0.0f);
|
||||
|
||||
input_rate = 32000.0;
|
||||
|
||||
for (i = 0; i < 4; i++)
|
||||
{
|
||||
scratch_buf[i] = 0.0f;
|
||||
|
||||
for (j = 0; j < 0x10000; j++)
|
||||
echo_buffer[i][j] = 0.0f;
|
||||
}
|
||||
for (i = 0; i < 4096; i++)
|
||||
buffer[i] = 0.0f;
|
||||
}
|
||||
|
||||
~EchoFilter()
|
||||
{
|
||||
}
|
||||
|
||||
unsigned Process(const float *input, unsigned frames)
|
||||
{
|
||||
unsigned frames_out = 0;
|
||||
float *buffer_out = buffer;
|
||||
|
||||
__m128 amp[4] = {
|
||||
this->amp[0],
|
||||
this->amp[1],
|
||||
this->amp[2],
|
||||
this->amp[3],
|
||||
};
|
||||
|
||||
__m128 feedback = this->feedback;
|
||||
|
||||
#define DO_FILTER() \
|
||||
__m128 result[4]; \
|
||||
__m128 echo_[4]; \
|
||||
for (unsigned i = 0; i < 4; i++) \
|
||||
{ \
|
||||
echo_[i] = _mm_load_ps(echo_buffer[i] + ptr[i]); \
|
||||
result[i] = _mm_mul_ps(amp[i], echo_[i]); \
|
||||
} \
|
||||
__m128 final_result = _mm_add_ps(_mm_add_ps(result[0], result[1]), _mm_add_ps(result[2], result[3])); \
|
||||
__m128 feedback_result = _mm_mul_ps(feedback, final_result); \
|
||||
final_result = _mm_add_ps(reg, final_result); \
|
||||
feedback_result = _mm_add_ps(reg, feedback_result); \
|
||||
for (unsigned i = 0; i < 4; i++) \
|
||||
_mm_store_ps(echo_buffer[i] + ptr[i], feedback_result); \
|
||||
_mm_store_ps(buffer_out, final_result); \
|
||||
for (unsigned i = 0; i < 4; i++) \
|
||||
ptr[i] = (ptr[i] + 4) % buf_size[i]
|
||||
|
||||
|
||||
// Fill up scratch buffer and flush.
|
||||
if (scratch_ptr)
|
||||
{
|
||||
for (unsigned i = scratch_ptr; i < 4; i += 2)
|
||||
{
|
||||
scratch_buf[i] = *input++;
|
||||
scratch_buf[i + 1] = *input++;
|
||||
frames--;
|
||||
}
|
||||
|
||||
scratch_ptr = 0;
|
||||
|
||||
__m128 reg = _mm_load_ps(scratch_buf);
|
||||
|
||||
DO_FILTER();
|
||||
|
||||
frames_out += 2;
|
||||
buffer_out += 4;
|
||||
}
|
||||
|
||||
// Main processing.
|
||||
unsigned i;
|
||||
for (i = 0; (i + 4) <= (frames * 2); i += 4, input += 4, buffer_out += 4, frames_out += 2)
|
||||
{
|
||||
__m128 reg = _mm_loadu_ps(input); // Might not be aligned.
|
||||
DO_FILTER();
|
||||
}
|
||||
|
||||
// Flush rest to scratch buffer.
|
||||
for (; i < (frames * 2); i++)
|
||||
scratch_buf[scratch_ptr++] = *input++;
|
||||
|
||||
return frames_out;
|
||||
}
|
||||
};
|
||||
|
||||
static void rarch_dsp_process(void *data, rarch_dsp_output_t *output,
|
||||
const rarch_dsp_input_t *input)
|
||||
{
|
||||
EchoFilter *echo = reinterpret_cast<EchoFilter*>(data);
|
||||
output->samples = echo->buffer;
|
||||
|
||||
output->frames = echo->Process(input->samples, input->frames);
|
||||
}
|
||||
|
||||
static void rarch_dsp_free(void *data)
|
||||
{
|
||||
delete reinterpret_cast<EchoFilter*>(data);
|
||||
}
|
||||
|
||||
static void * rarch_dsp_init(const rarch_dsp_info_t *info)
|
||||
{
|
||||
EchoFilter *echo = new EchoFilter;
|
||||
|
||||
echo->input_rate = info->input_rate;
|
||||
|
||||
for (unsigned i = 0; i < 4; i++)
|
||||
echo->buf_size[i] = ECHO_MS * (info->input_rate * 2) / 1000;
|
||||
|
||||
fprintf(stderr, "[Echo] loaded!\n");
|
||||
|
||||
return echo;
|
||||
}
|
||||
|
||||
static void rarch_dsp_config(void *)
|
||||
{
|
||||
}
|
||||
|
||||
static const rarch_dsp_plugin_t dsp_plug = {
|
||||
dsp_init,
|
||||
dsp_process,
|
||||
dsp_free,
|
||||
RARCH_DSP_API_VERSION,
|
||||
rarch_dsp_config,
|
||||
"Echo (SSE2)",
|
||||
NULL
|
||||
};
|
||||
|
||||
RARCH_API_EXPORT const rarch_dsp_plugin_t* RARCH_API_CALLTYPE
|
||||
rarch_dsp_plugin_init(void)
|
||||
{
|
||||
return &dsp_plug;
|
||||
}
|
||||
|
||||
#ifdef RARCH_INTERNAL
|
||||
#undef rarch_dsp_init
|
||||
#undef rarch_dsp_process
|
||||
#undef rarch_dsp_free
|
||||
#undef rarch_dsp_config
|
||||
#endif
|
@ -39,10 +39,7 @@
|
||||
#endif
|
||||
|
||||
#ifdef RARCH_INTERNAL
|
||||
#define rarch_dsp_init eq_dsp_init
|
||||
#define rarch_dsp_process eq_dsp_process
|
||||
#define rarch_dsp_free eq_dsp_free
|
||||
#define rarch_dsp_config eq_dsp_config
|
||||
#define rarch_dsp_plugin_init eq_dsp_plugin_init
|
||||
#endif
|
||||
|
||||
typedef struct dsp_eq_state dsp_eq_state_t;
|
||||
@ -62,7 +59,8 @@ static void generate_phase_lut(void)
|
||||
|
||||
static inline unsigned bitrange(unsigned len)
|
||||
{
|
||||
unsigned ret = 0;
|
||||
unsigned ret;
|
||||
ret = 0;
|
||||
while ((len >>= 1))
|
||||
ret++;
|
||||
|
||||
@ -363,7 +361,7 @@ static size_t equalizer_process(void *data, const float *in, unsigned frames)
|
||||
return written;
|
||||
}
|
||||
|
||||
static void * rarch_dsp_init(const rarch_dsp_info_t *info)
|
||||
static void * eq_dsp_init(const rarch_dsp_info_t *info)
|
||||
{
|
||||
const float bands[] = { 30, 80, 150, 250, 500, 800, 1000, 2000, 3000, 5000, 8000, 10000, 12000, 15000 };
|
||||
struct equalizer_filter_data *eq = (struct equalizer_filter_data*)calloc(1, sizeof(*eq));
|
||||
@ -377,7 +375,7 @@ static void * rarch_dsp_init(const rarch_dsp_info_t *info)
|
||||
return eq;
|
||||
}
|
||||
|
||||
static void rarch_dsp_process(void *data, rarch_dsp_output_t *output,
|
||||
static void eq_dsp_process(void *data, rarch_dsp_output_t *output,
|
||||
const rarch_dsp_input_t *input)
|
||||
{
|
||||
struct equalizer_filter_data *eq = (struct equalizer_filter_data*)data;
|
||||
@ -387,7 +385,7 @@ static void rarch_dsp_process(void *data, rarch_dsp_output_t *output,
|
||||
output->frames = out_frames;
|
||||
}
|
||||
|
||||
static void rarch_dsp_free(void *data)
|
||||
static void eq_dsp_free(void *data)
|
||||
{
|
||||
struct equalizer_filter_data *eq = (struct equalizer_filter_data*)data;
|
||||
|
||||
@ -399,29 +397,26 @@ static void rarch_dsp_free(void *data)
|
||||
}
|
||||
}
|
||||
|
||||
static void rarch_dsp_config(void *data)
|
||||
static void eq_dsp_config(void *data)
|
||||
{
|
||||
(void)data;
|
||||
}
|
||||
|
||||
const rarch_dsp_plugin_t dsp_plug = {
|
||||
rarch_dsp_init,
|
||||
rarch_dsp_process,
|
||||
rarch_dsp_free,
|
||||
eq_dsp_init,
|
||||
eq_dsp_process,
|
||||
eq_dsp_free,
|
||||
RARCH_DSP_API_VERSION,
|
||||
rarch_dsp_config,
|
||||
eq_dsp_config,
|
||||
"Equalizer",
|
||||
NULL
|
||||
};
|
||||
|
||||
RARCH_API_EXPORT const rarch_dsp_plugin_t* RARCH_API_CALLTYPE rarch_dsp_plugin_init(void)
|
||||
const rarch_dsp_plugin_t *rarch_dsp_plugin_init(void)
|
||||
{
|
||||
return &dsp_plug;
|
||||
}
|
||||
|
||||
#ifdef RARCH_INTERNAL
|
||||
#undef rarch_dsp_init
|
||||
#undef rarch_dsp_process
|
||||
#undef rarch_dsp_free
|
||||
#undef rarch_dsp_config
|
||||
#undef rarch_dsp_plugin_init
|
||||
#endif
|
||||
|
@ -34,10 +34,7 @@
|
||||
#define sqr(a) ((a) * (a))
|
||||
|
||||
#ifdef RARCH_INTERNAL
|
||||
#define rarch_dsp_init iir_dsp_init
|
||||
#define rarch_dsp_process iir_dsp_process
|
||||
#define rarch_dsp_free iir_dsp_free
|
||||
#define rarch_dsp_config iir_dsp_config
|
||||
#define rarch_dsp_plugin_init iir_dsp_plugin_init
|
||||
#endif
|
||||
|
||||
struct iir_filter
|
||||
@ -312,7 +309,7 @@ static float iir_process(void *data, float samp)
|
||||
}
|
||||
#endif
|
||||
|
||||
static void * rarch_dsp_init(const rarch_dsp_info_t *info)
|
||||
static void * iir_dsp_init(const rarch_dsp_info_t *info)
|
||||
{
|
||||
struct iir_filter_data *iir = (struct iir_filter_data*)calloc(1, sizeof(*iir));
|
||||
|
||||
@ -333,7 +330,7 @@ static void * rarch_dsp_init(const rarch_dsp_info_t *info)
|
||||
return iir;
|
||||
}
|
||||
|
||||
static void rarch_dsp_process(void *data, rarch_dsp_output_t *output,
|
||||
static void iir_dsp_process(void *data, rarch_dsp_output_t *output,
|
||||
const rarch_dsp_input_t *input)
|
||||
{
|
||||
struct iir_filter_data *iir = (struct iir_filter_data*)data;
|
||||
@ -356,7 +353,7 @@ static void rarch_dsp_process(void *data, rarch_dsp_output_t *output,
|
||||
output->frames = input->frames;
|
||||
}
|
||||
|
||||
static void rarch_dsp_free(void *data)
|
||||
static void iir_dsp_free(void *data)
|
||||
{
|
||||
struct iir_filter_data *iir = (struct iir_filter_data*)data;
|
||||
|
||||
@ -364,16 +361,16 @@ static void rarch_dsp_free(void *data)
|
||||
free(iir);
|
||||
}
|
||||
|
||||
static void rarch_dsp_config(void* data)
|
||||
static void iir_dsp_config(void* data)
|
||||
{
|
||||
}
|
||||
|
||||
const rarch_dsp_plugin_t dsp_plug = {
|
||||
rarch_dsp_init,
|
||||
rarch_dsp_process,
|
||||
rarch_dsp_free,
|
||||
iir_dsp_init,
|
||||
iir_dsp_process,
|
||||
iir_dsp_free,
|
||||
RARCH_DSP_API_VERSION,
|
||||
rarch_dsp_config,
|
||||
iir_dsp_config,
|
||||
#ifdef __SSE2__
|
||||
"IIR (SSE2)",
|
||||
#else
|
||||
@ -383,14 +380,11 @@ const rarch_dsp_plugin_t dsp_plug = {
|
||||
};
|
||||
|
||||
|
||||
RARCH_API_EXPORT const rarch_dsp_plugin_t* RARCH_API_CALLTYPE rarch_dsp_plugin_init(void)
|
||||
const rarch_dsp_plugin_t *rarch_dsp_plugin_init(void)
|
||||
{
|
||||
return &dsp_plug;
|
||||
}
|
||||
|
||||
#ifdef RARCH_INTERNAL
|
||||
#undef rarch_dsp_init
|
||||
#undef rarch_dsp_process
|
||||
#undef rarch_dsp_free
|
||||
#undef rarch_dsp_config
|
||||
#undef rarch_dsp_plugin_init
|
||||
#endif
|
||||
|
@ -30,10 +30,7 @@
|
||||
#define PHASER_LFOSKIPSAMPLES 20
|
||||
|
||||
#ifdef RARCH_INTERNAL
|
||||
#define rarch_dsp_init phaser_dsp_init
|
||||
#define rarch_dsp_process phaser_dsp_process
|
||||
#define rarch_dsp_free phaser_dsp_free
|
||||
#define rarch_dsp_config phaser_dsp_config
|
||||
#define rarch_dsp_plugin_init phaser_dsp_plugin_init
|
||||
#endif
|
||||
|
||||
struct phaser_filter
|
||||
@ -100,7 +97,7 @@ static float phaser_process(void *data, float in)
|
||||
return out;
|
||||
}
|
||||
|
||||
static void * rarch_dsp_init(const rarch_dsp_info_t *info)
|
||||
static void * phaser_dsp_init(const rarch_dsp_info_t *info)
|
||||
{
|
||||
float freq, startphase, fb;
|
||||
int depth, stages, drywet;
|
||||
@ -137,7 +134,7 @@ static void * rarch_dsp_init(const rarch_dsp_info_t *info)
|
||||
return phaser;
|
||||
}
|
||||
|
||||
static void rarch_dsp_process(void *data, rarch_dsp_output_t *output,
|
||||
static void phaser_dsp_process(void *data, rarch_dsp_output_t *output,
|
||||
const rarch_dsp_input_t *input)
|
||||
{
|
||||
int i, num_samples;
|
||||
@ -155,7 +152,7 @@ static void rarch_dsp_process(void *data, rarch_dsp_output_t *output,
|
||||
output->frames = input->frames;
|
||||
}
|
||||
|
||||
static void rarch_dsp_free(void *data)
|
||||
static void phaser_dsp_free(void *data)
|
||||
{
|
||||
struct phaser_filter_data *phaser = (struct phaser_filter_data*)data;
|
||||
|
||||
@ -170,29 +167,26 @@ static void rarch_dsp_free(void *data)
|
||||
}
|
||||
}
|
||||
|
||||
static void rarch_dsp_config(void *data)
|
||||
static void phaser_dsp_config(void *data)
|
||||
{
|
||||
(void)data;
|
||||
}
|
||||
|
||||
const rarch_dsp_plugin_t dsp_plug = {
|
||||
rarch_dsp_init,
|
||||
rarch_dsp_process,
|
||||
rarch_dsp_free,
|
||||
phaser_dsp_init,
|
||||
phaser_dsp_process,
|
||||
phaser_dsp_free,
|
||||
RARCH_DSP_API_VERSION,
|
||||
rarch_dsp_config,
|
||||
phaser_dsp_config,
|
||||
"Phaser plugin",
|
||||
NULL
|
||||
};
|
||||
|
||||
RARCH_API_EXPORT const rarch_dsp_plugin_t* RARCH_API_CALLTYPE rarch_dsp_plugin_init(void)
|
||||
const rarch_dsp_plugin_t *rarch_dsp_plugin_init(void)
|
||||
{
|
||||
return &dsp_plug;
|
||||
}
|
||||
|
||||
#ifdef RARCH_INTERNAL
|
||||
#undef rarch_dsp_init
|
||||
#undef rarch_dsp_process
|
||||
#undef rarch_dsp_free
|
||||
#undef rarch_dsp_config
|
||||
#undef rarch_dsp_plugin_init
|
||||
#endif
|
||||
|
@ -22,18 +22,6 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#ifdef _WIN32
|
||||
#ifdef RARCH_DLL_IMPORT
|
||||
#define RARCH_API_EXPORT __declspec(dllimport)
|
||||
#else
|
||||
#define RARCH_API_EXPORT __declspec(dllexport)
|
||||
#endif
|
||||
#define RARCH_API_CALLTYPE __cdecl
|
||||
#else
|
||||
#define RARCH_API_EXPORT
|
||||
#define RARCH_API_CALLTYPE
|
||||
#endif
|
||||
|
||||
#define RARCH_DSP_API_VERSION 5
|
||||
|
||||
typedef struct rarch_dsp_info
|
||||
@ -107,8 +95,7 @@ typedef struct rarch_dsp_plugin
|
||||
|
||||
// Called by RetroArch at startup to get the callback struct.
|
||||
// This is NOT dynamically allocated!
|
||||
RARCH_API_EXPORT const rarch_dsp_plugin_t* RARCH_API_CALLTYPE
|
||||
rarch_dsp_plugin_init(void);
|
||||
const rarch_dsp_plugin_t *rarch_dsp_plugin_init(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
@ -52,10 +52,7 @@
|
||||
#define ALLPASSTUNINGL4 225
|
||||
|
||||
#ifdef RARCH_INTERNAL
|
||||
#define rarch_dsp_init reverb_dsp_init
|
||||
#define rarch_dsp_process reverb_dsp_process
|
||||
#define rarch_dsp_free reverb_dsp_free
|
||||
#define rarch_dsp_config reverb_dsp_config
|
||||
#define rarch_dsp_plugin_init reverb_dsp_plugin_init
|
||||
#endif
|
||||
|
||||
struct comb
|
||||
@ -319,7 +316,7 @@ struct reverb_filter_data
|
||||
};
|
||||
|
||||
|
||||
static void * rarch_dsp_init(const rarch_dsp_info_t *info)
|
||||
static void * reverb_dsp_init(const rarch_dsp_info_t *info)
|
||||
{
|
||||
float drytime, wettime, damping, roomwidth, roomsize;
|
||||
(void)info;
|
||||
@ -348,7 +345,7 @@ static void * rarch_dsp_init(const rarch_dsp_info_t *info)
|
||||
return reverb;
|
||||
}
|
||||
|
||||
static void rarch_dsp_process(void *data, rarch_dsp_output_t *output,
|
||||
static void reverb_dsp_process(void *data, rarch_dsp_output_t *output,
|
||||
const rarch_dsp_input_t *input)
|
||||
{
|
||||
int i, num_samples;
|
||||
@ -366,7 +363,7 @@ static void rarch_dsp_process(void *data, rarch_dsp_output_t *output,
|
||||
output->frames = input->frames;
|
||||
}
|
||||
|
||||
static void rarch_dsp_free(void *data)
|
||||
static void reverb_dsp_free(void *data)
|
||||
{
|
||||
struct reverb_filter_data *rev = (struct reverb_filter_data*)data;
|
||||
|
||||
@ -374,29 +371,26 @@ static void rarch_dsp_free(void *data)
|
||||
free(rev);
|
||||
}
|
||||
|
||||
static void rarch_dsp_config(void *data)
|
||||
static void reverb_dsp_config(void *data)
|
||||
{
|
||||
(void)data;
|
||||
}
|
||||
|
||||
const rarch_dsp_plugin_t dsp_plug = {
|
||||
rarch_dsp_init,
|
||||
rarch_dsp_process,
|
||||
rarch_dsp_free,
|
||||
reverb_dsp_init,
|
||||
reverb_dsp_process,
|
||||
reverb_dsp_free,
|
||||
RARCH_DSP_API_VERSION,
|
||||
rarch_dsp_config,
|
||||
reverb_dsp_config,
|
||||
"Reverberatation",
|
||||
NULL
|
||||
};
|
||||
|
||||
RARCH_API_EXPORT const rarch_dsp_plugin_t* RARCH_API_CALLTYPE rarch_dsp_plugin_init(void)
|
||||
const rarch_dsp_plugin_t *rarch_dsp_plugin_init(void)
|
||||
{
|
||||
return &dsp_plug;
|
||||
}
|
||||
|
||||
#ifdef RARCH_INTERNAL
|
||||
#undef rarch_dsp_init
|
||||
#undef rarch_dsp_process
|
||||
#undef rarch_dsp_free
|
||||
#undef rarch_dsp_config
|
||||
#undef rarch_dsp_plugin_init
|
||||
#endif
|
||||
|
@ -21,10 +21,7 @@
|
||||
#include <math.h>
|
||||
|
||||
#ifdef RARCH_INTERNAL
|
||||
#define rarch_dsp_init volume_dsp_init
|
||||
#define rarch_dsp_process volume_dsp_process
|
||||
#define rarch_dsp_free volume_dsp_free
|
||||
#define rarch_dsp_config volume_dsp_config
|
||||
#define rarch_dsp_plugin_init volume_dsp_plugin_init
|
||||
#endif
|
||||
|
||||
struct volume_filter_data
|
||||
@ -56,7 +53,7 @@ static float db2gain(float val)
|
||||
}
|
||||
#endif
|
||||
|
||||
void volume_process(void *data, const float *in, unsigned frames)
|
||||
static void volume_process(void *data, const float *in, unsigned frames)
|
||||
{
|
||||
float vol_left, vol_right;
|
||||
unsigned i;
|
||||
@ -75,7 +72,7 @@ void volume_process(void *data, const float *in, unsigned frames)
|
||||
}
|
||||
}
|
||||
|
||||
static void * rarch_dsp_init(const rarch_dsp_info_t *info)
|
||||
static void *volume_dsp_init(const rarch_dsp_info_t *info)
|
||||
{
|
||||
struct volume_filter_data *vol = (struct volume_filter_data*)calloc(1, sizeof(*vol));
|
||||
(void)info;
|
||||
@ -90,7 +87,7 @@ static void * rarch_dsp_init(const rarch_dsp_info_t *info)
|
||||
return vol;
|
||||
}
|
||||
|
||||
static void rarch_dsp_process(void *data, rarch_dsp_output_t *output,
|
||||
static void volume_dsp_process(void *data, rarch_dsp_output_t *output,
|
||||
const rarch_dsp_input_t *input)
|
||||
{
|
||||
struct volume_filter_data *vol = (struct volume_filter_data*)data;
|
||||
@ -100,7 +97,7 @@ static void rarch_dsp_process(void *data, rarch_dsp_output_t *output,
|
||||
output->frames = input->frames;
|
||||
}
|
||||
|
||||
static void rarch_dsp_free(void *data)
|
||||
static void volume_dsp_free(void *data)
|
||||
{
|
||||
struct volume_filter_data *vol = (struct volume_filter_data*)data;
|
||||
|
||||
@ -108,28 +105,26 @@ static void rarch_dsp_free(void *data)
|
||||
free(vol);
|
||||
}
|
||||
|
||||
static void rarch_dsp_config(void *data)
|
||||
static void volume_dsp_config(void *data)
|
||||
{
|
||||
(void)data;
|
||||
}
|
||||
|
||||
const rarch_dsp_plugin_t dsp_plug = {
|
||||
rarch_dsp_init,
|
||||
rarch_dsp_process,
|
||||
rarch_dsp_free,
|
||||
volume_dsp_init,
|
||||
volume_dsp_process,
|
||||
volume_dsp_free,
|
||||
RARCH_DSP_API_VERSION,
|
||||
rarch_dsp_config,
|
||||
volume_dsp_config,
|
||||
"Volume",
|
||||
NULL
|
||||
};
|
||||
|
||||
RARCH_API_EXPORT const rarch_dsp_plugin_t* RARCH_API_CALLTYPE rarch_dsp_plugin_init(void)
|
||||
const rarch_dsp_plugin_t *rarch_dsp_plugin_init(void)
|
||||
{
|
||||
return &dsp_plug;
|
||||
}
|
||||
|
||||
#ifdef RARCH_INTERNAL
|
||||
#undef rarch_dsp_init
|
||||
#undef rarch_dsp_process
|
||||
#undef rarch_dsp_free
|
||||
#undef rarch_dsp_config
|
||||
#undef rarch_dsp_plugin_init
|
||||
#endif
|
||||
|
@ -31,10 +31,7 @@
|
||||
#endif
|
||||
|
||||
#ifdef RARCH_INTERNAL
|
||||
#define rarch_dsp_init wah_dsp_init
|
||||
#define rarch_dsp_process wah_dsp_process
|
||||
#define rarch_dsp_free wah_dsp_free
|
||||
#define rarch_dsp_config wah_dsp_config
|
||||
#define rarch_dsp_plugin_init wah_dsp_plugin_init
|
||||
#endif
|
||||
|
||||
struct wahwah_filter
|
||||
@ -107,7 +104,7 @@ static float wahwah_process(void *data, float samp)
|
||||
return samp;
|
||||
}
|
||||
|
||||
static void * rarch_dsp_init(const rarch_dsp_info_t *info)
|
||||
static void * wah_dsp_init(const rarch_dsp_info_t *info)
|
||||
{
|
||||
float freq = 1.5;
|
||||
float startphase = 0.0;
|
||||
@ -137,7 +134,7 @@ static void * rarch_dsp_init(const rarch_dsp_info_t *info)
|
||||
return wah;
|
||||
}
|
||||
|
||||
static void rarch_dsp_process(void *data, rarch_dsp_output_t *output,
|
||||
static void wah_dsp_process(void *data, rarch_dsp_output_t *output,
|
||||
const rarch_dsp_input_t *input)
|
||||
{
|
||||
int num_samples, i;
|
||||
@ -156,7 +153,7 @@ static void rarch_dsp_process(void *data, rarch_dsp_output_t *output,
|
||||
output->frames = input->frames;
|
||||
}
|
||||
|
||||
static void rarch_dsp_free(void *data)
|
||||
static void wah_dsp_free(void *data)
|
||||
{
|
||||
struct wahwah_filter_data *wah = (struct wahwah_filter_data*)data;
|
||||
|
||||
@ -164,28 +161,25 @@ static void rarch_dsp_free(void *data)
|
||||
free(wah);
|
||||
}
|
||||
|
||||
static void rarch_dsp_config(void *data)
|
||||
static void wah_dsp_config(void *data)
|
||||
{
|
||||
}
|
||||
|
||||
const rarch_dsp_plugin_t dsp_plug = {
|
||||
rarch_dsp_init,
|
||||
rarch_dsp_process,
|
||||
rarch_dsp_free,
|
||||
wah_dsp_init,
|
||||
wah_dsp_process,
|
||||
wah_dsp_free,
|
||||
RARCH_DSP_API_VERSION,
|
||||
rarch_dsp_config,
|
||||
wah_dsp_config,
|
||||
"Wah",
|
||||
NULL
|
||||
};
|
||||
|
||||
RARCH_API_EXPORT const rarch_dsp_plugin_t* RARCH_API_CALLTYPE rarch_dsp_plugin_init(void)
|
||||
const rarch_dsp_plugin_t *rarch_dsp_plugin_init(void)
|
||||
{
|
||||
return &dsp_plug;
|
||||
}
|
||||
|
||||
#ifdef RARCH_INTERNAL
|
||||
#undef rarch_dsp_init
|
||||
#undef rarch_dsp_process
|
||||
#undef rarch_dsp_free
|
||||
#undef rarch_dsp_config
|
||||
#undef rarch_dsp_plugin_init
|
||||
#endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user