Just added a message function
diff --git a/sonic.c b/sonic.c
index 9a9c11c..065a59b 100644
--- a/sonic.c
+++ b/sonic.c
@@ -20,6 +20,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <stdarg.h>
#include "sonic.h"
struct sonicStreamStruct {
@@ -37,6 +38,20 @@
int sampleRate;
};
+void sonicMSG(char *format, ...)
+{
+ char buffer[4096];
+ va_list ap;
+ FILE *file;
+
+ va_start(ap, format);
+ vsprintf((char *)buffer, (char *)format, ap);
+ va_end(ap);
+ file=fopen("/tmp/sonic.log", "a");
+ fprintf(file, "%s", buffer);
+ fclose(file);
+}
+
/* Get the speed of the stream. */
double sonicGetSpeed(
sonicStream stream)
@@ -337,7 +352,6 @@
/* Find the best frequency match in the range, and given a sample skip multiple. */
static int findPitchPeriodInRange(
- sonicStream stream,
float *samples,
int minPeriod,
int maxPeriod,
@@ -385,7 +399,7 @@
if(sampleRate > SONIC_AMDF_FREQ) {
skip = sampleRate/SONIC_AMDF_FREQ;
}
- period = findPitchPeriodInRange(stream, samples, minPeriod, maxPeriod, skip);
+ period = findPitchPeriodInRange(samples, minPeriod, maxPeriod, skip);
minPeriod = period*(1.0 - SONIC_AMDF_RANGE);
maxPeriod = period*(1.0 + SONIC_AMDF_RANGE);
if(minPeriod < stream->minPeriod) {
@@ -547,21 +561,6 @@
return numSamples;
}
-#include <stdarg.h>
-void MSG(char *format, ...)
-{
- char buffer[4096];
- va_list ap;
- FILE *file;
-
- va_start(ap, format);
- vsprintf((char *)buffer, (char *)format, ap);
- va_end(ap);
- file=fopen("/tmp/sonic.log", "a");
- fprintf(file, "%s", buffer);
- fclose(file);
-}
-
/* This is a non-stream oriented interface to just change the speed of a sound sample */
int sonicChangeShortSpeed(
short *samples,