Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo


#217 Add timidity server MIDI backend

Yair K.

Currently, dosbox has MIDI backends for Win32, Mac (CoreAudio) and Linux (ALSA or OSS sequencer). This leaves out users of other operating systems. This patch adds a timidity server MIDI backend, so that MIDI would be available on any system which can run timidity server. To run:

1) Patch dosbox and rebuild (note this backend requires SDL_net to be enabled).
2) Run "timidity -ir 7777" (some might want to use extra switches to reduce CPU use)
3) Edit ~/.dosboxrc, and set "device=timidity" under "[midi]" section (probably optional, dosbox does try autodetection).
4) Start dosbox.

A) This patch is a straight port from ScummVM, and I needed to make very few modifications. Thus I kept the original copyright notice (I guess you'll want to edit this to mention DosBox). All credit really belongs to Dmitry Marakasov, which made the original scummvm timidity backend (See https://sourceforge.net/tracker/?func=detail&aid=1815526&group_id=37116&atid=418822).

B) The only noteworthy modifications I made are to use SDL_net instead of the socket() API and to use SDL_Delay instead of usleep(). Both are due to portability reasons (scummvm uses whitelisting by autoconf and some #ifdefs, which is less clean and possibly excludes some platforms which can benefit). I suspect using SDL_Delay instead of usleep might have increased CPU use a bit, but that seems negligable/nonexistant on my (limited) testing.

C) libfluidsynth is an alternative which would have also increased MIDI backend portability, and I guess a port from scummvm would be almost as easy. I think there's enough room for both backends - various people prefer one or the other... As it is, the attached patch doesn't introduce any new (even optional) dependency to dosbox.

D) Patch has been tested on both dosbox-0.72 and a CVS pull from today and worked well.


  • Yair K.
    Yair K.

    Patch to add the timidity midi backend