PCEngineFans.com - The PC Engine and TurboGrafx-16 Community Forum
Tech and Homebrew => Turbo/PCE Game/Tool Development => Topic started by: nodtveidt on June 11, 2016, 02:01:26 AM
-
Been looking for documentation on this but haven't found much. Anyway, what I need to know is how many cycles need to pass between stopping ADPCM playback and starting a new one. They can't be used back-to-back on real hardware (works fine on emulators, naturally), so there is clearly some kind of latency issue I need to take into consideration. I can't test this for real as I don't have real hardware at the moment, so I figured one of y'all might know how much time I need to let pass before telling the ADPCM circuit to play another sample.
-
i think the delay is short, may be less than 80 cycles .
-
According to the dev manual; "AD_STOP: Stop ADPCM playback. Since playback speed is about 16khz, a delay will occur before stopping. Check stop status through AD_STAT."
Is this what you're doing? Polling AD_STAT call until clear to start another sample?
-
According to the dev manual; "AD_STOP: Stop ADPCM playback. Since playback speed is about 16khz, a delay will occur before stopping. Check stop status through AD_STAT."
Is this what you're doing? Polling AD_STAT call until clear to start another sample?
Actually, I was originally doing it the other way around, since I had no access to any kind of proper documentation. So basically I should use AD_STOP, and then poll AD_STAT until it returns a clear status. :D
-
That's what I've done. But.. might be a good idea to do a time out part of the loop, just in case for some reason response time/state is stuck(?). And try it next frame, if it falted out on the initial time out? Maybe I'm just paranoid, but I've seen CD games stall before.. I always wondered if it was cause of case scenarios the programmers didn't account for. Better to have a skipped or delayed sample, than a game lock.
-
or call AD_STOP, and check AD_STAT before you play the new sample.
(ie, if( AD_STAT() == 0 ) { play sample }
FWIW, AD_STAT() check one of the adpcm registers, and returns it in X, iirc.
-
Like oldman said, why you don't use ad_stat ??
I didn't understand your question the first time i read,i thought you want to know how many cycles takes to stop an old adpcm sample and start a new one,and not the delay between the two.
ad_stat return 1, when a sample is running,so you only wait while ad_stat = 1 before starting a new one,because in cycles you can not answer to that question , because it depends on where you are in your sample,and sample's lenght .