Remove a redundant and pointless #ifdef in midi_fluidsynth.c
This commit is contained in:
@@ -1,32 +1,31 @@
|
|||||||
/* some code borrowed from scummvm */
|
/* some code borrowed from scummvm */
|
||||||
#ifdef USE_FLUIDSYNTH
|
#include <stdint.h>
|
||||||
# include <stdint.h>
|
#include <stdio.h>
|
||||||
# include <stdio.h>
|
#include <stdlib.h>
|
||||||
# include <stdlib.h>
|
#include <string.h>
|
||||||
# include <string.h>
|
#include <wchar.h>
|
||||||
# include <wchar.h>
|
#ifdef __unix__
|
||||||
# ifdef __unix__
|
# include <unistd.h>
|
||||||
# include <unistd.h>
|
#endif
|
||||||
# endif
|
#define FLUIDSYNTH_NOT_A_DLL
|
||||||
# define FLUIDSYNTH_NOT_A_DLL
|
#include <fluidsynth.h>
|
||||||
# include <fluidsynth.h>
|
|
||||||
|
|
||||||
# include <86box/86box.h>
|
#include <86box/86box.h>
|
||||||
# include <86box/config.h>
|
#include <86box/config.h>
|
||||||
# include <86box/device.h>
|
#include <86box/device.h>
|
||||||
# include <86box/midi.h>
|
#include <86box/midi.h>
|
||||||
# include <86box/thread.h>
|
#include <86box/thread.h>
|
||||||
# include <86box/sound.h>
|
#include <86box/sound.h>
|
||||||
# include <86box/plat_unused.h>
|
#include <86box/plat_unused.h>
|
||||||
|
|
||||||
# define RENDER_RATE 100
|
#define RENDER_RATE 100
|
||||||
# define BUFFER_SEGMENTS 10
|
#define BUFFER_SEGMENTS 10
|
||||||
|
|
||||||
/* Check the FluidSynth version to determine wheteher to use the older reverb/chorus
|
/* 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 */
|
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))
|
#if (FLUIDSYNTH_VERSION_MAJOR < 2) || ((FLUIDSYNTH_VERSION_MAJOR == 2) && (FLUIDSYNTH_VERSION_MINOR < 2))
|
||||||
# define USE_OLD_FLUIDSYNTH_API
|
# define USE_OLD_FLUIDSYNTH_API
|
||||||
# endif
|
#endif
|
||||||
|
|
||||||
extern void givealbuffer_midi(void *buf, uint32_t size);
|
extern void givealbuffer_midi(void *buf, uint32_t size);
|
||||||
extern void al_set_midi(int freq, int buf_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);
|
data->synth = new_fluid_synth(data->settings);
|
||||||
|
|
||||||
const char *sound_font = device_get_config_string("sound_font");
|
const char *sound_font = device_get_config_string("sound_font");
|
||||||
# ifdef __unix__
|
#ifdef __unix__
|
||||||
if (!sound_font || sound_font[0] == 0)
|
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" :
|
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" : ""));
|
(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);
|
data->sound_font = fluid_synth_sfload(data->synth, sound_font, 1);
|
||||||
|
|
||||||
if (device_get_config_int("chorus")) {
|
if (device_get_config_int("chorus")) {
|
||||||
# ifndef USE_OLD_FLUIDSYNTH_API
|
#ifndef USE_OLD_FLUIDSYNTH_API
|
||||||
fluid_synth_chorus_on(data->synth, -1, 1);
|
fluid_synth_chorus_on(data->synth, -1, 1);
|
||||||
# else
|
#else
|
||||||
fluid_synth_set_chorus_on(data->synth, 1);
|
fluid_synth_set_chorus_on(data->synth, 1);
|
||||||
# endif
|
#endif
|
||||||
|
|
||||||
int chorus_voices = device_get_config_int("chorus_voices");
|
int chorus_voices = device_get_config_int("chorus_voices");
|
||||||
double chorus_level = device_get_config_int("chorus_level") / 100.0;
|
double chorus_level = device_get_config_int("chorus_level") / 100.0;
|
||||||
@@ -192,48 +191,48 @@ fluidsynth_init(UNUSED(const device_t *info))
|
|||||||
else
|
else
|
||||||
chorus_waveform = FLUID_CHORUS_MOD_TRIANGLE;
|
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_nr(data->synth, -1, chorus_voices);
|
||||||
fluid_synth_set_chorus_group_level(data->synth, -1, chorus_level);
|
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_speed(data->synth, -1, chorus_speed);
|
||||||
fluid_synth_set_chorus_group_depth(data->synth, -1, chorus_depth);
|
fluid_synth_set_chorus_group_depth(data->synth, -1, chorus_depth);
|
||||||
fluid_synth_set_chorus_group_type(data->synth, -1, chorus_waveform);
|
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);
|
fluid_synth_set_chorus(data->synth, chorus_voices, chorus_level, chorus_speed, chorus_depth, chorus_waveform);
|
||||||
# endif
|
#endif
|
||||||
} else
|
} else
|
||||||
# ifndef USE_OLD_FLUIDSYNTH_API
|
#ifndef USE_OLD_FLUIDSYNTH_API
|
||||||
fluid_synth_chorus_on(data->synth, -1, 0);
|
fluid_synth_chorus_on(data->synth, -1, 0);
|
||||||
# else
|
#else
|
||||||
fluid_synth_set_chorus_on(data->synth, 0);
|
fluid_synth_set_chorus_on(data->synth, 0);
|
||||||
# endif
|
#endif
|
||||||
|
|
||||||
if (device_get_config_int("reverb")) {
|
if (device_get_config_int("reverb")) {
|
||||||
# ifndef USE_OLD_FLUIDSYNTH_API
|
#ifndef USE_OLD_FLUIDSYNTH_API
|
||||||
fluid_synth_reverb_on(data->synth, -1, 1);
|
fluid_synth_reverb_on(data->synth, -1, 1);
|
||||||
# else
|
#else
|
||||||
fluid_synth_set_reverb_on(data->synth, 1);
|
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_room_size = device_get_config_int("reverb_room_size") / 100.0;
|
||||||
double reverb_damping = device_get_config_int("reverb_damping") / 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_width = device_get_config_int("reverb_width") / 10.0;
|
||||||
double reverb_level = device_get_config_int("reverb_level") / 100.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_roomsize(data->synth, -1, reverb_room_size);
|
||||||
fluid_synth_set_reverb_group_damp(data->synth, -1, reverb_damping);
|
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_width(data->synth, -1, reverb_width);
|
||||||
fluid_synth_set_reverb_group_level(data->synth, -1, reverb_level);
|
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);
|
fluid_synth_set_reverb(data->synth, reverb_room_size, reverb_damping, reverb_width, reverb_level);
|
||||||
# endif
|
#endif
|
||||||
} else
|
} else
|
||||||
# ifndef USE_OLD_FLUIDSYNTH_API
|
#ifndef USE_OLD_FLUIDSYNTH_API
|
||||||
fluid_synth_reverb_on(data->synth, -1, 0);
|
fluid_synth_reverb_on(data->synth, -1, 0);
|
||||||
# else
|
#else
|
||||||
fluid_synth_set_reverb_on(data->synth, 0);
|
fluid_synth_set_reverb_on(data->synth, 0);
|
||||||
# endif
|
#endif
|
||||||
|
|
||||||
int interpolation = device_get_config_int("interpolation");
|
int interpolation = device_get_config_int("interpolation");
|
||||||
int fs_interpolation = FLUID_INTERP_4THORDER;
|
int fs_interpolation = FLUID_INTERP_4THORDER;
|
||||||
@@ -499,4 +498,3 @@ const device_t fluidsynth_device = {
|
|||||||
.config = fluidsynth_config
|
.config = fluidsynth_config
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /*USE_FLUIDSYNTH*/
|
|
||||||
|
Reference in New Issue
Block a user