int sm_replay_start(struct sm_replay_parms *replayp)
typedef struct sm_replay_parms {
tSMChannelId channel; /* in */
tSMChannelId background; /* in */
tSM_INT volume; /* in */
tSM_INT agc; /* in */
tSM_INT speed; /* in */
enum kSMDataFormat {
kSMDataFormatNone=0,
kSMDataFormatALawPCM=30,
kSMDataFormatULawPCM=31,
kSMDataFormatOKIADPCM=32,
kSMDataFormatACUBLKPCM=33,
kSMDataFormat16bit=34,
kSMDataFormat8bit=35,
kSMDataFormatSigned8bit=36,
kSMDataFormatIMAADPCM=17,
} type; /* in */
tSM_UT32 data_length; /* in */
/* Only in Prosody version 2 (TiNG) */
tSM_UT32 sampling_rate; /* in */
/* End of part only in Prosody version 2 (TiNG) */
} SM_REPLAY_PARMS;
Prepares output channel channel for replay of data (a replay job).
Normally the
background
parameter would be set to kSMNullChannelId. If
however, this parameter has assigned to it the channel id of
another output channel, then the signal generated on the output
channel
channel
will be combined with the data currently
being output on
background.
Note that a channel must not be reconfigured while it is in
use as a background channel for other channels.
The background signal will continue to be output even when the replay job completes.
To keep a continuous background signal while playing a mixture of different recorded signals and silence, start the replay only once and use sm_put_replay_data() as necessary to feed it data for each signal. To produce silence, simply stop sending data for a suitable period (the channel will report an underrun when it starts sending silence).
The volume parameter determines the gain applied to the replayed data and has a range of -24 to +8 in dB. Only on Prosody version 2 (TiNG): A wider range may be accepted.
The agc parameter controls whether automatic gain control is applied to the replayed data. If agc is non-zero then automatic gain control is applied. Even if this is the case, the output 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 speed parameter determines rate of replay and is a percentage value expressing the rate of replay compared with the normal replay rate. Only certain speeds are supported, so the speed specified is rounded to the nearest supported value. The following speeds are currently supported:
| Ratio | Percentage |
|---|---|
| 2:1 | 200 |
| 3:2 | 150 |
| 4:3 | 133 |
| 1:1 | 100 |
| 3:4 | 75 |
| 2:3 | 67 |
| 1:2 | 50 |
If speed is set to zero, the data is replayed at an unadjusted rate.
The type parameter determines the format of data that will played back over the timeslot.
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 |
type codes are
recognised,
kSMDataFormat8KHzPCM and
kSMDataFormat6KHzPCM
which means that the data should be assumed to be supplied by
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, it is assumed that the
data is A-law encoded, while if sp30u.smf firmware is loaded, it
is assumed that the data is mu-law encoded).
type code,
kSMDataFormatCELP8KBPS, represents the 8K CELP
format, which is not available in Prosody version 2 (TiNG).
kSMDataFormat8KHzULawPCM.
kSMDataFormat8KHzALawPCM.
The sampling rate firmware:
| sampling rate | extra firmware required |
|---|---|
| 8000 | - |
| 6000 | sixkout |
| 11000 | 11_to_8 |
See document Prosody application note: speech processing replay and record data formats for more details on data formats supported by Prosody and their appropriate use.
The data_length parameter indicates the total number of octets of speech data that the application intends to supply to the driver for replay on the given timeslot. If data_length is set to zero, the replay will be of indefinite length (in this case the replay job can be completed with sm_put_last_replay_data()).
If an event has been previously associated with channel (see sm_channel_set_event), then the driver will notify the application with that event whenever:
0 if call completed successfully, otherwise a standard error such as:
This function is part of the Prosody speech processing API.