Moderators: simonsunnyboy, Mug UK, Zorro 2, Moderator Team
SETUP: INLINE sam_play%,2662
sample (L) start address of sample
length (L) length of sample
frequency (W) playback frequency 2500-16000Hz
loop (W) 0=play once, 1=repeat sample
play (L) 0=not playing, otherwise address of current sample
SAM_PLAY is used to play samples. The first time the command is called
the interrupt Timer A is set up, each successive call will only change
the sample pointers without having to reinitialise Timer A. While a
sample is playing the rest of the program will continue to run, but if
you wish to halt the program until the sample has finished then use
SAM_WAIT. This is the newest version of the sample player which allows
you to specify exactly what speed the playback should be for accurate
control instead of the old table of fixed playback speeds.
When the samples have been finished with or the program has finished
then you must use SAM_STOP to stop the interrupt otherwise the program
will be likely to crash on exit.
This sample player plays signed samples, if a sample sounds terrible on
playback it is probably an unsigned sample. Use SAM_CONVERT to convert
from one format to the other.
This version of the sample player uses less processor time than the
original and so gives more time for the processor to execute your own
code. It does have one disadvantage though, the routine will overshoot
the end of the sample, from between 50 to 300 bytes* (depending on
playback frequency). This may result in the sample 'clicking' when it
has finished. To solve the problem you can either make sure that zeroes
follow the sample, or tell the sample player that the sample is a 100
bytes or so shorter in length.
* The maximum number of bytes that a sample can overshoot by is
By using the SAM_PLAYING command it is possible to see what sample is
currently playing. A value of zero is returned if no sample is playing,
otherwise the first address of the sample playing is returned.
It is actually possible to play samples AND have border removal, but
not with this routine. You will need to use SAMPLAY+ which is not only
compatible with the border removal but also uses slightly less
processor time, so even if you aren't using border removal but wish to
squeeze some more CPU time out of the computer then this is the command
lp wrote:Another options is GFA's built in commands for playing samples. You need a DMA sound equipped machine, like an STE or TT. Have a look at the commands DAMCONTROL and DMASOUND. The only catch is the samples must be in a format compatible with the DMA sound hardware.
BoNuS wrote:The sample routine works okay for me but in the end I end up with a beeeeep
which stay on until I click a key or the mouse button. Haven't really sorted it out
indepth but might just be my fault...
simonsunnyboy wrote:I normally have DMA sound samples and SNDH music on STE and Falcon.
It is pretty obvious that running both a STFM sample player and concurrent SNDH will interfere. The sample will update the Ym registers with several 6kHz but the SNDH mostly with 200Hz or slower (so in the best case the music will be lost).
How about a configurable option:
STF: either music OR samples
STE/Falcon: music OR musics and samples via DMA
Users browsing this forum: CommonCrawl [Bot] and 2 guests