A channel to the sound driver can be opened by giving the device name
"SOUND:"
. Any filename or unit number will be ignored and
the open will be rejected (with error code .2NDCH
) if there
is already a channel open to the sound driver.
An EXOS variable BUF_SND
is used to specify how much
storage is required in channel RAM for envelopes and must be set up
before a channel to the sound driver is opened. It is specified in phases
and the sound driver will obtain enough channel RAM to guarantee that the
user can define envelopes with a total of the requested number of phases.
Thus if the user requests 20 phases then he will be able to define one
envelope with 20 phases in it or 20 envelopes each of one phase. Because
of the overhead associated with each envelope, the former case takes up
rather less RAM than the latter, so if 20 phases are requested then
probably more than that number can be defined before storage will be
exhausted since most envelopes have more than one phase. The number of
phases requested can be from 2 to 255.
The sound driver is write only - it will not accept any read function calls. Printing characters are ignored. All the sound functions are controlled by various control codes and escape sequences. It accepts write block function calls, treating them exactly as if the characters had been written with separate write character calls.
The sound driver has an interrupt routine which is entered 50 times per second (once every TV frame). This scans the sound queues and processes any sounds which are waiting or are currently being played. Each 20ms period is called a tick and all timing is in terms of ticks.