[haiku-bugs] [Haiku] #12899: Use fluidlite as fluidsynth replacement, add SF3 support

  • From: "korli" <trac@xxxxxxxxxxxx>
  • Date: Thu, 04 Aug 2016 18:13:07 -0000

#12899: Use fluidlite as fluidsynth replacement, add SF3 support
---------------------------+------------------------------
 Reporter:  korli          |        Owner:  korli
     Type:  enhancement    |       Status:  new
 Priority:  normal         |    Milestone:  R1
Component:  Kits/Midi Kit  |      Version:  R1/Development
 Keywords:                 |   Blocked By:
 Blocking:                 |  Has a Patch:  0
 Platform:  All            |
---------------------------+------------------------------
 Fluidlite is a "very light version of FluidSynth designed to be hardware,
 platform and external dependency independant".

 I uploaded packages for it and am proposing a patch to switch to it:
 * add build features for libvorbis and fluidlite
 * use these libs and headers for libmidi.
 * include <fluidlite.h> instead of <fluidsynth.h>

 The functionality should be the same as now, but I could only basically
 test.
 The bootstrap build (which doesn't include libmidi.so) isn't affected.

 * libvorbis is required to support SF3 (SF2 files compressed with ogg
 vorbis).
 * To be noticed, the fluidlite packages include this commit from Pete
 added in hrev45742.
 * I didn't manage to have a single build feature with the 2 libs, in fact
 because fluidlite is only a static library, linking against
 libvorbisfile.so had to be added.
 * SF3 support could help to use better quality soundfounds for a same
 disksize (MuseScore provides FluidR3Mono_GM.sf3 for instance).
 * Fluidsynth seems to be stagnant (4 years without a release, well that's
 more than Haiku :) ).

 Comments welcome! I plan to push the change for real world test next week.

 {{{
 diff --git a/build/jam/BuildFeatures b/build/jam/BuildFeatures
 index 0b75ec3..660ee57 100644
 --- a/build/jam/BuildFeatures
 +++ b/build/jam/BuildFeatures
 @@ -256,6 +256,37 @@ if [ IsPackageAvailable ffmpeg_devel ] {
  }


 +# Fluidlite
 +if [ IsPackageAvailable fluidlite_devel ] && [ IsPackageAvailable
 libvorbis_devel ] {
 +       ExtractBuildFeatureArchives fluidlite :
 +               file: devel fluidlite_devel
 +                       library: $(developLibDir)/libfluidlite.a
 +                       headers: $(developHeadersDir)
 +               ;
 +
 +       EnableBuildFeatures fluidlite ;
 +} else {
 +       Echo "Fluidlite support not available on $(TARGET_PACKAGING_ARCH)"
 ;
 +}
 +
 +
 +# Libvorbis
 +if [ IsPackageAvailable libvorbis_devel ] {
 +       ExtractBuildFeatureArchives libvorbis :
 +               file: base libvorbis
 +                       runtime: lib
 +               file: devel libvorbis_devel
 +                       depends: base
 +                       library: $(developLibDir)/libvorbisfile.so.3
 +                       headers: $(developHeadersDir)
 +               ;
 +
 +       EnableBuildFeatures libvorbis ;
 +} else {
 +       Echo "Libvorbis support not available on $(TARGET_PACKAGING_ARCH)"
 ;
 +}
 +
 +
  # Freetype
  if [ IsPackageAvailable freetype_devel ] {
         ExtractBuildFeatureArchives freetype :
 diff --git a/src/kits/midi/Jamfile b/src/kits/midi/Jamfile
 index d6bb5c2..d91a03a 100644
 --- a/src/kits/midi/Jamfile
 +++ b/src/kits/midi/Jamfile
 @@ -9,11 +9,20 @@ if $(TARGET_PLATFORM) != haiku {
  }

  UsePrivateHeaders midi ;
 -UseLibraryHeaders fluidsynth ;
 +

  local architectureObject ;
  for architectureObject in [ MultiArchSubDirSetup ] {
         on $(architectureObject) {
 +               if ! [ FIsBuildFeatureEnabled fluidlite ] {
 +                       continue ;
 +               }
 +
 +               UseBuildFeatureHeaders fluidlite ;
 +               Includes [ FGristFiles MidiSynth.cpp MidiSynthFile.cpp
 +                       SoftSynth.cpp Synth.cpp ]
 +                       : [ BuildFeatureAttribute fluidlite : headers ] ;
 +
                 SharedLibrary [ MultiArchDefaultGristFiles libmidi.so ] :
                         Midi.cpp
                         MidiGlue.cpp
 @@ -30,7 +39,8 @@ for architectureObject in [ MultiArchSubDirSetup ] {
                         be
                         midi2
                         media
 -                       [ MultiArchDefaultGristFiles libfluidsynth.so ]
 +                       [ BuildFeatureAttribute libvorbis : library ]
 +                       [ BuildFeatureAttribute fluidlite : library ]
                         [ TargetLibsupc++ ]
                         ;
         }
 diff --git a/src/kits/midi/SoftSynth.h b/src/kits/midi/SoftSynth.h
 index ccd7cb4..da9c7a8 100644
 --- a/src/kits/midi/SoftSynth.h
 +++ b/src/kits/midi/SoftSynth.h
 @@ -19,7 +19,7 @@
         This version of SoftSynth is a wrapper libfluidsynth.so.
   */

 -#include <fluidsynth.h>
 +#include <fluidlite.h>
  #include <Midi.h>
  #include <SoundPlayer.h>
  #include <Synth.h>
 }}}

--
Ticket URL: <https://dev.haiku-os.org/ticket/12899>
Haiku <https://dev.haiku-os.org>
Haiku - the operating system.

Other related posts: