Hey there. I'm the user formerly known as Dorsola, and I just recently got back into playing around with Visual Pinball and VPinMAME. Today, I was trying to play around with the Sound Command Mode feature in VPinMAME and ran into the same problems I hit way back in 2001 when trying to populate sounds.dat with voice clips from games like Doctor Who and Fun House: The Sound Command mode can't access the voice bank in some WPC games.
I don't know if the folks who wrote PinMAME are still around and active, but the SourceForge site says that the best way to get in touch with them is via this forum, so here goes.
In WPC games like Dr. Who, the sound hardware receives single-byte commands to play music. For example:
dw_l2: :00:Reset sound hardware :01:MUSIC: Title Theme :02:MUSIC: Intro/Plunger :03:MUSIC: Plunger :04:MUSIC: Intro end
...etc.
However, to access voice banks, it requires a two-byte command in the form 7aXX - 7a directs the hardware to play a sound at the next byte from an alternate bank. Presumably there are other bank directives as well. For example, from Twilight Zone:
tz_94h: :7a13:"Hi! I'm Talking Tina!" :7a22:"Feel lucky?" :7a44:"Note the hitchhiker..."
I can watch commands like this being played in the "Last Commands" output in Sound Command Mode if I switch to it immediately after a voice clip has started, but I can't play those same commands for Dr. Who in the Command Mode itself. Based on my research, "7a49" should play Davros's clip, "Time Expander restored to Factor 15." But if I type in that command or load it into sounds.dat and play it from there, I instead get a messed-up version of the "Video Mode" music.
I did discover, however, that I can play the Davros clip exactly once if I start VPinMAME and go into the Sound Command mode immediately, while the sound hardware is still initializing. If I execute the two-byte command before the "Ding!" sound that signals the sound board is ready, the Davros clip plays immediately after that ding. Repeating the command results in the Video Mode music again.
This gives me a clue as to what's wrong: I think the sound hardware is expecting the second byte of the command to be delivered much faster than it actually is - in fact, there's evidence that the ROM sends pretty complex command sequences "all at once". But if I chain together multiple "play music/sfx" commands in Sound Commander, I can hear each one being played in rapid succession, slowly enough that I can make out each individual piece. I think that's too slow for what the hardware is expecting.
So, I poked around in the source code and came across this: https://github.com/q.../snd_cmd.c#L387 .
/* currently sending a command ? */ if (locals.cmdIdx > 0) { locals.cmdIdx += 1; if ((locals.cmdIdx % 4) == 2) { /* only send cmd every 4th frame */ if (locals.nextCmd[locals.cmdIdx/4] == -1) locals.cmdIdx = 0; else if (locals.boards == 3) { // if we have 2 sound boards we need to send board no as well sndbrd_manCmd(locals.nextCmd[locals.cmdIdx/4], locals.nextCmd[locals.cmdIdx/4+1]); locals.cmdIdx += 4; } else sndbrd_manCmd(locals.boards - 1, locals.nextCmd[locals.cmdIdx/4]); } }
I believe the sound commander is sending only one byte at a time to the sound hardware every fourth frame (assuming VPinMAME runs at 60 FPS, that means once every 15th of a second), so the 7a "read alternate bank" command isn't properly followed up with the location in that bank, and the hardware either ignores that command or ends up doing something else with it. When the second byte is sent a moment later, it's treated as a separate command, which of course can lead to unexpected results.
This doesn't have any direct impact on normal emulation, but it has meant, for 14 years now, that anyone using the Sound Command Mode to explore WPC ROMs (Pre-DCS) has been unable to browse through the voice sample banks in some games. I don't know why it works in both Creature From the Black Lagoon and Twilight Zone, since those run on the same (or similar) pre-DCS hardware - perhaps their sound boards are willing to wait longer for the alt-bank commands?
I'm not currently equipped to try to fix this - I've forgotten most of what I know about programming in C, and I don't have the compiler tools handy. If someone more experienced is interested in taking a crack at it, I'd be curious to see if we can squash this silly little bug.