Synopsis:
SMplayh(vox_chan,filehandle[bytes,filetype,sample_rate])
Arguments:
vox_chan – The logical voice channel.
filehandle – A file handle returned from a call to sys_fhopen()
[bytes] – Number of bytes to play from the file
[filetype] – The type of voice prompt file to play
[sample_rate] – The sample rate of the voice prompt file.
Description: This function is similar to the SMplay()function except that it takes a file handle as returned from the sys_fhopen() function in the Telecom Engine standard system library (CXSYS.DLL). It is up to the application to open the file first and to ensure that the file handle is released after use.
If the optional argument bytes is specified then the function will terminate with the event TERM_EODATA once the specified number of bytes has been played from the file. If bytes is omitted or set to 0 then the function will continue playing from the file until the end of the file is reached or another terminating event causes the function to finish.
Just as for the SMplay() function the SMplayh() will return the reason for the termination of the function, which will 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)
If the function is playing in blocking mode then a jump to onsignal will cause the playback to be aborted. In non-blocking mode the playback will continue even after a jump to onsignal and it is then up to the application to abort the playback and/or wait for it to complete.
Example:
int fh;
fh=sys_fhopen("HELLO.VOX","rs", SMDataFormatALawPCM,8000);
if(fh < 0)
errlog("Error opening file: err=",fh);
task_hangup(task_getpid());
endif
// If we get here then the file is open so play it
SMplayh(vox_chan,fh,0,);
sys_fhclose(fh);
Returns: Returns either an error code (E.g. invalid file handle) or the reason for the function termination.