VOGONS

Common searches


First post, by Dee-Dee

User metadata
Rank Newbie
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)

Reply 1 of 34, by UCyborg

User metadata
Rank Member
Rank
Member

There is another bug that exists in all OS from 10 down to XP, possibly on older systems as well. If you pause CD playback via MCI then query its status, you'll get back "stopped" instead of "paused".

DxWnd emulates the bug by default, but has an option to enable proper behavior - "Emulate CD pause capability".

Arthur Schopenhauer wrote:

A man can be himself only so long as he is alone; and if he does not love solitude, he will not love freedom; for it is only when he is alone that he is really free.

Reply 2 of 34, by ZellSF

User metadata
Rank l33t
Rank
l33t

I'm not sure the rare cases of games that rely on proper MCI_NOTIFY_SUCCESSFUL handling warrants an information topic. I don't think I've run into a single one.

CD audio wrapping solutions in general though, sure.

I don't have much to add, except I think Peixoto's patches is its own implementation and might cover some cases the others don't? I've never used it personally because it requires files to be ripped in a different fashion than all the others.

Reply 3 of 34, by Dee-Dee

User metadata
Rank Newbie
Rank
Newbie
UCyborg wrote on 2020-08-19, 20:08:

There is another bug that exists in all OS from 10 down to XP, possibly on older systems as well. If you pause CD playback via MCI then query its status, you'll get back "stopped" instead of "paused".

DxWnd emulates the bug by default, but has an option to enable proper behavior - "Emulate CD pause capability".

It has worked that way since Win9x so if it is a bug it is a really old one. In any case it seems to have no practical effect since after MCI_PAUSE the music can be resumed from where it left with the following MCI_PLAY command. The fact that the mode says "stopped" instead of really being "paused" may indeed be an oversight but the logic seems to work otherwise.

Reply 4 of 34, by Dee-Dee

User metadata
Rank Newbie
Rank
Newbie

@ZellSF

The point here is to try and document the reasons why MCI cdaudio no longer functions poperly on modern Windows systems. I am well aware that many games work fine with less than perfect cdaudio emulation.

Reply 5 of 34, by Dee-Dee

User metadata
Rank Newbie
Rank
Newbie

I also ran some debugger sessions on mcicda.dll to compare the behavior of WinXP to more recent Windows versions. With some breakpoints one can see that on WinXP the loop seems to be working as intended but on later Windows versions there is a sizable part of the code that never gets called due to an unsatisfied JMP condition. I could manually force the notify message with a temporary NOP but that is as far as I could get. There may be some missing logic.

The source code for the Wine implementation of mcicda.dll is available here:
https://github.com/wine-mirror/wine/blob/mast … mcicda/mcicda.c

As can be seen in the comments the Wine team was also aware of the issue:

A design bug in native: the independent CD player called by the MCI has no means to signal end of playing, therefore the MCI not […]
Show full quote

A design bug in native: the independent CD player called by the
MCI has no means to signal end of playing, therefore the MCI
notification is left hanging. MCI_NOTIFY_SUPERSEDED will be
signaled by the next command that has MCI_NOTIFY set (or
MCI_NOTIFY_ABORTED for MCI_PLAY).

Wine team of course aims for as close to native Windows imitation as possible bugs and all. But a custom build of mcicda.dll could be handy. Furthermore older versions of Wine mcicda.dll do not emulate the bug.

I suppose Microsoft might also release their source code for MCI someday seeing as they are into open source nowadays...

Reply 6 of 34, by Falcosoft

User metadata
Rank Oldbie
Rank
Oldbie

I think I was the first who reported this problem to Microsoft more than 13 years ago:
https://social.msdn.microsoft.com/Forums/wind … udiodevelopment

The first response was from an MS developer. Something like this: "Nothing has changed and everything should work the same way. But I will have a look at the problem". Then the thread has never ever been updated by anyone from MS. And at some point the whole thread has become a general topic about anything MCI related so there is no reason to hope anymore 😀

Website, Facebook, Youtube
Falcosoft Soundfont Midi Player + Munt VSTi + BassMidi VSTi
VST Midi Driver Midi Mapper

Reply 7 of 34, by DosFreak

User metadata
Rank l33t++
Rank
l33t++
Falcosoft wrote on 2020-08-20, 17:42:

I think I was the first who reported this problem to Microsoft more than 13 years ago:
https://social.msdn.microsoft.com/Forums/wind … udiodevelopment

The first response was from an MS developer. Something like this: "Nothing has changed and everything should work the same way. But I will have a look at the problem". Then the thread has never ever been updated by anyone from MS. And at some point the whole thread has become a general topic about anything MCI related so there is no reason to hope anymore 😀

Complain on the twitters and then send to various news sites. Something like ms broke cd audio and doesn't give a crap, ms becoming apple, etc. Also win 10 worse for games. That should do it

How To Ask Questions The Smart Way
Make your games work offline

Reply 8 of 34, by Falcosoft

User metadata
Rank Oldbie
Rank
Oldbie
DosFreak wrote on 2020-08-20, 18:09:

Complain on the twitters and then send to various news sites. Something like ms broke cd audio and doesn't give a crap, ms becoming apple, etc. Also win 10 worse for games. That should do it

Emphasis was on 'more than 13 years ago'. It's just a historical anecdote... Yours would have been a bad advice even if sent from the future since twitter did not exist then.

Website, Facebook, Youtube
Falcosoft Soundfont Midi Player + Munt VSTi + BassMidi VSTi
VST Midi Driver Midi Mapper

Reply 9 of 34, by DosFreak

User metadata
Rank l33t++
Rank
l33t++

It's still broken is it not? You get the point. Either go through official channels and report the issue correctly or use the hysteria method which appears to be more effective.

How To Ask Questions The Smart Way
Make your games work offline

Reply 10 of 34, by Falcosoft

User metadata
Rank Oldbie
Rank
Oldbie
DosFreak wrote on 2020-08-20, 18:44:

It's still broken is it not? You get the point. Either go through official channels and report the issue correctly or use the hysteria method which appears to be more effective.

Have you seen the link where I reported the issue then? It was the 'Windows Desktop Pro-Audio Application Development' forum on MSDN led by Larry Osterman who with his team implemented the new Vista audio stack back then. Please , name me the more 'official channel' where it should have been reported to correctly...

It was an important issue for me back then, but time goes on. I tried what I could. I even sent them test programs, but never got a response.

Website, Facebook, Youtube
Falcosoft Soundfont Midi Player + Munt VSTi + BassMidi VSTi
VST Midi Driver Midi Mapper

Reply 11 of 34, by Falcosoft

User metadata
Rank Oldbie
Rank
Oldbie
DosFreak wrote on 2020-08-20, 18:44:

It's still broken is it not? You get the point. Either go through official channels and report the issue correctly or use the hysteria method which appears to be more effective.

BTW Please, can we finish this? Don't you feel a little controversial that you (as a forum moderator) are spamming this topic with your irrelevant personal remarks?
(I put this line into new post since I think this post will/should be removed later)

Website, Facebook, Youtube
Falcosoft Soundfont Midi Player + Munt VSTi + BassMidi VSTi
VST Midi Driver Midi Mapper

Reply 12 of 34, by DosFreak

User metadata
Rank l33t++
Rank
l33t++

Nothing has been spammed. I can see you getting butthurt for some unknown reason. There were no personal remarks, if you took them that way then that's your problem.

For Vista IIRC there were MS webpages where you could submit issues.
For Windows 10 use the Feedback Hub if no results then use the hysteria method.

How To Ask Questions The Smart Way
Make your games work offline

Reply 13 of 34, by Falcosoft

User metadata
Rank Oldbie
Rank
Oldbie
DosFreak wrote on 2020-08-20, 19:58:

Nothing has been spammed. I can see you getting butthurt for some unknown reason. There were no personal remarks, if you took them that way then that's your problem.

For Vista IIRC there were MS webpages where you could submit issues.
For Windows 10 use the Feedback Hub if no results then use the hysteria method.

OK, thanks. I really sorry I can't travel back in time since with your valuable help this problem would have been solved easily. In Vista times there were MS webpages. How I wish I had known that. And also that MSDN was just a fake one...

Website, Facebook, Youtube
Falcosoft Soundfont Midi Player + Munt VSTi + BassMidi VSTi
VST Midi Driver Midi Mapper

Reply 15 of 34, by UCyborg

User metadata
Rank Member
Rank
Member
Dee-Dee wrote on 2020-08-20, 14:50:
UCyborg wrote on 2020-08-19, 20:08:

There is another bug that exists in all OS from 10 down to XP, possibly on older systems as well. If you pause CD playback via MCI then query its status, you'll get back "stopped" instead of "paused".

DxWnd emulates the bug by default, but has an option to enable proper behavior - "Emulate CD pause capability".

It has worked that way since Win9x so if it is a bug it is a really old one. In any case it seems to have no practical effect since after MCI_PAUSE the music can be resumed from where it left with the following MCI_PLAY command. The fact that the mode says "stopped" instead of really being "paused" may indeed be an oversight but the logic seems to work otherwise.

Interstate '76 relies on those queries returning correct state, otherwise, if you tab-out then back in, playback restarts from the beginning instead of resuming. This game starts playback from mission specific track to the last. Status is periodically queried during gameplay and actions are taken as needed.

I suspected the mentioned bug exists in Win9x, I just have no way to verify, so I said "possibly". Is there a PC emulator that lets you mount real CD images, not just ISOs?

Arthur Schopenhauer wrote:

A man can be himself only so long as he is alone; and if he does not love solitude, he will not love freedom; for it is only when he is alone that he is really free.

Reply 16 of 34, by Dee-Dee

User metadata
Rank Newbie
Rank
Newbie
UCyborg wrote on 2020-08-22, 06:54:

I suspected the mentioned bug exists in Win9x, I just have no way to verify, so I said "possibly". Is there a PC emulator that lets you mount real CD images, not just ISOs?

I used a physical disc together with PCem and the MCI Command String Tester by Charles Petzold.

Reply 17 of 34, by Dee-Dee

User metadata
Rank Newbie
Rank
Newbie

Dxwnd's help pages point to a possible hardware difference. E.g. some CD drives supported the returning of a "paused" state. I could not find the MSDN source for this information though.

I would think that pausing happens in software. That is MCI_PAUSE is the same as MCI_STOP with the exception that MCI_PAUSE command also stores the position so that playback can be resumed later. But who knows maybe a hardware pause mode also exists...

Reply 18 of 34, by Peixoto

User metadata
Rank Member
Rank
Member
Dee-Dee wrote on 2020-08-20, 14:54:

@ZellSF

The point here is to try and document the reasons why MCI cdaudio no longer functions poperly on modern Windows systems. I am well aware that many games work fine with less than perfect cdaudio emulation.

On the MCI api, when a program calls mciSendCommand, there is the MCI_NOTIFY flag, which means that the MCI device (the cd player in this case) must send a MM_MCINOTIFY message to the program window when the command finishes.
Most games use this message to play a track again after it finishes and keep looping. The problem today is that windows doesn't send this message anymore.

On my system, using virtual clone drive or daemon tools, windows emulates MCI CD playback using the waveout api, but i don't if a MCI driver interface is supported and MCI functions correctly with a real CD drive

Another problem with the windows emulation scheme is that sending the MCI_CLOSE command stops the playback, but it shouldn't. That is why the CD music on shadows of the empire doesn't play at all

Reply 19 of 34, by Dee-Dee

User metadata
Rank Newbie
Rank
Newbie

Regarding MCI_CLOSE:

On Win9x you could call MCI_CLOSE and the following MCI_PLAY or MCI_STOP would still work. Exception would be if you used the alias in which case you would need to re-open the device with the same alias to gain access to it.

On WinXP things took a turn to the worse as MCI_CLOSE would make it impossible to issue following commands until the device had finished it's previous task. For example if this was MCI_PLAY there would be no way to stop the playback other than ejecting the disc or waiting the track to finish.

On Vista and above they fixed this by making sure MCI_CLOSE would also interrupt the task of the cdaudio device. This was a definite improvement over WinXP but of course not the same behavior as Win9x and therefore breaks compatibility with older software that used MCI_CLOSE after MCI_PLAY.

In terms of cdaudio emulation one can usually ignore the MCI_CLOSE with the possible exception that MCI_CLOSE does reset the time format.