delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/07/01/20:17:33

Message-Id: <199707020017.UAA12879@delorie.com>
Mime-Version: 1.0
Date: Tue, 01 Jul 1997 20:14:28 -0500
To: xorxe AT asturies DOT org
From: Conrad Wei-Li Song <conradsong AT mail DOT utexas DOT edu>
Subject: Re: Sound Programming
Cc: djgpp AT delorie DOT com

At 12:21 PM 6/30/97 +0200, you wrote:
>Maybe you're right... but if the data doesn't fit in one DMA buffer, the
>noises still holds on (with less volume, but they're there), and
>I'm trying to play BIG wav files...
>
Right, which is my point.  Have two DMA buffers.  Fill the first one
and play it.  While the first one is playing fill the second one.
When the first DMA buffer is done play the second DMA buffer and
fill the first one, etc.

>>     2.  It's much faster to reprogram the DMA to a different memory
>>         address than it is to copy the new buffer on top of the old
>>         one.
>I don't think that move 1 kb with a 486 processor would be slow enough
>to cause the noises... and I'm using auto-init mode.
>I tried it with my old 486-33... noise party!  X'D

If you're playing a 44kHz wave (44100Hz) on a 33mHz system then you
have exactly: 33*1024*1024 / 44100 == 784.6 cycles to move in your
1K buffer.  That's not a lot of time, especially when you factor in
some fairly big interrupt overhead (~100 cycles + ~30 cycles for CLI
_minimum_).  Thus you'll have around 600 cycles to transfer 1024
bytes of data.  On a 486 at the best case, this takes ~800 cycles.
In the worst case, this takes ~1000 cycles (not accounting for page
misses!).

Yup, a 486/33 is too slow for a single DMA buffer.  Use two.

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019