Page 1 of 1

Audio channels

PostPosted: Wed Jan 30, 2019 10:57 am
by Ian
Mostly just thoughts since really I've never looked at the audio emulation. Currently it's a giant black box
But in the audio in sega rally 2 has some serious issues lol
The issue is, two separate tracks have been encoded in the left/right audio, and the system is choosing to just mirror one channel to the other.
Where would we even look to find out how its selecting this? There must be some register or something somewhere

Re: Audio channels

PostPosted: Wed Jan 30, 2019 4:14 pm
by Bart
Audio emulation is held together with duct tape and glue :) For MPEG music, the DSB code is where you'll want to look, specifically CDSB2 for Sega Rally 2. The DSB classes actually perform their own mixing and re-sampling, so if the setting for channel selection is discovered, it should be pretty straightforward to fix. R. Belmont originally reverse engineered the DSB far enough to allow music to be played. You'll see a big switch statement that handles commands written by the DSB's processor (a Z80 for DSB1 and 68K for DSB2) to some hardware port. There is little rhyme or reason to how the commands appear structured and the assumption is that they form some sort of state machine. This state machine is where you'll want to poke around. It's pretty easy to break some obscure thing in a game (pay attention to things like volume fades). There are definitely un-handled or maybe even mis-handled commands. I suspect that for the offending music tracks (title + last stage) in srally2, some command is first sent that configures the channels. You'll definitely want to look at what happens during transitions from stereo tracks to the broken ones as well as the reverse transition. If there's a sound test menu, I'd start there.

Re: Audio channels

PostPosted: Wed Jan 30, 2019 5:19 pm
by Ian
Does mame have audio code for this we can look at / borrow ?

Edit, this looks like it ..

https://github.com/mamedev/mame/blob/ma ... 0.cpp#L232

I think

Re: Audio channels

PostPosted: Wed Jan 30, 2019 5:28 pm
by Bart
I haven't looked at MAME in ages. Does it support DSB board emulation or do they have an MPEG decoder we can replace the current one with? If so, it's worth a look. As far as the underlying audio buffering code in the Src/OSD directory, it's actually pretty good.

Re: Audio channels

PostPosted: Wed Jan 30, 2019 5:41 pm
by Ian

Re: Audio channels

PostPosted: Wed Jan 30, 2019 11:41 pm
by Bart
Yes but for the 68K-based DSB2, which I don't see. I wonder if the DSB1 was used in something besides Model 3 because on Model 3, only Scud Race uses it and I don't recall any broken stereo.

Re: Audio channels

PostPosted: Thu Jan 31, 2019 12:43 am
by Spindizzi
hi,
I know the soundboard part needs to be rewritten, but the solution I made years ago, works not so badly
http://www.supermodel3.com/Forum/viewtopic.php?f=7&t=1282

I can push it, if Bart agrees

Re: Audio channels

PostPosted: Thu Jan 31, 2019 11:42 pm
by Bart
Oh! I completely forgot about that. Email me the changed file. The link in that thread isn't working for me.