17.01.2013 Views

AmstradCPC6128-hypertext-en-Sinewalker

AmstradCPC6128-hypertext-en-Sinewalker

AmstradCPC6128-hypertext-en-Sinewalker

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

The sounds that you might expect from these SOU N D commands are not produced<br />

until the first RE LEA S E command which allows the sounds on channels A and B to<br />

play. After the delay, the sound on channel C is RE LEA SEd.<br />

There is yet another method by which more than one sound can be made to<br />

r<strong>en</strong>dezvous. Wh<strong>en</strong> a sound is added to a queue that has the hold bit set (64 added),<br />

th<strong>en</strong> it is not just that sound which is held, but all subsequ<strong>en</strong>t sounds s<strong>en</strong>t to that<br />

queue. If more than four further sounds are s<strong>en</strong>t to the held queue, th<strong>en</strong> the machine<br />

will pause until the queue is released, perhaps by using a sub-routine that is called<br />

after a fixed period of time (using AFT E R or EVE RY). However this is not a<br />

particularly good method for using the sound system, as the program that contains<br />

the sound commands may pause from time to time as the sound queues fill up. This is<br />

also true if a lot oflong sounds are added in quick succession. Try this:<br />

10 FOR a=1 TO 8<br />

20 SOUND 1,100*a,200<br />

30 NEXT<br />

40 PRINT "heLLo"<br />

run<br />

You will notice that the word 'h ell 0' does not appear instantly, but only after the<br />

first three sounds. This is because program execution cannot continue until there is a<br />

free space in the queue.<br />

The BASIC contains an interrupt mechanism, rather like that used in the AFT E R<br />

and EVE R Y commands, and in 0 N B REA K G 0 SUB. This <strong>en</strong>ables you to specify a<br />

sound playing sub-routine that is only called wh<strong>en</strong> a free space appears in the<br />

required queue. Try this:<br />

10 a=0<br />

20 ON SQ(1) GOSUB 1000<br />

30 PRINT a;<br />

40 GOTO 30<br />

1000 a=a+10<br />

1010 SOUND 1,a,200<br />

1020 IF a

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!