author Sam Lantinga <slouken@libsdl.org>
Tue, 17 Oct 2017 21:54:04 -0700
changeset 782 e7d3a8f73e88
permissions -rw-r--r--
Merged over timidity from SDL_sound
This has changes to make it safe to load MIDI files as sound chunks and adds the ability to seek in MIDI files
Also cherry picked some patches from the original SDL_mixer timidity to fix buffer overruns and so forth.
     1 This version of TiMidity should contain all the fixes from the
     2 September 25 2003 SDL_mixer CVS snapshot. In addition, I've made some
     3 changes of my own, e.g.:
     5 * All file access is done through SDL_RWops. This means the MIDI
     6   stream no longer has to be a file. (The config file and instruments
     7   still have to be though.)
     9 * Replacing of TiMidity's endian-handling with SDL's.
    11 * Removal of much unused or unnecessary code, such as
    13   + The "hooks" for putting a user interface onto TiMidity.
    14   + The antialias filter. It wasn't active, and even at 4 kHz I
    15     couldn't hear any difference when activating it.
    16   + Removed all traces of LOOKUP_HACK and LOOKUP_INTERPOLATION.
    17     According to the code comments they weren't very good anyway.
    18     ("degrades sound quality noticeably"). I also removed the
    19     disclaimer about the "8-bit uLaw to 16-bit PCM and the 13-bit-PCM
    20     to 8-bit uLaw tables" disclaimer, since I believe those were the
    21     tables I removed.
    22   + Removed LOOKUP_SINE since it was already commented out. I think we
    23     can count on our target audience having math co-processors
    24     nowadays.
    25   + Removed USE_LDEXP since it wasn't being used and "it doesn't make
    26     much of a difference either way".
    27   + Removed decompress hack from open_file() since it didn't look very
    28     portable.
    29   + Removed heaps of unnecessary constants.
    30   + Removed unused functions.
    31   + Assume that LINEAR_INTERPOLATION is always used, so remove all
    32     code dealing with it not being so. It's not that I think the
    33     difference in audio quality is that great, but since it wouldn't
    34     compile without code changes I assume no one's used it for quite
    35     some time...
    36   + Assume PRECALC_LOOPS is always defined. Judging by the comments it
    37     may not make much of a difference either way, so why maintain two
    38     versions of the same code?
    40 * Moving several static globals into the MidiSong struct. This
    41   includes sample rate, formate, etc. which are now all per-song.
    43 * Moved some typedefs (e.g. MidiSong) to timidity.h for easy inclusion
    44   into the MIDI decoder.
    46 * Added free_pathlist().
    48 * Replaced TiMidity's own 8, 16 and 32-bit types with SDL's.
    50 * Made TiMidity look for its configuration file in both /etc and
    51   /usr/local/lib/timidity. (Windows version remains unchanged.)
    53 * Timidity_PlaySome() now takes three arguments. A MidiSong, a decode
    54   buffer and decode buffer size in bytes. (MidiSong is a new argument,
    55   and buffer size used to be in samples.)
    57   In addition, it will return the number of bytes decoded.
    59 * Added Timidity_Exit().
    61 * Removed Timidity_Stop() and Timidity_Active(). Stopping playback
    62   should be handled by SDL_sound, and Timidity_PlaySome() will return
    63   0 when the MIDI stream is finished.
    65 * Modified the ToneBank stuff to allow some data to be shared between
    66   MidiSongs.
    68 * The following files have been removed: controls.c, controls.h,
    69   filter.c, filter.h, sdl_a.c, sdl_c.c
    71 * config.h has been renamed as options.h to avoid confusion with the
    72   automatically generated config.h for SDL_sound.
    74 * Added support for loading DLS format instruments:
    75 	Timidity_LoadDLS(), Timidity_FreeDLS(), Timidity_LoadDLSSong()
    77 * Added Timidity_Init_NoConfig()