Start adding fluidsynth integration - not working yet

This commit is contained in:
twinaphex 2016-09-03 05:36:40 +02:00
parent 6654de6cc9
commit 6530081f56
2 changed files with 59 additions and 14 deletions

View File

@ -89,7 +89,51 @@ SOURCES_C += $(CORE_DIR)/am_map.c \
$(CORE_DIR)/madplayer.c
ifeq ($(WANT_FLUIDSYNTH), 1)
INCFLAGS += -I$(ROOT_DIR)/fluidsynth/include -I$(ROOT_DIR)/fluidsynth/src/utils
FLUIDSYNTH_DIR := $(ROOT_DIR)/fluidlite
LIBVORBIS_DIR := $(FLUIDSYNTH_DIR)/libvorbis-1.3.5
LIBOGG_DIR := $(FLUIDSYNTH_DIR)/libogg-1.3.2
INCFLAGS += -I$(FLUIDSYNTH_DIR)/include -I$(LIBVORBIS_DIR)/include -I$(LIBOGG_DIR)/include
SOURCES_C += $(ROOT_DIR)/fluidsynth/src/fluidsynth.c
SOURCES_C += $(FLUIDSYNTH_DIR)/src/fluid_chan.c \
$(FLUIDSYNTH_DIR)/src/fluid_chorus.c \
$(FLUIDSYNTH_DIR)/src/fluid_conv.c \
$(FLUIDSYNTH_DIR)/src/fluid_defsfont.c \
$(FLUIDSYNTH_DIR)/src/fluid_dsp_float.c \
$(FLUIDSYNTH_DIR)/src/fluid_gen.c \
$(FLUIDSYNTH_DIR)/src/fluid_hash.c \
$(FLUIDSYNTH_DIR)/src/fluid_list.c \
$(FLUIDSYNTH_DIR)/src/fluid_mod.c \
$(FLUIDSYNTH_DIR)/src/fluid_ramsfont.c \
$(FLUIDSYNTH_DIR)/src/fluid_rev.c \
$(FLUIDSYNTH_DIR)/src/fluid_settings.c \
$(FLUIDSYNTH_DIR)/src/fluid_synth.c \
$(FLUIDSYNTH_DIR)/src/fluid_sys.c \
$(FLUIDSYNTH_DIR)/src/fluid_tuning.c \
$(FLUIDSYNTH_DIR)/src/fluid_voice.c
SOURCES_C += $(LIBVORBIS_DIR)/lib/analysis.c \
$(LIBVORBIS_DIR)/lib/bitrate.c \
$(LIBVORBIS_DIR)/lib/block.c \
$(LIBVORBIS_DIR)/lib/codebook.c \
$(LIBVORBIS_DIR)/lib/envelope.c \
$(LIBVORBIS_DIR)/lib/floor0.c \
$(LIBVORBIS_DIR)/lib/floor1.c \
$(LIBVORBIS_DIR)/lib/info.c \
$(LIBVORBIS_DIR)/lib/lookup.c \
$(LIBVORBIS_DIR)/lib/lpc.c \
$(LIBVORBIS_DIR)/lib/lsp.c \
$(LIBVORBIS_DIR)/lib/mapping0.c \
$(LIBVORBIS_DIR)/lib/mdct.c \
$(LIBVORBIS_DIR)/lib/psy.c \
$(LIBVORBIS_DIR)/lib/registry.c \
$(LIBVORBIS_DIR)/lib/res0.c \
$(LIBVORBIS_DIR)/lib/sharedbook.c \
$(LIBVORBIS_DIR)/lib/smallft.c \
$(LIBVORBIS_DIR)/lib/synthesis.c \
$(LIBVORBIS_DIR)/lib/tone.c \
$(LIBVORBIS_DIR)/lib/vorbisfile.c \
$(LIBVORBIS_DIR)/lib/window.c
SOURCES_C += $(LIBOGG_DIR)/src/bitwise.c \
$(LIBOGG_DIR)/src/framing.c
endif

View File

@ -12,6 +12,7 @@
#include "../src/i_sound.h"
#include "../src/musicplayer.h"
#include "../src/flplayer.h"
#include "../src/oplplayer.h"
#include "../src/madplayer.h"
@ -32,7 +33,7 @@
#define MIXBUFFERSIZE (SAMPLECOUNT_35*BUFMUL)
#define MAX_CHANNELS 32
#if 0
#if 1
#define MIDI_SUPPORT
#endif
@ -218,7 +219,7 @@ void I_SetMusicVolume(int volume)
snd_MusicVolume = volume;
#ifdef MUSIC_SUPPORT
#ifdef MIDI_SUPPORT
opl_synth_player.setvolume(volume);
fl_player.setvolume(volume);
#else
mp_player.setvolume(volume);
#endif
@ -402,7 +403,7 @@ void I_UpdateSound(void)
if (music_handle)
{
#ifdef MIDI_SUPPORT
opl_synth_player.render(mad_audio_buf, out_frames);
fl_player.render(mad_audio_buf, out_frames);
#else
mp_player.render(mad_audio_buf, out_frames);
#endif
@ -566,8 +567,8 @@ void I_PlaySong(int handle, int looping)
#ifdef MUSIC_SUPPORT
#ifdef MIDI_SUPPORT
opl_synth_player.play(music_handle, looping);
opl_synth_player.setvolume(snd_MusicVolume);
fl_player.play(music_handle, looping);
fl_player.setvolume(snd_MusicVolume);
#else
mp_player.play(music_handle, looping);
mp_player.setvolume(snd_MusicVolume);
@ -582,7 +583,7 @@ void I_PauseSong (int handle)
#ifdef MUSIC_SUPPORT
#ifdef MIDI_SUPPORT
opl_synth_player.pause();
fl_player.pause();
#else
mp_player.pause();
#endif
@ -596,7 +597,7 @@ void I_ResumeSong (int handle)
#ifdef MUSIC_SUPPORT
#ifdef MIDI_SUPPORT
opl_synth_player.resume();
fl_player.resume();
#else
mp_player.resume();
#endif
@ -613,7 +614,7 @@ void I_StopSong(int handle)
#ifdef MUSIC_SUPPORT
#ifdef MIDI_SUPPORT
opl_synth_player.stop();
fl_player.stop();
#else
mp_player.stop();
#endif
@ -627,7 +628,7 @@ void I_UnRegisterSong(int handle)
#ifdef MUSIC_SUPPORT
#ifdef MIDI_SUPPORT
opl_synth_player.unregistersong(music_handle);
fl_player.unregistersong(music_handle);
#else
mp_player.unregistersong(music_handle);
#endif
@ -654,7 +655,7 @@ int I_QrySongPlaying(int handle)
static int RegisterSong(const void *data, size_t len)
{
#ifdef MIDI_SUPPORT
music_handle = opl_synth_player.registersong(data, len);
music_handle = fl_player.registersong(data, len);
#else
music_handle = mp_player.registersong(data, len);
#endif
@ -736,7 +737,7 @@ void I_MPPlayer_Init(void)
{
#ifdef MUSIC_SUPPORT
#ifdef MIDI_SUPPORT
opl_synth_player.init(44100);
fl_player.init(44100);
#else
mp_player.init(44100);
#endif
@ -747,7 +748,7 @@ void I_MPPlayer_Free(void)
{
#ifdef MUSIC_SUPPORT
#ifdef MIDI_SUPPORT
opl_synth_player.shutdown();
fl_player.shutdown();
#else
mp_player.shutdown();
#endif