Dead Hackers Society
Other BBSes »
 
 
Demoscene  Coding  CT60  Buy/sell

Atari coding BBS
 
Re: STE & Falcon DMA sound
Posted by: dml Feb,06.2015-00:18 

I might have misunderstood what you're doing but I think the fundamental problem there is stopping the DMA at all - it is designed with a FIFO so there are always two buffers with decoupled address update in HW, so joins are seamless.

When a frame ends the HW immediately uses the pending frame addresses, and triggers a TimerA interrupt to let you load a new one in advance for next time. Stopping the DMA breaks this FIFO behaviour on both STE and Falcon (although, sounds like the STE is soaking it up here) so you'll typically get clicks etc. unless you're lucky.

The difficulty with the FIFO is that it wants to act as the master sync controller - telling the CPU when its finished, not the other way around. This makes perfectly timing against VBL difficult - the interrupt event will 'roll' gradually over the VBL. If near-enough is good enough, you don't need sample-byte-perfect timing and can allow TimerA to reload the FIFO at any arbitrary time then you're done.

If you must do it on the VBL, and need to avoid TimerA etc. there are other ways but it will be more complicated.

One way to get around this is to do error correction on the frame size - so you use the VBL as the master sync and load the frame addresses there, but you still use the FIFO and adjust the next frame size by -ve the DMA overrun from the last frame. This keeps the DMA in sync with the VBL.

How you work out the overrun is another matter - maybe reading the DMA counter or using a smaller frame size and counting the number per VBL (if >limit, reduce the next frame by a few bytes, so applying -ve feedback). You can then stream the same block size but its played in smaller sequential pieces for the sake of tracking sync.

I always used TimerA for this in my projects but if you've got other display timing/hardsync stuff going on in a demo its maybe not an option... It's probably worth looking at -ve feedback on the frame size so it tracks VBL closely and doesn't roll.



One very simple hack might be worth trying - set the DMA frame size (8 seconds) to the nearest exact multiple of a VBL period (e.g. if the DMA chucks out almost exactly 200 samples in 1 VBL, set the buffer size to the appropriate multiple of 200 for 8 seconds worth of VBLs), and round up a bit so the controlling VBL always beats it by a handful of samples. This could allow a FIFO reload without turning off DMA. This will only work for a finite time before it rolls over but it might be enough if you get the framesize just right. Also keep in mind that multiplying up (e.g. 200) isn't as accurate as rounding 8s into VBLs and dividing into the replayrate.

I think this would also need a different buffer size for STE and Falcon because the replay rates are not exactly the same (IIRC). That might even by why your current case works on one but not the other - one machine tries to set the FIFO before the 8 seconds elapsed, and one after?


Have fun figuring out a solution :)












[All messages in this thread]    [Start new thread]

Topic Posted by  Date 
STE & Falcon DMA sound defjam Feb,05.2015-21:31
  Re: STE & Falcon DMA sound dml Feb,06.2015-00:18
    Re: STE & Falcon DMA sound mikro Feb,06.2015-09:22
  Re: STE & Falcon DMA sound Mr.Styckx Feb,06.2015-01:04
    Re: STE & Falcon DMA sound gwEm/PHF Feb,06.2015-11:06
    Re: STE & Falcon DMA sound evil Feb,06.2015-22:36
      Re: STE & Falcon DMA sound Mr.Styckx Feb,07.2015-01:43
        Re: STE & Falcon DMA sound Laurent / Thadoss Feb,07.2015-10:40
          Re: STE & Falcon DMA sound Defjam Feb,07.2015-18:00
        Re: STE & Falcon DMA sound Abstract_f Feb,16.2015-15:56
          Re: STE & Falcon DMA sound ggn Feb,16.2015-16:55
            Re: STE & Falcon DMA sound gwEm/PHF Feb,18.2015-11:09
          Re: STE & Falcon DMA sound PeP Feb,17.2015-16:55
            Re: STE & Falcon DMA sound gwEm/PHF Feb,18.2015-11:05


Reply to this message
Name:
Topic:
Anti-troll code:

Message:

What's the anti-troll code?
That's your personal code to be able to add comments and messages on the dhs.nu site.
Don't have a code or forgot it? Fix it here.
© 1994-2024 Dead Hackers Society Contact: Anders Eriksson