mirror of
https://github.com/signalwire/freeswitch.git
synced 2025-08-14 01:49:05 +00:00
freetdm: saturated add and pri tapping mixing
This commit is contained in:
@@ -457,6 +457,7 @@ struct ftdm_span {
|
||||
fio_channel_request_t channel_request;
|
||||
ftdm_span_start_t start;
|
||||
ftdm_span_stop_t stop;
|
||||
ftdm_channel_sig_read_t sig_read;
|
||||
void *mod_data;
|
||||
char *type;
|
||||
char *dtmf_hangup;
|
||||
@@ -669,6 +670,18 @@ static __inline__ void ftdm_clear_flag_all(ftdm_span_t *span, uint32_t flag)
|
||||
ftdm_mutex_unlock(span->mutex);
|
||||
}
|
||||
|
||||
static __inline__ int16_t ftdm_saturated_add(int16_t sample1, int16_t sample2)
|
||||
{
|
||||
int addres;
|
||||
|
||||
addres = sample1 + sample2;
|
||||
if (addres > 32767)
|
||||
addres = 32767;
|
||||
else if (addres < -32767)
|
||||
addres = -32767;
|
||||
return addres;
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
@@ -360,6 +360,7 @@ typedef struct ftdm_bitstream ftdm_bitstream_t;
|
||||
typedef struct ftdm_fsk_modulator ftdm_fsk_modulator_t;
|
||||
typedef ftdm_status_t (*ftdm_span_start_t)(ftdm_span_t *span);
|
||||
typedef ftdm_status_t (*ftdm_span_stop_t)(ftdm_span_t *span);
|
||||
typedef ftdm_status_t (*ftdm_channel_sig_read_t)(ftdm_channel_t *ftdmchan, void *data, ftdm_size_t size);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
Reference in New Issue
Block a user