FS#6685 - Win32 music driver rewrite

Attached to Project: OpenTTD
Opened by Niels M H (nielsm) - Sunday, 11 March 2018, 15:37 GMT
Type Patch
Category Core
Status New
Assigned To No-one
Operating System Windows
Severity Low
Priority Normal
Reported Version trunk
Due in Version Undecided
Due Date Undecided
Percent Complete 0%
Votes 0
Private No


This is a complete rip-out and rewrite of the Win32 music driver. The current Win32 music driver uses MCI, which is poorly supported on modern Windows versions, and causes large pauses between songs. The DirectMusic driver doesn't have those issues, but it's still a technology marked "deprecated" and not shipped with current Windows SDK versions.

This rewrite implements a lower level driver with a new parser for MIDI files, and manages timing to send the data to the synthesizer in correct order. The MidiFile class implemented is intended to be cross-platform and could be used to implementing similar lower-level playback on other platforms. Handling the raw MIDI data directly should also allow for reading music from other sources than standard MIDI files, e.g. it may allow reading the ROLAND.CAT/GM.CAT files from the DOS version of TTD, to use that as a music source instead.
This task depends upon

Comment by Niels M H (nielsm) - Sunday, 11 March 2018, 15:38 GMT
This depends on the changes in FS#6684, except for the DirectMusic part of the patch.