diff --git a/Modules/audioop.c b/Modules/audioop.c index f8810d3eb31..92152b9c2d5 100644 --- a/Modules/audioop.c +++ b/Modules/audioop.c @@ -270,6 +270,46 @@ audioop_rms(self, args) return newintobject(val); } +static object * +audioop_rms2(self, args) + object *self; + object *args; +{ + signed char *cp1, *cp2; + int len1, len2, size, val1, val2; + int i; + float sum_squares = 0.0; + + if ( !getargs(args, "(s#s#i)", &cp1, &len1, &cp2, &len2, &size) ) + return 0; + if ( size != 1 && size != 2 && size != 4 ) { + err_setstr(AudioopError, "Size should be 1, 2 or 4"); + return 0; + } + if ( len1 != len2 ) { + err_setstr(AudioopError, "Samples should be same size"); + return 0; + } + for ( i=0; i