return rv;
}
+static int
+gcd(a, b)
+ int a, b;
+{
+ while (b > 0) {
+ int tmp = a % b;
+ a = b;
+ b = tmp;
+ }
+ return a;
+}
+
static PyObject *
audioop_ratecv(self, args)
PyObject *self;
PyErr_SetString(AudioopError, "not a whole number of frames");
return NULL;
}
+ if (inrate <= 0 || outrate <= 0) {
+ PyErr_SetString(AudioopError, "sampling rate not > 0");
+ return NULL;
+ }
+ /* divide inrate and outrate by their greatest common divisor */
+ d = gcd(inrate, outrate);
+ inrate /= d;
+ outrate /= d;
+
prev_i = malloc(nchannels * sizeof(int));
cur_i = malloc(nchannels * sizeof(int));
len /= size * nchannels; /* # of frames */