SMrecord
Previous Topic  Next Topic 

Synopsis:

       SMrecord(vox_chan,filename,[seconds,silence,filetype,sample_rate,beep])

Arguments:

       vox_chan The voice channel        

       filename -  The filename to record to

       [seconds] Optional number of seconds to record (default value is 0 (unlimited)

       [silence] Optional number of seconds of silence to end recording (default is 5 seconds)

       [filetype] -  Optional file type to record to (default is SMDataFormatOKIADPCM)

       [sample_rate] -  Optional sample rate (default is 6000)

       

Description:  This function records to the given filename on the specified vox_chan.      The number of seconds to record can be specified as an optional argument.   If seconds is omitted or set to 0 then the recording will continue indefinitely until one of the other terminating events is received.        


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 recording 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,    or the maximum number of seconds has been reached or the maximum duration of silence has been detected etc


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_TIMEOUT     = 3;

const TERM_SILENCE     = 5;

const TERM_ABORT       = 6;


(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.