fluid-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [fluid-dev] Patch for bad MIDI timing (with large buffer sizes)


From: David Henningsson
Subject: Re: [fluid-dev] Patch for bad MIDI timing (with large buffer sizes)
Date: Fri, 13 Mar 2009 16:39:20 +0100
User-agent: Thunderbird 2.0.0.19 (X11/20090105)

If "fluidsynth -i" is supposed to wait for a MIDI file to finish and
then quit, perhaps the below implementation is better than the one in
the patch posted earlier, but still bad, as it quits before all samples
have reached the soundcard.
Was the "-i" broken in 1.0.8? The 1.0.8 version I've got here seems to
quit immediately if the -i option is used.

/**
 * Wait for a MIDI player to terminate (when done playing).
 * @param player MIDI player instance
 * @return 0 on success, -1 otherwise
 *
 */
int fluid_player_join(fluid_player_t* player)
{

        while (player->status == FLUID_PLAYER_PLAYING) {
#if defined(WIN32)
                Sleep(10);
#elif defined(MACOS9)
                /* FIXME: should not be busy-wait */
#else
                usleep(10000);
#endif
        }
                
        return FLUID_OK;
/*      return player->timer? fluid_timer_join(player->timer) : FLUID_OK;*/
}

David Henningsson skrev:
> Hi!
> 
> I was thinking of having libfluidsynth playing background music in a
> game, and tried it out a bit. The ability to change the music while
> playing was important in this case (e g change track volumes without
> restarting the file), so this made libfluidsynth a better choice than
> other midi engines.
> 
> However, the default buffer size of 64 meant a lot of glitches in the
> audio stream, and in this case latency was less important, so a large
> buffer size was a must. It didn't take long to realize what this
> actually did to the MIDI timing.
> 
> So, I went ahead and fixed it. I guess this opens up for the possibility
> to render MIDI files faster as well, but I haven't looked into that.
> Anyway, here's the patch. I made it in debdiff format, and against the
> 1.0.8 source, because that was the simplest way for me, but I can
> probably fix another patch format if needed.
> 
> Enjoy!
> 
> // David
> 
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> fluid-dev mailing list
> address@hidden
> http://lists.nongnu.org/mailman/listinfo/fluid-dev





reply via email to

[Prev in Thread] Current Thread [Next in Thread]