|
Atari demoscene BBS
Re: Devpac-3 Including files Help |
Posted by: ggn
|
Jun,14.2012-08:59
|
Ah, the joys of the STE's DMA :)
To answer your questions briefly:
- It's easy to play 2 channels at once, just have the left channel play one sample and the right channel another. I.e. you can interleave 2 samples so that the resulting sample's even bytes have the first sample and the odd ones the second.
- For more than 2 channels you have to start mixing. If you mix 2 samples just by adding their bytes together you will overflow (adding 2 8-bit numbers will at worst result in a 9-bit number). So you need to shift right the samples before adding them. So you can play 2 channels in each channel (using the 2 methods above) to get a total of 4 channels. For 8 channels, just shift right 2 times, etc.
- About playing a sample faster/slower: you have to do what sample editors do when they change pitch, i.e. stretch or shrink the sample to reach the frequency required. Is the DMA set to play samples at 12517hz and you want to replay at 8000hz? Then you have to shrink your sample by a factor of 1.564625 (or roughly every 2 bytes skip one if my maths haven't failed me epically).
And there you have it, the basic principles upon all st/ste tracker replay routines are based. If you want to see some implementations just head over to http://dhs.nu/files.php?t=democreation, although be warned - it's not for the faint of heart :)
|
[All messages in this thread] [Start new thread]
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.
|