sound, improved and optimized reimplementation of libretro lowpass filter

This commit is contained in:
kub 2020-12-21 23:22:00 +01:00
parent b437951ade
commit 30969671e5
5 changed files with 141 additions and 123 deletions

View file

@ -70,6 +70,7 @@ int _newlib_vm_size_user = 1 << TARGET_SIZE_2;
#include <pico/pico_int.h>
#include <pico/state.h>
#include <pico/patch.h>
#include <pico/sound/mix.h>
#include "../common/input_pico.h"
#include "../common/version.h"
#include <libretro.h>
@ -1434,6 +1435,8 @@ static void update_variables(bool first_run)
unsigned old_frameskip_type;
int old_vout_format;
double new_sound_rate;
unsigned short old_snd_filter;
int32_t old_snd_filter_range;
var.value = NULL;
var.key = "picodrive_input1";
@ -1539,6 +1542,7 @@ static void update_variables(bool first_run)
PicoIn.opt &= ~POPT_EN_DRC;
#endif
old_snd_filter = PicoIn.sndFilter;
var.value = NULL;
var.key = "picodrive_audio_filter";
PicoIn.sndFilter = 0;
@ -1547,6 +1551,7 @@ static void update_variables(bool first_run)
PicoIn.sndFilter = 1;
}
old_snd_filter_range = PicoIn.sndFilterRange;
var.value = NULL;
var.key = "picodrive_lowpass_range";
PicoIn.sndFilterRange = (60 * 65536) / 100;
@ -1554,6 +1559,10 @@ static void update_variables(bool first_run)
PicoIn.sndFilterRange = (atoi(var.value) * 65536) / 100;
}
if (old_snd_filter != PicoIn.sndFilter || old_snd_filter_range != PicoIn.sndFilterRange) {
mix_reset(PicoIn.sndFilter ? PicoIn.sndFilterRange : 0);
}
old_frameskip_type = frameskip_type;
frameskip_type = 0;
var.key = "picodrive_frameskip";