The International Simutrans Forum

 

Author Topic: [patch] FluidSynth  (Read 3377 times)

0 Members and 1 Guest are viewing this topic.

Offline TurfIt

  • Dev Team, Coder/patcher
  • Devotee
  • *
  • Posts: 1323
[patch] FluidSynth
« on: December 29, 2011, 03:55:17 AM »
One too many times starting Simutrans on Windows with the amp on, Simutrans MIDI not muted, and hence being treated  ;D  to the screeching Microsoft calls MIDI, results in this...
Obviously adds dependency to libfluidsynth. http://www.fluidsynth.org/ Tested with 1.1.5 on MinGW/GDI and MinGW/SDL so makefile enabled for those targets. Should work for any platform FluidSynth is available for.

Interesting varying volume on GDI with Win7, but the standard w32_midi.cc routine does the same. win32_sound.cc playing with waveOutSetVolume is not compatible with the new Win7 (and Vista I think) mixer. But beyond the scope of this patch...

I recommend RealFont_2_3.sf2 if you have an extra 512MB RAM to load it, and if you can find it.  ;)  Else, most in the merlin_*.sf2 series are decent with Simutrans songs, or your favorite font. The seemingly popular Fluid_R3 that's floating around, well don't write off the Simutrans songs until you try something else!

Comments?

Offline prissi

  • Developer
  • Administrator
  • *
  • Posts: 9460
  • Languages: De,EN,JP
Re: [patch] FluidSynth
« Reply #1 on: December 29, 2011, 09:09:06 PM »
I think fluidsync is most useful for Linux, as SDL_mixer has many serious problems, and windows has native support. That the onboard sound driver comes with bad midi is not the problem of simutrans.

Actuallly, I am using win7 64bit and my midi is working fine and can be even hardware supported (depending on your hardware of course).

Maybe we can add another section for sound support to the makefile ...

Offline TurfIt

  • Dev Team, Coder/patcher
  • Devotee
  • *
  • Posts: 1323
Re: [patch] FluidSynth
« Reply #2 on: December 29, 2011, 09:50:54 PM »
Linux/SDL should work fine as well, but as my last linux box has blown up, couldn't test.
SDL_mixer has added internal support for fluidsynth relatively recently, so might as well use that rather than having Simutrans add it again when SDL_mixer backend is used.

Too many graphic/sound options and the makefile is gonna get messy...

win7-64 here, using GDI every time a vehicle plays it's starting sound at different volumes, win32_sound.cc calls waveOutSetVolume. This used to (pre-Vista) just set the wave out volume and leave the MIDI volume alone. Now (post-Vista) it sets the overall application volume, i.e. There's no longer seperate wave/MIDI volumes. Hence, the music volume keeps going up/down. Of course fluidsynth uses the waveout too so will never work well with win32_sound, but it's working as good as w32_midi is for me so... w32_midi also gives me huge hiccups whenever it changes songs. The 20 year old GDI interface is rather deprecated. Testament (I guess) to Microsoft that it still works as well as it does.

Win7 native MIDI does sound much better than WinXP native. Sound to my ears like they're now using a wavetable synth with the old 4MBGMGS font from creative. Atleast if load that font into FluidSynth, it sound quite similar.  Still rather horrid IMHO. Of course soundcard drivers can change this, but good sounding MIDI is generally quite ignored...

EDIT: doh. Forgot I had the kX Audio driver on this machine. Explains the old 4MB soundfont. Will have to try again on a machine actually running the MS default drivers...
And, bad MIDI is a problem of Simutrans if everyone just turns it off because it sounds so bad!
« Last Edit: December 29, 2011, 10:12:45 PM by TurfIt »