[haiku-development] BSynth

  • From: Pete Goodeve <pete.goodeve@xxxxxxxxxxxx>
  • To: Haiku Development <haiku-development@xxxxxxxxxxxxx>
  • Date: Thu, 8 Aug 2013 14:09:25 -0700

Hi All,

My current project is to shine up BSynth a bit.  Seems to have
been neglected for a few years.

I've implemented the GetAudio call.  Pretty much just cosmetic,
but the scope in MidiPlayer is no longer a disconcerting flatline!
I also have the Reverb settings working.  Don't know how closely
they match the old BeOS/Beatnik levels (I no longer have sound
on my BeOS box), but they sound reasonable.

My main reason, though, for working on it was to rationalize its
access to soundfonts.  It currently requires
 '/boot/system/data/synth/big_synth.sy' which seems very wrong
to me for a couple of reasons.

'big_synth.sy' was of course not a soundfont, but a special format
from Beatnik, so it's confusing to equate a standard soundfont
-- with the standard extension '.sf2' -- to that.  Furthermore the
user didn't have much choice.  Theoretically there was a
'little_synth.sy' but I never saw it (and can't find any trace now).
So having it as part of the 'system' was reasonable.  And if a
user did want to change it, touching the system hierarchy was
not as verboten as it is in Haiku.

Now, however, there is a wide variety of useable soundfonts,
and switching around to find a good one may be quite frequent.
So I don't think system/data is a good default location.  And it's
annoying to have the warning alert pop up every time you do
make a change.  (It's not a part of the distributed system, either.)

My solution is to give the synth a search chain, starting in
the user-settings folder, and ending up as a last resort with
the current big_synth.sy.  Aside from the last, it always looks
for 'synth.sf2' in a subfolder 'synth.  In MidiDefs.h, B_SYNTH_FILE
is  defined as "synth/synth.sf2", and B_SYNTH_DIRECTORY is
now B_COMMON_DATA_DIRECTORY.  The old B_BIG_SYNTH_FILE
has been left as is for compatibility.

So in detail, it looks for, in sequence:
   <B_USER_SETTINGS_DIRECTORY>/B_SYNTH_FILE
   <B_SYNTH_DIRECTORY>/B_SYNTH_FILE
   <B_SYSTEM_DATA_DIRECTORY>/B_BIG_SYNTH_FILE

The idea is that the user can put a link in ...settings/synth/synth.sf2
to a file of their choice, or just use a link (or actual file) in
...common/data/synth/synth.sf2.  If they never update from the
old convention, it will still find any current 'big_synth'

If the chain fails, it pops up an alert.  Is there any reason this
might be a bad idea in a shared lib?  I couldn't think of one, so
I put it in.

Anyway, does all this seem reasonable?  I checked it against
some other programs, and they all behave exactly as they did
with the current lib.  A couple of BeOS-era ones -- the original
MidiPlayer and Michael Pfeiffer's MidiSynth -- still run nicely in
Haiku.  (Some others don't, for various reasons.)

Thanks,
        -- Pete --

Other related posts: