Synopsis:
term_code=SMplay(vox_chan,filename[,filetype,sample_rate])
Arguments:
vox_chan – The logical voice channel.
filename – The filename of the voice prompt to play
[filetype] – The type of voice prompt file to play
[sample_rate] – The sample rate of the voice prompt file.
Description: This function plays the speech file specified by filename on the given voice channel. If the filetype and sample_rate are not specified then it is assumed that the file type is SMDataFormatOKIADPCM and the sample rate is 6000.
Otherwise the filetype and samperate can be specifed as described below.
The full list of filetypes as defined in ACULAB.INC is shown below:
# File types for SMplay() etc
const SMDataFormatNone=0;
const SMDataFormatALawPCM=30;
const SMDataFormatULawPCM =31;
const SMDataFormatOKIADPCM =32;
const SMDataFormatACUBLKPCM =33;
const SMDataFormat16bit =34;
const SMDataFormat8bit =35;
const SMDataFormatSigned8bit =36;
const SMDataFormatIMAADPCM =17;
The sample_rate is the sample rate in bits per second of the speech file. The valid sample rates are as follows:
8000 – The typical rate for telephone since it is the rate at which the telephone networks themselves operate.
6000 – A rate which reduces file size at the cost of some quality
11000 – a rate convenient for use with PC soundcards. This is sufficiently close to a quarter of the rate used by CDs and allows almost universal compatibility with cheap PC soundcards which can handle 11025 sampling.
Note that under normal circumstances the Telecom Engine will block the calling task until the playback is terminated by a terminating event of some kind. This may be the presence of a DTMF digit in the DTMF digit buffer for the channel, the end of the file, a call to SMabort() or any other terminating event.
The reason for the function terminating is returned as the return value of the function and may be one of the following values:
# Terminating events
const TERM_ERROR = -1;
const TERM_TONE = 1;
const TERM_ABORT = 6;
const TERM_EODATA = 7;
(see 1.3 Terminating events)
Also whenever a jump to the onsignal function occurs (for example caused by a hangup signal after a call to CCuse()) and if the function is playing in blocking mode (see 1.4 Blocking and non-blocking mode) then the SMplay() will automatically be aborted. If playing in non-blocking mode then it is up to the application to abort the play and/or wait for it to complete.
Returns: Returns either an error code (E.g. if the file could not be opened) or the reason for the function termination.