[asterisk-commits] dvossel: branch dvossel/funk_effects r250958 - /team/dvossel/funk_effects/funcs/

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Mar 4 23:33:14 CST 2010


Author: dvossel
Date: Thu Mar  4 23:33:10 2010
New Revision: 250958

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=250958
Log:
fixes coding guideline issues, more effecient buffer sizes

Modified:
    team/dvossel/funk_effects/funcs/func_pitchshift.c

Modified: team/dvossel/funk_effects/funcs/func_pitchshift.c
URL: http://svnview.digium.com/svn/asterisk/team/dvossel/funk_effects/funcs/func_pitchshift.c?view=diff&rev=250958&r1=250957&r2=250958
==============================================================================
--- team/dvossel/funk_effects/funcs/func_pitchshift.c (original)
+++ team/dvossel/funk_effects/funcs/func_pitchshift.c Thu Mar  4 23:33:10 2010
@@ -108,11 +108,11 @@
  ***/
 
 #define M_PI 3.14159265358979323846
-#define MAX_FRAME_LENGTH 8192
+#define MAX_FRAME_LENGTH 256
 
 #define HIGHEST 2
-#define HIGHER 1.65
-#define HIGH 1.3
+#define HIGHER 1.5
+#define HIGH 1.25
 #define LOW .85
 #define LOWER .7
 #define LOWEST .5
@@ -441,23 +441,29 @@
 			}
 
 			/* zero negative frequencies */
-			for (k = fft_frame_size + 2; k < 2 * fft_frame_size; k++) fft_worksp[k] = 0.;
+			for (k = fft_frame_size + 2; k < 2 * fft_frame_size; k++) {
+				fft_worksp[k] = 0.;
+			}
 
 			/* do inverse transform */
 			smb_fft(fft_worksp, fft_frame_size, 1);
 
 			/* do windowing and add to output accumulator */
-			for (k=0; k < fft_frame_size; k++) {
+			for (k = 0; k < fft_frame_size; k++) {
 				window = -.5 * cos(2. * M_PI * (double) k / (double) fft_frame_size) + .5;
 				output_accum[k] += 2. * window * fft_worksp[2*k] / (fft_frame_size2 * osamp);
 			}
-			for (k = 0; k < step_size; k++) out_fifo[k] = output_accum[k];
+			for (k = 0; k < step_size; k++) {
+				out_fifo[k] = output_accum[k];
+			}
 
 			/* shift accumulator */
 			memmove(output_accum, output_accum+step_size, fft_frame_size * sizeof(float));
 
 			/* move input FIFO */
-			for (k = 0; k < in_fifo_latency; k++) in_fifo[k] = in_fifo[k+step_size];
+			for (k = 0; k < in_fifo_latency; k++) {
+				in_fifo[k] = in_fifo[k+step_size];
+			}
 		}
 	}
 }
@@ -468,11 +474,11 @@
 	int samples;
 
 	/* an amount of 1 has no effect */
-	if (!amount || amount == 1 || !fun) {
+	if (!amount || amount == 1 || !fun || (f->samples % 32)) {
 		return 0;
 	}
 	for (samples = 0; samples < f->samples; samples += 32) {
-		smb_pitch_shift(amount, 32, 256, 32, ast_format_rate(f->subclass.codec), fun+samples, fun+samples, fft);
+		smb_pitch_shift(amount, 32, MAX_FRAME_LENGTH, 32, ast_format_rate(f->subclass.codec), fun+samples, fun+samples, fft);
 	}
 
 	return 0;




More information about the asterisk-commits mailing list