summaryrefslogtreecommitdiff
path: root/src/midifile.c
AgeCommit message (Collapse)Author
2015-05-08warnings: fix ".. may be used uninitialized in this function" warningsFabian Greffrath
Actually, it was already impossible for the reported variables to be used uninitialized, because they were all assigned a value by calling ReadByte() and the function would return if that failed. However, the compiler couldn't know about this fact, so we do him the favor and initialized them to 0.
2014-10-14Fix OPL MIDI tempo calculations.Simon Howard
It turns out that the way that tempo has been calculated in OPL playback has been broken for a long time. The mysterious "fudge factor" that I had to apply to tempo calculations is actually completely unnecessary: the byte-swapping in the MIDI_GetFileTimeDivision() function was being done wrong, so the time division being used by the OPL MIDI code was completely wrong. Presumably the multiply by 260 was close enough to an 8-bit bitshift that it worked okayish, but large enough time division values would overflow a single byte and screw up. This fixes long-running OPL playback problems in a number of WADs, most notably Alien Vendetta. This *really* fixes #352.
2014-05-12opl: Handle negative time division values.Simon Howard
A negative time division file indicates the MIDI file uses SMPTE time rather than the normal time system. This is not supported yet, but for the time being, return a sensible time division value that doesn't cause the sound to stutter and the game to become unplayable. This fixes #352, although the affected MIDIs do not yet play properly.
2014-05-05Clean up file headers.Simon Howard
This change rewrites and simplifies the copyright headers at the top of all source files: * Remove "Emacs style mode select" line; this line was included in the headers for the originally released source files and appears to be to set the file type for old versions of Emacs. I'm not sure entirely why it was required but I don't think it is any more. * Remove "You should have received a copy of..." text from copyright header. This refers to the old 59 Temple Place address where the FSF headquarters used to be located and is no longer correct. Rather than change to the new address, just remove the paragraph as it is superfluous anyway. This fixes #311. * Remove ---- separator lines so that the file headers are barer and more simplified.
2014-04-10midifile: Fix portability issue with malloc(0).Simon Howard
In the C standards, malloc(0) may return NULL without indicating a failure to allocate. As values read from the MIDI file may be arbitrary, add one to the allocated length so that we always allocated a positive value. This fixes #165 (thanks nmain).
2013-09-08Merge from trunk.Simon Howard
Subversion-branch: /branches/v2-branch Subversion-revision: 2639
2013-06-19Fix OPL MIDI playback on big endian systems (thanks GhostlyDeath).Simon Howard
Subversion-branch: /trunk/chocolate-doom Subversion-revision: 2607
2010-09-10Post-merge fixes: Created project for OPL library. Fixed OPL library toJames Haley
not use GNU C-isms such as inline keyword, declaration/statement mixing, and strange calling convention syntax for import function pointers. Fixed critical buffer overflow in M_BindChatControls - should be back-merged immediately. Added autogenerated directories *back* to ignore list. Subversion-branch: /branches/strife-branch Subversion-revision: 2052
2010-04-30Merge from trunk.Simon Howard
Subversion-branch: /branches/raven-branch Subversion-revision: 1924
2009-09-01Loop songs (when appropriate)Simon Howard
Subversion-branch: /branches/opl-branch Subversion-revision: 1654
2009-08-30Initial/basic MIDI track playback.Simon Howard
Subversion-branch: /branches/opl-branch Subversion-revision: 1643
2009-08-29MIDI_OpenFile -> MIDI_LoadFile.Simon Howard
Subversion-branch: /branches/opl-branch Subversion-revision: 1639
2009-08-29Rename MIDI_OpenFile to MIDI_LoadFile, remove unneeded structureSimon Howard
packing. Subversion-branch: /branches/opl-branch Subversion-revision: 1636
2009-04-15Parse MIDI events that reuse the event type from the previous event.Simon Howard
Subversion-branch: /branches/opl-branch Subversion-revision: 1499
2009-04-13Extend MIDI file code to support reading multi-track files.Simon Howard
Subversion-branch: /branches/opl-branch Subversion-revision: 1498
2009-04-03Show MIDI event types with string identifiers.Simon Howard
Subversion-branch: /branches/opl-branch Subversion-revision: 1495
2009-04-03Fix up MIDI reading code; add test code.Simon Howard
Subversion-branch: /branches/opl-branch Subversion-revision: 1494
2009-03-29Clean up error messages, minor bugs etc.Simon Howard
Subversion-branch: /branches/opl-branch Subversion-revision: 1492
2009-03-29Parse SysEx, meta eventsSimon Howard
Subversion-branch: /branches/opl-branch Subversion-revision: 1490
2009-03-28Initial MIDI file parsing code.Simon Howard
Subversion-branch: /branches/opl-branch Subversion-revision: 1489