Update of /usr/cvsroot/asterisk
In directory mongoose.digium.com:/tmp/cvs-serv665

Modified Files:
        frame.c 
Log Message:
add API function to perform volume adjustment on a frame of SLINEAR data
documentation cleanup


Index: frame.c
===================================================================
RCS file: /usr/cvsroot/asterisk/frame.c,v
retrieving revision 1.65
retrieving revision 1.66
diff -u -d -r1.65 -r1.66
--- frame.c     24 Oct 2005 20:12:05 -0000      1.65
+++ frame.c     28 Oct 2005 16:20:44 -0000      1.66
@@ -1252,3 +1252,22 @@
 
        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;
+}

_______________________________________________
Asterisk-Cvs mailing list
[email protected]
http://lists.digium.com/mailman/listinfo/asterisk-cvs

Reply via email to