Author Topic: ADPCM question....  (Read 439 times)

nodtveidt

  • Guest
ADPCM question....
« 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.

touko

  • Hero Member
  • *****
  • Posts: 953
Re: ADPCM question....
« Reply #1 on: June 11, 2016, 03:10:39 AM »
i think the delay is short, may be less than 80 cycles .

Bonknuts

  • Hero Member
  • *****
  • Posts: 3292
Re: ADPCM question....
« Reply #2 on: June 11, 2016, 04:05:44 AM »
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?

nodtveidt

  • Guest
Re: ADPCM question....
« Reply #3 on: June 11, 2016, 04:04:13 PM »
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

Bonknuts

  • Hero Member
  • *****
  • Posts: 3292
Re: ADPCM question....
« Reply #4 on: June 11, 2016, 04:19:44 PM »
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.

TheOldMan

  • Hero Member
  • *****
  • Posts: 958
Re: ADPCM question....
« Reply #5 on: June 11, 2016, 06:38:29 PM »
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.

touko

  • Hero Member
  • *****
  • Posts: 953
Re: ADPCM question....
« Reply #6 on: June 11, 2016, 10:50:19 PM »
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 .
« Last Edit: June 11, 2016, 11:06:33 PM by touko »