First post, by Dee-Dee
- Rank
- Newbie
Nothing really new here but I thought a more detailed summary of this issue could be useful for general reference here on VOGONS.
Starting with Windows Vista and continuing to the present day and Windows 10 there is an issue with cdaudio playback using the "Media Control Interface" where the tracks do not repeat. The way many old games used MCI was to issue a call to "PLAY_MCI" with "MM_NOTIFY". This sequence of commands meant that when the playback finished a message was sent to notify the program that it should issue a new PLAY command to repeat the track if needed. However starting with Windows Vista that MCI_NOTIFY_SUCCESSFUL message never gets send and the program assumes that the track is still playing.
It is difficult to say whether this is a bug or intended behavior but for example the MSDN documents seem to mention nothing special and imply that MM_NOTIFY should work as before. In addition it is difficult to say what exactly goes wrong. Using an MCI tester program one can see that the "MODE" never gets updated either and stays at "PLAYING" even when the track has clearly finished. So possibly the bug is in the loop that updates the MODE for cdaudio.
mcicda.dll seems to be the driver that controls cdaudio music playback and indeed experimenting with the dll from Windows XP I saw that the notify message gets posted in the message queue. So this leads me to assume that the bug resides in that dll. (You can't fix cdaudio using that old dll on a modern system since the mixer has also changed and you get no audio output.) Note that MCI also handles other forms of multimedia and each have their own drivers (mciseg.dll for MIDI, mciwave.dll for .wav, etc...) However it seems that the notify message does still work with these other formats.
The workaround for this issue is to use a winmm wrapper that redirects the cdaudio to use digital music files on the hard disk. There are a number of different wrappers out there including _inmm, ogg-winmm, and various closed source wrappers included with GOG games. However the best general cdaudio emulation and the only one that properly handles the notify message (as of writing this) seems to be with the Dxwnd program or it's stand alone cdaudio proxy. Note that most other wrappers simply repeat the track without handling the notify message. Although this works in many cases some games do require the message to function properly.
For the programmers wanting to use MCI for cdaudio today (and you probably shouldn't) you would need to work past the broken notify command. A way to do this is to monitor the MODE and POSITION of the track being played. If the MODE is PLAYING and the POSITION does not change then we can assume that the track has finished playing. Although it is worth noting that the MCI interface is deprecated and could be removed altogether at some point.
Some reading regarding the MCI:
https://en.wikipedia.org/wiki/Media_Control_Interface
https://docs.microsoft.com/en-us/windows/win3 … imedia/mci-play
https://docs.microsoft.com/en-us/windows/win3 … ia/mm-mcinotify
https://docs.microsoft.com/en-us/windows/win3 … pact-disc-track
https://docs.microsoft.com/en-us/windows/win3 … the-notify-flag
cdaudio wrappers:
https://github.com/hifi-unmaintained/ogg-winmm
(and it's various forks)
https://sourceforge.net/projects/dxwnd/
(the main program that includes cdaudio emulation)
https://sourceforge.net/projects/cdaudio-proxy/
(the stand alone cdaudio wrapper based on dxwnd)