sample waiting for the automatic switching operation. In this case, there is no need to load any further information into memory.
1 means that the sample player has run out of data, and that the sample swapping operation has failed. You will now need to re-initialise the sample from the beginning, using a SAM RAW command. If this value is repeatedly given, your logical and physical sample banks are probably too small. Try increasing their size to the next sensible value.
The SAM SWAPPED function should be called at regular intervals while the sample is being played. It can be used as part of the main program loop, or called automatically after a set period, using the EVERY command.
Here is a typical listing, that demonstrates how these commands should be used:
X> Reserve As Chip Work 10,10000 Reserve As Chip Work 11,10000 Open In 1, "Dh0:Name_of a_big_sample" L=Lof(1) : C=0 : A=Start(10) Sload 1 To Start(10),10000 : C=C+10000 Sload 1 To Start(11),10000 : C=C+10000 Sam Raw %1111,Start(10),10000,10000 Do Gosub CHECK_SAM If C>L Then Goto FINI Sam Swap %1111 To Start(11),10000 Sload 1 To Start(10),10000 : C=C+10000 Gosub CHECK SAM If C>L Then Goto FINI Sam Swap %1111 To Start(10),10000 : C=C+10000 Sload 1 To Start(11),10000 Loop CHECK_SAM: Repeat A=Sam Swapped(1) Locate 0,0: Print A;" " Until A=-1 Return FINI: Close 1: End