Hi Max,

I'm going to go for a shameless plug here, because it seems my project
might be of interest to you.  The project is called Gleam
(http://gleamsynth.sf.net), it's based on fluidsynth's code base and I
started it precisely because of some of the limitations you describe.

There is no real documentation (although the most important parts of
the API are commented in the code), but there is a simple playmidi
example that hopefully shows at least part of what you would need.
Also, I would of course be happy to answer any questions you might
have.

> - there is no way to tell whether the "player" has finished playing a
>  MIDI file - the "status" attribute is not exposed.

With Gleam you can add a "conditionsync" event at the end of the song
(after loading it from a MIDI file or some other way) that signals a
pthread condition variable when it is played.  There is currently no
way of checking for the end of the song synchronously, but I will add
that (I didn't notice this feature was missing).

> - the "player" insists on playing in real-time, all my attempts to
>  fill MPD's internal audio buffer as fast as possible failed, there
>  was only silence in the buffer after the fluid_synth_write_s16()
>  call.

Gleam provides a readAudio() method that gives you however many
samples you ask for synchronously and as fast as it can, and it
advances the internal clock accordingly.  The wall clock is not used
at all.

> - error handling in fluidsynth is awful.  Most functions return an
>  undocumented "int", its meaning can only be derived from reading the
>  source, but I cannot grasp what's gone wrong, I cannot generate a
>  usable error message.

Gleam might not do what you want here.  Functions usually return a
boolean ("true" meaning everything was OK, "false" meaning an error
occurred), while warning and error messages are passed to a logger
object.  The default logger prints warnings and errors to the console,
but you can replace this logger with your own one that can do whatever
it wants with those messages.  Maybe I should create some enums for
the error codes so the calling application can easily distinguish
between different errors.

> - I don't want fluidsynth to create a new thread.  Synthesize the MIDI
>  file synchronously in the thread which called the library.

If you don't use Gleam's audio drivers (which it doesn't seem like you
would), Gleam doesn't create or use any threads.

Finally, if you do want to give my project a try, a word of caution:
Gleam uses a non-standard build infrastructure, which has confused
people in the past.  It *should* be really simple to build the source
for the 0.0.2 release, but building from SVN depends on some other
software your Linux distribution might not ship.  This is all
described in the Documentation that can be found it the project's web
page.  Again, I'm more than happy to answer any queries.

-- 
Miguel
Check out Gleam, an LGPL sound synthesizer library, at http://gleamsynth.sf.net

------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
_______________________________________________
Musicpd-dev-team mailing list
Musicpd-dev-team@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/musicpd-dev-team

Reply via email to