int sm_record_start(struct sm_record_parms *recordp)
typedef struct sm_record_parms {
tSMChannelId channel; /* in */
tSMChannelId alt_data_source; /* in */
enum kSMDataFormat type; /* in */
/* Only in Prosody version 1 */
enum kSMDRecordElimination {
kSMDRecordNoElimination,
kSMDRecordSilenceElimination,
kSMDRecordToneElimination,
} elimination; /* in */
/* End of part only in Prosody version 1 */
/* Only in Prosody version 2 (TiNG) */
tSM_UT32 silence_elimination; /* in */
enum kSMToneDetection tone_elimination_mode; /* in */
tSM_UT32 tone_elimination_set_id; /* in */
/* End of part only in Prosody version 2 (TiNG) */
tSM_UT32 max_octets; /* in */
tSM_UT32 max_elapsed_time; /* in */
tSM_UT32 max_silence; /* in */
tSM_INT agc; /* in */
tSM_INT volume; /* in */
enum kSMRecordAltSource {
kSMRecordAltSourceDefault,
kSMRecordAltSourceInput,
kSMRecordAltSourceOutput,
} alt_data_source_type; /* in */
/* Only in Prosody version 2 (TiNG) */
tSM_UT32 sampling_rate; /* in */
double min_noise_level; /* in */
double grunt_threshold; /* in */
/* End of part only in Prosody version 2 (TiNG) */
} SM_RECORD_PARMS;
This call starts a new recording job using the specified
channel.
Normally
alt_data_source
is set to kSMNullChannelId and the data that will
be recorded will be that switched to this input channel. If
however
alt_data_source
is set to the channel id of another existing channel, then the
data source for the recording will be determined by the value of
alt_data_source_type.
Note that the channel specified in
alt_data_source
must not be reconfigured while this recording is in progress.
The PCM data received will be encoded into buffers in the format specified by the type parameter which is a value from same range of values permitted in the type parameter of sm_replay_start().
Note that, for compatibility with earlier releases of Prosody, many other values are permitted for the type field. These compatibility values specify a combination of data type and sampling rate. When one of these is used in the type field, the sampling_rate field must be zero, and the actual rate used will be as listed here. They are:
| compatibility code | new code | |
|---|---|---|
| type | sampling rate | |
| kSMDataFormat8KHzALawPCM | kSMDataFormatALawPCM | 8000 |
| kSMDataFormat8KHzULawPCM | kSMDataFormatULawPCM | 8000 |
| kSMDataFormat8KHzOKIADPCM | kSMDataFormatOKIADPCM | 8000 |
| kSMDataFormat8KHzACUBLKPCM | kSMDataFormatACUBLKPCM | 8000 |
| kSMDataFormat6KHzALawPCM | kSMDataFormatALawPCM | 6000 |
| kSMDataFormat6KHzULawPCM | kSMDataFormatULawPCM | 6000 |
| kSMDataFormat6KHzOKIADPCM | kSMDataFormatOKIADPCM | 6000 |
| kSMDataFormat6KHzACUBLKPCM | kSMDataFormatACUBLKPCM | 6000 |
| kSMDataFormat8KHz16bitMono | kSMDataFormat16bit | 8000 |
| kSMDataFormat8KHz8bitMono | kSMDataFormat8bit | 8000 |
| kSMDataFormat8KHzSigned8bitMono | kSMDataFormatSigned8bit | 8000 |
| kSMDataFormatIMAADPCM | kSMDataFormatIMAADPCM | 8000 |
Only on Prosody version 1:
The only record types supported are those listed as
compatibility codes in the above table with two groups of exceptions.
Firstly, kSMDataFormat8KHz16bitMono and
kSMDataFormat8KHz8bitMono are not supported
(refer to appendix B for the record data formats
supported by each firmware type), and secondly,
an additional pair of type codes are
recognised,
kSMDataFormat8KHzPCM and
kSMDataFormat6KHzPCM
which means that the data should be supplied to
the application PCM encoded in a way compatible with the loaded
firmware, either as
kSMDataFormat8KHzALawPCM
or
kSMDataFormat8KHzULawPCM for 8KHz, or
kSMDataFormat6KHzALawPCM
or
kSMDataFormat6KHzULawPCM for 6KHz.
(Thus if sp30a.smf firmware is loaded, the
data is A-law encoded, while if sp30u.smf firmware is loaded, it
is mu-law encoded).
The sampling rate firmware:
| sampling rate | extra firmware required |
|---|---|
| 8000 | - |
| 6000 | sixkin |
| 11000 | 8_to_11 |
See Prosody application note: speech processing replay and record data formats for more details on data formats supported by Prosody and their appropriate use.
The volume parameter is for reserved future use and must be set to zero.
The
volume
parameter is the change in volume compared to the level of
the data (i.e. set this to -6 to attenuate by
6dB). If AGC and volume are both applied, the change in volume
requested is applied after AGC.
The agc parameter controls whether automatic gain control is applied to the recorded data. If agc is non-zero then automatic gain control is applied. Even if this is the case, the recording level is still governed by volume. The behaviour of the AGC algorithm may be controlled by changing its parameters, see sm_adjust_agc_module_params() for more details.
The recorded data may be retrieved by the application through periodic calls to sm_get_recorded_data(). The amount of data recorded is determined by the termination criteria specified in the parameters:
| max_octets | max octets of data to record, 0 if no limit |
| max_elapsed_time | max recording period in mS, 0 if no limit |
| max_silence | max period of silence in mS before recording terminated, 0 if no limit |
and also by the function sm_record_abort() which will terminate a recording directly.
If an event has been previously associated with a channel (see sm_channel_set_event()), then the driver will notify the application with that event whenever (for that channel):
kSMNullChannelId, or another
channel whose input or output is to be recorded. If this
specifies a channel, that channel must not be reconfigured
while recording is taking place.
0 if call completed successfully, otherwise a standard error such as:
This function is part of the Prosody speech processing API.