Update FluidSynth and more

This commit is contained in:
Wengier 2020-10-23 00:54:14 -04:00
parent 9b6f987d2e
commit a643101e2d
15 changed files with 95 additions and 44 deletions

View File

@ -38,6 +38,13 @@
be similar to the setting "fixed" but the reported
free disk size will also change relative to the
change of the free disk size ever since. (Wengier)
- Support for FluidSynth MIDI Synthesizer is now
included in the MinGW builds by default just like
Visual Studio builds. Set "mididevice=fluidsynth"
and a soundfont file to use it. (Wengier)
- Add menu item "Show MIDI device" under "Sound" menu
to show the current MIDI device and soundfont file
(or ROM path for MT32) in use. (Wengier)
- Added "Mount multiple disk/CD images" option to the
mounting options of the Drive menu to allow users
to mount more than one disk/CD images to a drive,

View File

@ -393,7 +393,7 @@ if test x$enable_emscripten != xyes; then
dnl Some target detection and actions for them
case "$host" in
*-*-cygwin* | *-*-mingw32*)
LIBS="$LIBS -lwinmm -limm32 -lole32 -loleaut32 -lversion -lsetupapi"
LIBS="$LIBS -lwinmm -ldsound -limm32 -lole32 -loleaut32 -lversion -lsetupapi"
CXXFLAGS="$CXXFLAGS -mno-ms-bitfields"
if test x$have_sdl_net_h = xyes ; then
dnl HACK: We have to put SDL_net THEN winsock libraries or else the linker can't resolve things properly
@ -1087,6 +1087,7 @@ src/libs/gui_tk/Makefile
src/libs/porttalk/Makefile
src/libs/mt32/Makefile
src/libs/xBRZ/Makefile
src/libs/fluidsynth/Makefile
src/output/Makefile
src/output/direct3d/Makefile
src/builtin/Makefile

View File

@ -27,24 +27,7 @@
extern "C" {
#endif
#if defined(WIN32)
#if defined(FLUIDSYNTH_DLL_EXPORTS)
#define FLUIDSYNTH_API __declspec(dllexport)
#elif defined(FLUIDSYNTH_NOT_A_DLL)
#define FLUIDSYNTH_API
#else
#define FLUIDSYNTH_API __declspec(dllimport)
#endif
#elif defined(MACOS9)
#define FLUIDSYNTH_API __declspec(export)
#elif defined(__GNUC__)
#define FLUIDSYNTH_API __attribute__ ((visibility ("default")))
#else
#define FLUIDSYNTH_API
#endif
/**
* @file fluidsynth.h

View File

@ -17,9 +17,19 @@
#define AUFILE_SUPPORT 0
#define WITH_FLOAT 1
/* MinGW32 special defines */
#if defined(__MINGW32__)
#include <stdint.h>
//#define snprintf _snprintf
#define vsnprintf _vsnprintf
#else
#if _MSC_VER < 1900
#define snprintf _snprintf
#endif
#if _MSC_VER < 1500
#define vsnprintf _vsnprintf
#endif
#endif
#if _MSC_VER
#define alloca _alloca
@ -27,9 +37,6 @@
#define strcasecmp _stricmp
#if _MSC_VER < 1500
#define vsnprintf _vsnprintf
#endif
#define STDIN_FILENO 0
#define STDOUT_FILENO 1

View File

@ -45,6 +45,10 @@ dosbox_x_LDADD += libs/mt32/libmt32.a
endif
endif
if !EMSCRIPTEN
dosbox_x_LDADD += libs/fluidsynth/libfluidsynth.a
endif
if EMSCRIPTEN
dosbox_x_js:
emcc -s TOTAL_MEMORY=134217728 -s DISABLE_EXCEPTION_CATCHING=0 -s EMTERPRETIFY=1 -s EMTERPRETIFY_ASYNC=1 -s EMTERPRETIFY_FILE=dosbox-x.data $(dosbox_x_OBJECTS) $(dosbox_x_LDADD) $(LIBS) $(dosbox_x_OBJECTS) $(dosbox_x_DEPENDENCIES) $(EXTRA_dosbox_x_DEPENDENCIES) -o dosbox-x.html

View File

@ -1267,7 +1267,7 @@ void DOSBOX_SetupConfigSections(void) {
const char* cputype_values[] = {"auto", "8086", "8086_prefetch", "80186", "80186_prefetch", "286", "286_prefetch", "386", "386_prefetch", "486old", "486old_prefetch", "486", "486_prefetch", "pentium", "pentium_mmx", "ppro_slow", 0};
const char* rates[] = { "44100", "48000", "32000","22050", "16000", "11025", "8000", "49716", 0 };
const char* oplrates[] = { "44100", "49716", "48000", "32000","22050", "16000", "11025", "8000", 0 };
#ifdef C_FLUIDSYNTH
#if C_FLUIDSYNTH || defined(WIN32)
const char* devices[] = { "default", "win32", "alsa", "oss", "coreaudio", "coremidi", "mt32", "synth", "fluidsynth", "timidity", "none", 0};
#else
const char* devices[] = { "default", "win32", "alsa", "oss", "coreaudio", "coremidi", "mt32", "timidity", "none", 0}; // FIXME: add some way to offer the actually available choices.
@ -2705,7 +2705,7 @@ void DOSBOX_SetupConfigSections(void) {
"Otherwise, the emulation accuracy is preserved.\n"
"Default is true.");
#ifdef C_FLUIDSYNTH
#if C_FLUIDSYNTH || defined(WIN32)
const char *fluiddrivers[] = {"pulseaudio", "alsa", "oss", "coreaudio", "dsound", "portaudio", "sndman", "jack", "file", "default",0};
Pstring = secprop->Add_string("fluid.driver",Property::Changeable::WhenIdle,"default");
Pstring->Set_values(fluiddrivers);

View File

@ -550,6 +550,7 @@ static const char *def_menu_sound[] =
"mapper_recvoldown",
"--",
"mixer_info",
"midi_info",
"--",
"mixer_mute",
"mixer_swapstereo",

View File

@ -69,6 +69,7 @@ MidiHandler::MidiHandler(){
MidiHandler Midi_none;
DB_Midi midi;
std::string sffile="Not available";
static struct {
bool init;
@ -96,7 +97,7 @@ static struct {
#include "midi_mt32.h"
#endif
#if C_FLUIDSYNTH
#if C_FLUIDSYNTH || defined(WIN32)
#include "midi_synth.h"
#endif
@ -583,7 +584,7 @@ public:
Section_prop * section = static_cast<Section_prop *>(configuration);
const char * dev=section->Get_string("mididevice");
std::string fullconf = section->Get_string("midiconfig");
#if C_FLUIDSYNTH
#if C_FLUIDSYNTH || defined(WIN32)
synthsamplerate = section->Get_int("samplerate");
if (synthsamplerate == 0) synthsamplerate = 44100;
#endif

View File

@ -258,6 +258,7 @@ public:
return false;
}
}
sffile=std::string(romDir);
service->setPartialCount(uint32_t(section->Get_int("mt32.partials")));
service->setAnalogOutputMode((MT32Emu::AnalogOutputMode)section->Get_int("mt32.analog"));

View File

@ -16,7 +16,11 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#if C_FLUIDSYNTH
#include <fluidsynth.h>
#else
#include "fluidsynth.h"
#endif
#include <math.h>
#include <string.h>
#include "control.h"
@ -181,6 +185,7 @@ public:
delete_fluid_settings(settings);
return false;
}
sffile=std::string(conf);
synthchan = MIXER_AddChannel(synth_CallBack, (unsigned int)synthsamplerate, "SYNTH");
synthchan->Enable(false);
@ -368,6 +373,7 @@ public:
soundfont_id = -1;
}
else {
sffile=soundfont;
LOG_MSG("MIDI:fluidsynth: Loaded SoundFont: %s", soundfont.c_str());
}
}

View File

@ -35,6 +35,7 @@
#include "control.h"
#include "shell.h"
#include "cpu.h"
#include "midi.h"
#include "bios_disk.h"
#include "../dos/drives.h"
@ -1547,6 +1548,38 @@ public:
}
};
extern DB_Midi midi;
extern std::string sffile;
class ShowMidiDevice : public GUI::ToplevelWindow {
protected:
GUI::Input *name;
public:
ShowMidiDevice(GUI::Screen *parent, int x, int y, const char *title) :
ToplevelWindow(parent, x, y, 320, 200, title) {
std::string name=!midi.handler||!midi.handler->GetName()?"-":midi.handler->GetName();
if (name.size()) {
if (name=="mt32") name="MT32";
else if (name=="fluidsynth") name="FluidSynth";
else name[0]=toupper(name[0]);
}
std::string midiinfo = "MIDI available: "+std::string(midi.available?"Yes":"No")+"\nMIDI device: "+name+"\nMIDI soundfont file / ROM path:\n"+sffile;
std::istringstream in(midiinfo.c_str());
int r=0;
if (in) for (std::string line; std::getline(in, line); ) {
r+=25;
new GUI::Label(this, 40, r, line.c_str());
}
(new GUI::Button(this, 140, r+30, "Close", 70))->addActionHandler(this);
}
void actionExecuted(GUI::ActionEventSource *b, const GUI::String &arg) {
(void)b;//UNUSED
if (arg == "Close")
close();
if (shortcut) running = false;
}
};
class ShowDriveInfo : public GUI::ToplevelWindow {
protected:
GUI::Input *name;
@ -2065,6 +2098,10 @@ static void UI_Select(GUI::ScreenSDL *screen, int select) {
auto *np5 = new ShowMixerInfo(screen, 90, 70, "Current sound levels in DOSBox-X");
np5->raise();
} break;
case 21: {
auto *np6 = new ShowMidiDevice(screen, 150, 100, "Current MIDI device in DOSBox-X");
np6->raise();
} break;
case 23: {
auto *np7 = new ShowLoadWarning(screen, 150, 120, "DOSBox-X version mismatch. Load the state anyway?");
np7->raise();

View File

@ -7738,6 +7738,22 @@ bool mixer_info_menu_callback(DOSBoxMenu * const menu,DOSBoxMenu::item * const m
return true;
}
bool midi_device_menu_callback(DOSBoxMenu * const menu,DOSBoxMenu::item * const menuitem) {
(void)menu;//UNUSED
(void)menuitem;//UNUSED
MAPPER_ReleaseAllKeys();
GFX_LosingFocus();
GUI_Shortcut(21);
MAPPER_ReleaseAllKeys();
GFX_LosingFocus();
return true;
}
bool cpu_speed_emulate_menu_callback(DOSBoxMenu * const menu,DOSBoxMenu::item * const menuitem) {
(void)menu;//UNUSED
int cyclemu = 0;
@ -9915,6 +9931,8 @@ int main(int argc, char* argv[]) SDL_MAIN_NOEXCEPT {
set_callback_function(mixer_mute_menu_callback);
mainMenu.alloc_item(DOSBoxMenu::item_type_id,"mixer_info").set_text("Show sound levels").
set_callback_function(mixer_info_menu_callback);
mainMenu.alloc_item(DOSBoxMenu::item_type_id,"midi_info").set_text("Show current MIDI device").
set_callback_function(midi_device_menu_callback);
}
}
{

View File

@ -1,6 +1,6 @@
AM_CPPFLAGS = -I$(top_srcdir)/include
SUBDIRS = zmbv gui_tk porttalk mt32
SUBDIRS = zmbv gui_tk porttalk mt32 fluidsynth
if C_XBRZ
SUBDIRS += xBRZ

View File

@ -345,7 +345,7 @@ void fluid_clear_fpe_i386(void);
#else
#define fluid_sleep(ms) usleep((ms) * 1000)
#endif
#if defined(WIN32) && !defined(MINGW32)
#if defined(WIN32) && !defined(__MINGW32__)
#define FLUID_STRCASECMP _stricmp
#else
#define FLUID_STRCASECMP strcasecmp

View File

@ -32,7 +32,7 @@
#include "config_maxmsp43.h"
#endif
#if defined(WIN32) && !defined(MINGW32)
#if defined(WIN32)
#include "fluidsynth/config_win32.h"
#endif
@ -118,21 +118,6 @@
#include <windows.h>
#endif
/* MinGW32 special defines */
#ifdef MINGW32
#include <stdint.h>
#define snprintf _snprintf
#define vsnprintf _vsnprintf
#define DSOUND_SUPPORT 1
#define WINMIDI_SUPPORT 1
#define STDIN_FILENO 0
#define STDOUT_FILENO 1
#define STDERR_FILENO 2
#endif
/* Darwin special defines (taken from config_macosx.h) */
#ifdef DARWIN
#define MACINTOSH
@ -174,7 +159,7 @@ typedef int fluid_socket_t;
/** Integer types */
#if defined(MINGW32)
#if defined(__MINGW32__)
/* Windows using MinGW32 */
typedef int8_t sint8;