From 1b9bbbd381fcdf1c0b6e42b30a681aea10215c42 Mon Sep 17 00:00:00 2001 From: Themaister Date: Tue, 20 May 2014 14:00:34 +0200 Subject: [PATCH] Some Panning fixes. --- audio/dsp_filter.c | 5 +++-- audio/dsp_filter.h | 4 ++-- audio/filters/Panning.dsp | 5 ++++- audio/filters/panning.c | 20 ++++++++++++++++++++ frontend/menu/backend/menu_common_backend.c | 2 +- 5 files changed, 30 insertions(+), 6 deletions(-) diff --git a/audio/dsp_filter.c b/audio/dsp_filter.c index 8d7b2c5fd6..98fad2b859 100644 --- a/audio/dsp_filter.c +++ b/audio/dsp_filter.c @@ -128,6 +128,7 @@ static int get_int(void *userdata, const char *key_str, int *value, int default_ { \ *values = (T*)calloc(num_default_values, sizeof(T)); \ memcpy(*values, default_values, sizeof(T) * num_default_values); \ + *out_num_values = num_default_values; \ return false; \ } @@ -164,7 +165,7 @@ static int get_string(void *userdata, const char *key_str, } } -static void dspfilter_free(void *userdata, void *ptr) +static void dspfilter_free(void *ptr) { free(ptr); } @@ -225,7 +226,7 @@ static bool append_plugs(rarch_dsp_filter_t *dsp, struct string_list *list) unsigned i; dspfilter_simd_mask_t mask = rarch_get_cpu_features(); - for (i = 0; i < dsp->num_plugs; i++) + for (i = 0; i < list->size; i++) { dylib_t lib = dylib_load(list->elems[i].data); if (!lib) diff --git a/audio/dsp_filter.h b/audio/dsp_filter.h index 7ae95a5367..49cb21bca2 100644 --- a/audio/dsp_filter.h +++ b/audio/dsp_filter.h @@ -24,11 +24,11 @@ void rarch_dsp_filter_free(rarch_dsp_filter_t *dsp); struct rarch_dsp_data { - const float *input; + float *input; unsigned input_frames; // Set by rarch_dsp_filter_process(). - const float *output; + float *output; unsigned output_frames; }; diff --git a/audio/filters/Panning.dsp b/audio/filters/Panning.dsp index f8d6afd62e..411345fca9 100644 --- a/audio/filters/Panning.dsp +++ b/audio/filters/Panning.dsp @@ -7,7 +7,6 @@ filter0 = panning panning_left_mix = "1.0 0.0" panning_right_mix = "0.0 1.0" - # Some examples: # # Mono: @@ -17,4 +16,8 @@ panning_right_mix = "0.0 1.0" # Swap left and right channels: # panning_left_mix = "0.0 1.0" # panning_right_mix = "1.0 0.0" +# +# Mono on one speaker: +# panning_left_mix = "0.5 0.5" +# panning_right_mix = "0.0 0.0" diff --git a/audio/filters/panning.c b/audio/filters/panning.c index 259930abfa..6085b60d77 100644 --- a/audio/filters/panning.c +++ b/audio/filters/panning.c @@ -1,3 +1,18 @@ +/* RetroArch - A frontend for libretro. + * Copyright (C) 2010-2014 - Hans-Kristian Arntzen + * + * 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 . + */ + #include "dspfilter.h" #include #include @@ -52,8 +67,13 @@ static void *panning_init(const struct dspfilter_info *info, if (num_left == 2) memcpy(pan->left, left, sizeof(pan->left)); + else + memcpy(pan->left, default_left, sizeof(pan->left)); + if (num_right == 2) memcpy(pan->right, right, sizeof(pan->right)); + else + memcpy(pan->right, default_right, sizeof(pan->right)); config->free(left); config->free(right); diff --git a/frontend/menu/backend/menu_common_backend.c b/frontend/menu/backend/menu_common_backend.c index d8933e0136..bb58226e7b 100644 --- a/frontend/menu/backend/menu_common_backend.c +++ b/frontend/menu/backend/menu_common_backend.c @@ -4061,7 +4061,7 @@ static void menu_common_setting_set_label(char *type_str, size_t type_str_size, } break; case RGUI_SETTINGS_AUDIO_DSP_FILTER: - strlcpy(type_str, g_settings.audio.dsp_plugin, type_str_size); + strlcpy(type_str, path_basename(g_settings.audio.dsp_plugin), type_str_size); break; #ifdef HAVE_OVERLAY case RGUI_SETTINGS_OVERLAY_PRESET: