forked from Mirrors/freeswitch
revert silence gen code for comparison
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@11572 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
parent
dbd74c0c98
commit
3f66f0a2a8
@ -201,6 +201,7 @@ SWITCH_DECLARE(void) switch_swap_linear(int16_t *buf, int len)
|
||||
}
|
||||
}
|
||||
|
||||
#if SILENCE_METHOD_ONE
|
||||
SWITCH_DECLARE(void) switch_generate_sln_silence(int16_t *data, uint32_t samples, uint32_t divisor)
|
||||
{
|
||||
int16_t x;
|
||||
@ -223,6 +224,31 @@ SWITCH_DECLARE(void) switch_generate_sln_silence(int16_t *data, uint32_t samples
|
||||
data++;
|
||||
}
|
||||
}
|
||||
#else
|
||||
|
||||
SWITCH_DECLARE(void) switch_generate_sln_silence(int16_t *data, uint32_t samples, uint32_t divisor)
|
||||
{
|
||||
int16_t rnd = 0, rnd2, x;
|
||||
uint32_t i;
|
||||
int sum_rnd = 0;
|
||||
|
||||
assert(divisor);
|
||||
|
||||
rnd2 = (int16_t) (intptr_t) &data + switch_epoch_time_now(NULL);
|
||||
|
||||
for (i = 0; i < samples; i++, sum_rnd = 0) {
|
||||
for (x = 0; x < 10; x++) {
|
||||
rnd += ((x + i) * rnd2);
|
||||
sum_rnd += rnd;
|
||||
}
|
||||
switch_normalize_to_16bit(sum_rnd);
|
||||
*data = (int16_t) ((int16_t) sum_rnd / (int) divisor);
|
||||
|
||||
data++;
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
SWITCH_DECLARE(uint32_t) switch_merge_sln(int16_t *data, uint32_t samples, int16_t *other_data, uint32_t other_samples)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user