FS-7654 #resolve

This commit is contained in:
Anthony Minessale
2015-06-12 23:55:24 -05:00
parent 3e2d5e009e
commit d6a0abf1db
4 changed files with 55 additions and 22 deletions

View File

@@ -228,18 +228,20 @@ SWITCH_DECLARE(void) switch_generate_sln_silence(int16_t *data, uint32_t samples
}
}
SWITCH_DECLARE(uint32_t) switch_merge_sln(int16_t *data, uint32_t samples, int16_t *other_data, uint32_t other_samples)
SWITCH_DECLARE(uint32_t) switch_merge_sln(int16_t *data, uint32_t samples, int16_t *other_data, uint32_t other_samples, int channels)
{
int i;
int32_t x, z;
if (channels == 0) channels = 1;
if (samples > other_samples) {
x = other_samples;
} else {
x = samples;
}
for (i = 0; i < x; i++) {
for (i = 0; i < x * channels; i++) {
z = data[i] + other_data[i];
switch_normalize_to_16bit(z);
data[i] = (int16_t) z;
@@ -249,18 +251,20 @@ SWITCH_DECLARE(uint32_t) switch_merge_sln(int16_t *data, uint32_t samples, int16
}
SWITCH_DECLARE(uint32_t) switch_unmerge_sln(int16_t *data, uint32_t samples, int16_t *other_data, uint32_t other_samples)
SWITCH_DECLARE(uint32_t) switch_unmerge_sln(int16_t *data, uint32_t samples, int16_t *other_data, uint32_t other_samples, int channels)
{
int i;
int32_t x;
if (channels == 0) channels = 1;
if (samples > other_samples) {
x = other_samples;
} else {
x = samples;
}
for (i = 0; i < x; i++) {
for (i = 0; i < x * channels; i++) {
data[i] -= other_data[i];
}