Merge branch 'master' into jgrpp
# Conflicts: # src/debug.cpp # src/lang/russian.txt # src/misc_gui.cpp # src/os/windows/crashlog_win.cpp # src/os/windows/font_win32.cpp # src/os/windows/win32.cpp # src/rail_cmd.cpp # src/window_gui.h
This commit is contained in:
@@ -134,8 +134,8 @@ void MusicDriver_Cocoa::PlaySong(const MusicSongInfo &song)
|
||||
return;
|
||||
}
|
||||
|
||||
const char *os_file = OTTD2FS(filename.c_str());
|
||||
CFAutoRelease<CFURLRef> url(CFURLCreateFromFileSystemRepresentation(kCFAllocatorDefault, (const UInt8*)os_file, strlen(os_file), false));
|
||||
std::string os_file = OTTD2FS(filename);
|
||||
CFAutoRelease<CFURLRef> url(CFURLCreateFromFileSystemRepresentation(kCFAllocatorDefault, (const UInt8*)os_file.c_str(), os_file.length(), false));
|
||||
|
||||
if (MusicSequenceFileLoad(_sequence, url.get(), kMusicSequenceFile_AnyType, 0) != noErr) {
|
||||
DEBUG(driver, 0, "cocoa_m: Failed to load MIDI file");
|
||||
|
||||
@@ -433,7 +433,7 @@ bool DLSFile::ReadDLSWaveList(FILE *f, DWORD list_length)
|
||||
|
||||
bool DLSFile::LoadFile(const wchar_t *file)
|
||||
{
|
||||
DEBUG(driver, 2, "DMusic: Try to load DLS file %s", FS2OTTD(file));
|
||||
DEBUG(driver, 2, "DMusic: Try to load DLS file %s", FS2OTTD(file).c_str());
|
||||
|
||||
FILE *f = _wfopen(file, L"rb");
|
||||
if (f == nullptr) return false;
|
||||
@@ -884,7 +884,7 @@ static const char *LoadDefaultDLSFile(const char *user_dls)
|
||||
if (!dls_file.LoadFile(path)) return "Can't load GM DLS collection";
|
||||
}
|
||||
} else {
|
||||
if (!dls_file.LoadFile(OTTD2FS(user_dls))) return "Can't load GM DLS collection";
|
||||
if (!dls_file.LoadFile(OTTD2FS(user_dls).c_str())) return "Can't load GM DLS collection";
|
||||
}
|
||||
|
||||
/* Get download port and allocate download IDs. */
|
||||
|
||||
@@ -29,7 +29,15 @@ static FMusicDriver_FluidSynth iFMusicDriver_FluidSynth;
|
||||
|
||||
/** List of sound fonts to try by default. */
|
||||
static const char *default_sf[] = {
|
||||
/* Debian/Ubuntu/OpenSUSE preferred */
|
||||
/* FluidSynth preferred */
|
||||
/* See: https://www.fluidsynth.org/api/settings_synth.html#settings_synth_default-soundfont */
|
||||
"/usr/share/soundfonts/default.sf2",
|
||||
|
||||
/* Debian/Ubuntu preferred */
|
||||
/* See: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=929185 */
|
||||
"/usr/share/sounds/sf3/default-GM.sf3",
|
||||
|
||||
/* OpenSUSE preferred */
|
||||
"/usr/share/sounds/sf2/FluidR3_GM.sf2",
|
||||
|
||||
/* RedHat/Fedora/Arch preferred */
|
||||
@@ -77,12 +85,22 @@ const char *MusicDriver_FluidSynth::Start(const StringList ¶m)
|
||||
/* Load a SoundFont and reset presets (so that new instruments
|
||||
* get used from the SoundFont) */
|
||||
if (!sfont_name) {
|
||||
int i;
|
||||
sfont_id = FLUID_FAILED;
|
||||
for (i = 0; default_sf[i]; i++) {
|
||||
if (!fluid_is_soundfont(default_sf[i])) continue;
|
||||
sfont_id = fluid_synth_sfload(_midi.synth, default_sf[i], 1);
|
||||
if (sfont_id != FLUID_FAILED) break;
|
||||
|
||||
/* Try loading the default soundfont registered with FluidSynth. */
|
||||
char *default_soundfont;
|
||||
fluid_settings_dupstr(_midi.settings, "synth.default-soundfont", &default_soundfont);
|
||||
if (fluid_is_soundfont(default_soundfont)) {
|
||||
sfont_id = fluid_synth_sfload(_midi.synth, default_soundfont, 1);
|
||||
}
|
||||
|
||||
/* If no default soundfont found, try our own list. */
|
||||
if (sfont_id == FLUID_FAILED) {
|
||||
for (int i = 0; default_sf[i]; i++) {
|
||||
if (!fluid_is_soundfont(default_sf[i])) continue;
|
||||
sfont_id = fluid_synth_sfload(_midi.synth, default_sf[i], 1);
|
||||
if (sfont_id != FLUID_FAILED) break;
|
||||
}
|
||||
}
|
||||
if (sfont_id == FLUID_FAILED) return "Could not open any sound font";
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user