View Single Post
Old 15 December 2014, 11:59   #2
Toni Wilen
WinUAE developer
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 46
Posts: 24,699
Originally Posted by xxxxx View Post
1. If you are trying to do 14 bit audio (DMA driven, with 2 channels - one at volume 64 and one at volume 1), it's super important that the 2 channels are fully in sync, right?. But is it precise enough to just turn the DMA on for the 2 channels at the same time? Will they be fully in phase? Are there any internal counters to worry about being off?
They should be in phase.

2. Specifically, do each of the channels wait for the DMA to actually return the word before the channel's period counter starts ticking - or do they start simply when the DMA is enabled?
Period counting starts when sample gets moved from AUDxDAT to 8-bit output buffer. "percntrld" in audio state diagram. DMA enable vs first word going to AUDxDAT can take more than 1 scanline.

3. Are there any edge cases to worry about? such as the period of the previous sounds, or at what time the DMA is turned on.
Should not be any. DMA is not 100% directly related to period/volume counting. It is also not possible to "delay" or "miss" some channel's DMA startup by one scanline by writing to DMACON in "bad" horizontal position. (Which would have been really annoying.. Some other DMA channels can have this problem)

5. Writing to AUDxDAT resets the volume counter - is that also true in DMA driven audio whenever the DMA delivers a new word? if so, should the period be a multiple of 64 for a volume of 1 to actually be 1/64th of the volume of 64? Or, put another way, if you put the period as 129, would it be on 3 of every 129 cycles (on for 1 cycle, off for 63, on for 1, off for 63, on for 1, repeat) rather than 1 of every 64 cycles (on for 1 cycle, off for 63, repeat)
According to audio state diagram it is only reset when first DMA word or CPU word comes. ("volcntrld" in audio state diagram). And I think I confirmed this in my oscilloscope tests some time ago.

Audio state diagram in HRM explains nearly everything, it really only lacks description of Agnus/Paula DMA request interface.
Toni Wilen is offline  
Page generated in 0.04191 seconds with 10 queries