SAM SWAP
instruction: activate sample-switching
Sam Swap voices To address,length
The SAM SWAP command activates the automatic sound-swapping system. It specifies the location and size of a logical sample which has been loaded previously with the SLOAD instruction. The sample will be played through loudspeakers the instant that the current physical sample runs out of data.
The voices parameter is a bit-pattern that defines which voices are to be used for playing the sample. Each bit in this pattern sets the swapping on a particular voice, according to the following format:
Voice 3210 Bitmap %1111
The address parameter gives the address of the next logical sample in memory. This address must be in CHIP Ram. Length is simply the number of bytes to be played of the new section of sample.
It is essential to note that SAM SWAP only works with an existing sample. It does not actually play a sample through a loudspeaker. Therefore, it has to be initialised by a SAM RAW command before it can be used, which will start off the physical sample and set up the playback speed for the entire sample of sound. For example:
X> Sam Raw %0011,Start(5),20000,12000 : Rem 12000 is the playback speed Rem Swap the samples assigned to voices 0 and 1 using data in bank 6 Sam Swap %0011,Start(6),20000 : Rem 20000 is the length of logical sample
SAM SWAPPED
function: test for successful sample swap
value=Sam Swapped(voice number)
Use the SAM SWAPPED function to test the specified voice to see if the logical and physical samples have been exchanged by a SAM SWAP command. The voice number is a value from zero to 3, and if the sample is being played on a number of voices simultaneously, any of those voice numbers can be used.
SAM SWAPPED will make a report by giving one of the following three values:
-1 means that the previous physical sample has finished playing, and the samples have been successfully swapped. It is now time to load a new sample into the logical memory bank, and call the SAM SWAP command again. Please note that this value is also returned after a normal SAM RAW command has finished playing a sample.
Zero means that the physical sample is currently being played, and there is a fresh logical