Sound

Availability All terminals
Description This function sounds one tone or a sequence of tones.
Syntax void Sound( int time, int vol, ..., 0 );
Arguments
int time
The parameter time defines the time of each tone, in steps of 20 milliseconds. For example, time = 50 is one second. The following constants are defined:
TCLICK Duration of 20 msec.
TSHORT Duration of 60 msec.
TSTANDARD Duration of 100 msec.
TLONG Duration of 200 msec.
TVLONG Duration of 400 msec.
int vol
The parameter vol specifies the volume. The following values are possible:
VOFF Turn buzzer off
VLOW Low volume.
VSTANDARD Standard volume.
VMEDIUM Medium volume.
VHIGH High volume.
VSYSTEM System volume set by Menu-labels and SystemSetting(); default is VHIGH, which is SystemSetting("T0")
..., 0
The last argument "... , 0" contains a sequence of at most 15 tones. The last tone should always be the value zero. Each tone can have one of the following values:
SERROR Very low error sound.
SLOW Low sound.
SMEDIUM Medium sound.
SHIGH High sound.
SPAUSE Pause of 100 msec.
Returns None
Remarks Program execution will continue while generating the sound sequence. If you want to execute multiple calls to Sound() consecutively, or want to wait till the sound is played, use the Delay() function.
(It is also possible to use the function IsBuzzerOn() to check whether the buzzer is still busy playing a previous sound or not.)
Example
#include <stdio.h>
#include "lib.h"

void main( void )
{
    for(;;)
    {
        Sound(TCLICK, VHIGH, SERROR, SPAUSE, SLOW, SPAUSE, SMEDIUM, SPAUSE, SHIGH,0);
        Delay(200);   // Wait 4 sec
        Sound(TSTANDARD, VMEDIUM, SERROR, SPAUSE, SLOW, SPAUSE, SMEDIUM, SPAUSE, SHIGH,0);
        Delay(200);
        Sound(TLONG, VLOW, SERROR, SPAUSE, SLOW, SPAUSE, SMEDIUM, SPAUSE, SHIGH,0);
        Delay(200);
        Sound(TVLONG, VSYSTEM, SERROR, SPAUSE, SLOW, SPAUSE, SMEDIUM, SPAUSE, SHIGH, 0);
        Delay(200);
    }
}