mirror of
https://github.com/86Box/86Box.git
synced 2025-01-23 09:42:47 -05:00
Remove a redundant and pointless #ifdef in midi_fluidsynth.c
This commit is contained in:
parent
f83a63daf2
commit
ad51c62451
1 changed files with 42 additions and 44 deletions
|
@ -1,32 +1,31 @@
|
|||
/* some code borrowed from scummvm */
|
||||
#ifdef USE_FLUIDSYNTH
|
||||
# include <stdint.h>
|
||||
# include <stdio.h>
|
||||
# include <stdlib.h>
|
||||
# include <string.h>
|
||||
# include <wchar.h>
|
||||
# ifdef __unix__
|
||||
# include <unistd.h>
|
||||
# endif
|
||||
# define FLUIDSYNTH_NOT_A_DLL
|
||||
# include <fluidsynth.h>
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <wchar.h>
|
||||
#ifdef __unix__
|
||||
# include <unistd.h>
|
||||
#endif
|
||||
#define FLUIDSYNTH_NOT_A_DLL
|
||||
#include <fluidsynth.h>
|
||||
|
||||
# include <86box/86box.h>
|
||||
# include <86box/config.h>
|
||||
# include <86box/device.h>
|
||||
# include <86box/midi.h>
|
||||
# include <86box/thread.h>
|
||||
# include <86box/sound.h>
|
||||
# include <86box/plat_unused.h>
|
||||
#include <86box/86box.h>
|
||||
#include <86box/config.h>
|
||||
#include <86box/device.h>
|
||||
#include <86box/midi.h>
|
||||
#include <86box/thread.h>
|
||||
#include <86box/sound.h>
|
||||
#include <86box/plat_unused.h>
|
||||
|
||||
# define RENDER_RATE 100
|
||||
# define BUFFER_SEGMENTS 10
|
||||
#define RENDER_RATE 100
|
||||
#define BUFFER_SEGMENTS 10
|
||||
|
||||
/* Check the FluidSynth version to determine wheteher to use the older reverb/chorus
|
||||
control functions that were deprecated in 2.2.0, or their newer replacements */
|
||||
# if (FLUIDSYNTH_VERSION_MAJOR < 2) || ((FLUIDSYNTH_VERSION_MAJOR == 2) && (FLUIDSYNTH_VERSION_MINOR < 2))
|
||||
# define USE_OLD_FLUIDSYNTH_API
|
||||
# endif
|
||||
#if (FLUIDSYNTH_VERSION_MAJOR < 2) || ((FLUIDSYNTH_VERSION_MAJOR == 2) && (FLUIDSYNTH_VERSION_MINOR < 2))
|
||||
# define USE_OLD_FLUIDSYNTH_API
|
||||
#endif
|
||||
|
||||
extern void givealbuffer_midi(void *buf, uint32_t size);
|
||||
extern void al_set_midi(int freq, int buf_size);
|
||||
|
@ -167,19 +166,19 @@ fluidsynth_init(UNUSED(const device_t *info))
|
|||
data->synth = new_fluid_synth(data->settings);
|
||||
|
||||
const char *sound_font = device_get_config_string("sound_font");
|
||||
# ifdef __unix__
|
||||
#ifdef __unix__
|
||||
if (!sound_font || sound_font[0] == 0)
|
||||
sound_font = (access("/usr/share/sounds/sf2/FluidR3_GM.sf2", F_OK) == 0 ? "/usr/share/sounds/sf2/FluidR3_GM.sf2" :
|
||||
(access("/usr/share/soundfonts/default.sf2", F_OK) == 0 ? "/usr/share/soundfonts/default.sf2" : ""));
|
||||
# endif
|
||||
#endif
|
||||
data->sound_font = fluid_synth_sfload(data->synth, sound_font, 1);
|
||||
|
||||
if (device_get_config_int("chorus")) {
|
||||
# ifndef USE_OLD_FLUIDSYNTH_API
|
||||
#ifndef USE_OLD_FLUIDSYNTH_API
|
||||
fluid_synth_chorus_on(data->synth, -1, 1);
|
||||
# else
|
||||
#else
|
||||
fluid_synth_set_chorus_on(data->synth, 1);
|
||||
# endif
|
||||
#endif
|
||||
|
||||
int chorus_voices = device_get_config_int("chorus_voices");
|
||||
double chorus_level = device_get_config_int("chorus_level") / 100.0;
|
||||
|
@ -192,48 +191,48 @@ fluidsynth_init(UNUSED(const device_t *info))
|
|||
else
|
||||
chorus_waveform = FLUID_CHORUS_MOD_TRIANGLE;
|
||||
|
||||
# ifndef USE_OLD_FLUIDSYNTH_API
|
||||
#ifndef USE_OLD_FLUIDSYNTH_API
|
||||
fluid_synth_set_chorus_group_nr(data->synth, -1, chorus_voices);
|
||||
fluid_synth_set_chorus_group_level(data->synth, -1, chorus_level);
|
||||
fluid_synth_set_chorus_group_speed(data->synth, -1, chorus_speed);
|
||||
fluid_synth_set_chorus_group_depth(data->synth, -1, chorus_depth);
|
||||
fluid_synth_set_chorus_group_type(data->synth, -1, chorus_waveform);
|
||||
# else
|
||||
#else
|
||||
fluid_synth_set_chorus(data->synth, chorus_voices, chorus_level, chorus_speed, chorus_depth, chorus_waveform);
|
||||
# endif
|
||||
#endif
|
||||
} else
|
||||
# ifndef USE_OLD_FLUIDSYNTH_API
|
||||
#ifndef USE_OLD_FLUIDSYNTH_API
|
||||
fluid_synth_chorus_on(data->synth, -1, 0);
|
||||
# else
|
||||
#else
|
||||
fluid_synth_set_chorus_on(data->synth, 0);
|
||||
# endif
|
||||
#endif
|
||||
|
||||
if (device_get_config_int("reverb")) {
|
||||
# ifndef USE_OLD_FLUIDSYNTH_API
|
||||
#ifndef USE_OLD_FLUIDSYNTH_API
|
||||
fluid_synth_reverb_on(data->synth, -1, 1);
|
||||
# else
|
||||
#else
|
||||
fluid_synth_set_reverb_on(data->synth, 1);
|
||||
# endif
|
||||
#endif
|
||||
|
||||
double reverb_room_size = device_get_config_int("reverb_room_size") / 100.0;
|
||||
double reverb_damping = device_get_config_int("reverb_damping") / 100.0;
|
||||
double reverb_width = device_get_config_int("reverb_width") / 10.0;
|
||||
double reverb_level = device_get_config_int("reverb_level") / 100.0;
|
||||
|
||||
# ifndef USE_OLD_FLUIDSYNTH_API
|
||||
#ifndef USE_OLD_FLUIDSYNTH_API
|
||||
fluid_synth_set_reverb_group_roomsize(data->synth, -1, reverb_room_size);
|
||||
fluid_synth_set_reverb_group_damp(data->synth, -1, reverb_damping);
|
||||
fluid_synth_set_reverb_group_width(data->synth, -1, reverb_width);
|
||||
fluid_synth_set_reverb_group_level(data->synth, -1, reverb_level);
|
||||
# else
|
||||
#else
|
||||
fluid_synth_set_reverb(data->synth, reverb_room_size, reverb_damping, reverb_width, reverb_level);
|
||||
# endif
|
||||
#endif
|
||||
} else
|
||||
# ifndef USE_OLD_FLUIDSYNTH_API
|
||||
#ifndef USE_OLD_FLUIDSYNTH_API
|
||||
fluid_synth_reverb_on(data->synth, -1, 0);
|
||||
# else
|
||||
#else
|
||||
fluid_synth_set_reverb_on(data->synth, 0);
|
||||
# endif
|
||||
#endif
|
||||
|
||||
int interpolation = device_get_config_int("interpolation");
|
||||
int fs_interpolation = FLUID_INTERP_4THORDER;
|
||||
|
@ -499,4 +498,3 @@ const device_t fluidsynth_device = {
|
|||
.config = fluidsynth_config
|
||||
};
|
||||
|
||||
#endif /*USE_FLUIDSYNTH*/
|
||||
|
|
Loading…
Add table
Reference in a new issue