diff options
author | kpfleming <kpfleming@f38db490-d61c-443f-a65b-d21fe96a405b> | 2005-10-28 16:20:44 +0000 |
---|---|---|
committer | kpfleming <kpfleming@f38db490-d61c-443f-a65b-d21fe96a405b> | 2005-10-28 16:20:44 +0000 |
commit | e3393cfb0a5e3c50fa1f497a061d8ac38d7534c8 (patch) | |
tree | 5edb99afb7e5ac855b6542c4642f2053d755adcb /frame.c | |
parent | 673d260fce5bc3241fb5fc12d334dab692b9a972 (diff) |
add API function to perform volume adjustment on a frame of SLINEAR data
documentation cleanup
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@6874 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'frame.c')
-rwxr-xr-x | frame.c | 19 |
1 files changed, 19 insertions, 0 deletions
@@ -1252,3 +1252,22 @@ int ast_codec_get_len(int format, int samples) return len; } + +int ast_frame_adjust_volume(struct ast_frame *f, int adjustment) +{ + int count; + short *fdata = f->data; + + if ((f->frametype != AST_FRAME_VOICE) || (f->subclass != AST_FORMAT_SLINEAR)) + return -1; + + for (count = 0; count < f->samples; count++) { + if (adjustment > 0) { + fdata[count] *= abs(adjustment); + } else if (adjustment < 0) { + fdata[count] /= abs(adjustment); + } + } + + return 0; +} |