[asterisk-commits] file: trunk r80157 - /trunk/main/audiohook.c
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Tue Aug 21 10:51:50 CDT 2007
Author: file
Date: Tue Aug 21 10:51:49 2007
New Revision: 80157
URL: http://svn.digium.com/view/asterisk?view=rev&rev=80157
Log:
Minor tweak. Don't manipulate volume of the audio in the buffer if no audio is actually there.
Modified:
trunk/main/audiohook.c
Modified: trunk/main/audiohook.c
URL: http://svn.digium.com/view/asterisk/trunk/main/audiohook.c?view=diff&rev=80157&r1=80156&r2=80157
==============================================================================
--- trunk/main/audiohook.c (original)
+++ trunk/main/audiohook.c Tue Aug 21 10:51:49 2007
@@ -189,17 +189,18 @@
/* Start with the read factory... if there are enough samples, read them in */
if (ast_slinfactory_available(&audiohook->read_factory) >= samples) {
- if (ast_slinfactory_read(&audiohook->read_factory, buf1, samples))
+ if (ast_slinfactory_read(&audiohook->read_factory, buf1, samples)) {
read_buf = buf1;
- /* Adjust read volume if need be */
- if (audiohook->options.read_volume) {
- int count = 0;
- short adjust_value = abs(audiohook->options.read_volume);
- for (count = 0; count < samples; count++) {
- if (audiohook->options.read_volume > 0)
- ast_slinear_saturated_multiply(&buf1[count], &adjust_value);
- else if (audiohook->options.read_volume < 0)
- ast_slinear_saturated_divide(&buf1[count], &adjust_value);
+ /* Adjust read volume if need be */
+ if (audiohook->options.read_volume) {
+ int count = 0;
+ short adjust_value = abs(audiohook->options.read_volume);
+ for (count = 0; count < samples; count++) {
+ if (audiohook->options.read_volume > 0)
+ ast_slinear_saturated_multiply(&buf1[count], &adjust_value);
+ else if (audiohook->options.read_volume < 0)
+ ast_slinear_saturated_divide(&buf1[count], &adjust_value);
+ }
}
}
} else if (option_debug)
@@ -207,17 +208,18 @@
/* Move on to the write factory... if there are enough samples, read them in */
if (ast_slinfactory_available(&audiohook->write_factory) >= samples) {
- if (ast_slinfactory_read(&audiohook->write_factory, buf2, samples))
+ if (ast_slinfactory_read(&audiohook->write_factory, buf2, samples)) {
write_buf = buf2;
- /* Adjust write volume if need be */
- if (audiohook->options.write_volume) {
- int count = 0;
- short adjust_value = abs(audiohook->options.write_volume);
- for (count = 0; count < samples; count++) {
- if (audiohook->options.write_volume > 0)
- ast_slinear_saturated_multiply(&buf2[count], &adjust_value);
- else if (audiohook->options.write_volume < 0)
- ast_slinear_saturated_divide(&buf2[count], &adjust_value);
+ /* Adjust write volume if need be */
+ if (audiohook->options.write_volume) {
+ int count = 0;
+ short adjust_value = abs(audiohook->options.write_volume);
+ for (count = 0; count < samples; count++) {
+ if (audiohook->options.write_volume > 0)
+ ast_slinear_saturated_multiply(&buf2[count], &adjust_value);
+ else if (audiohook->options.write_volume < 0)
+ ast_slinear_saturated_divide(&buf2[count], &adjust_value);
+ }
}
}
} else if (option_debug)
More information about the asterisk-commits
mailing list