aboutsummaryrefslogtreecommitdiffstats
path: root/ofxMaxim
diff options
context:
space:
mode:
Diffstat (limited to 'ofxMaxim')
-rw-r--r--ofxMaxim/ofxMaxim/libs/maximilian.cpp5
-rwxr-xr-xofxMaxim/ofxMaxim/libs/maximilian.h11
2 files changed, 3 insertions, 13 deletions
diff --git a/ofxMaxim/ofxMaxim/libs/maximilian.cpp b/ofxMaxim/ofxMaxim/libs/maximilian.cpp
index f19303a..dd72f4f 100644
--- a/ofxMaxim/ofxMaxim/libs/maximilian.cpp
+++ b/ofxMaxim/ofxMaxim/libs/maximilian.cpp
@@ -445,10 +445,9 @@ double maxiSample::play() {
double maxiSample::playOnce() {
// long length=myDataSize*(0.5/myChannels);
- double remainder;
short* buffer = (short *)myData;
position=(position+1);
- remainder = position - (long) position;
+ double remainder = position - (long) position;
if ((long) position<length)
output = (double) ((1-remainder) * buffer[1+ (long) position] + remainder * buffer[2+(long) position])/32767;//linear interpolation
else
@@ -458,11 +457,11 @@ double maxiSample::playOnce() {
}
double maxiSample::playOnce(double speed) {
- double remainder;
//long a,b;
// long length=myDataSize*0.5;
short* buffer = (short *)myData;
position=position+((speed*chandiv*myChannels)/(maxiSettings::sampleRate/mySampleRate));
+ double remainder = position - (long) position;
if ((long) position<length)
output = (double) ((1-remainder) * buffer[1+ (long) position] + remainder * buffer[2+(long) position])/32767;//linear interpolation
else
diff --git a/ofxMaxim/ofxMaxim/libs/maximilian.h b/ofxMaxim/ofxMaxim/libs/maximilian.h
index 0a3b95a..06470b6 100755
--- a/ofxMaxim/ofxMaxim/libs/maximilian.h
+++ b/ofxMaxim/ofxMaxim/libs/maximilian.h
@@ -42,7 +42,7 @@
#include <iostream>
#include <fstream>
-#include <string>
+#include <string.h>
#include <cstdlib>
#include "math.h"
@@ -197,15 +197,6 @@ public:
~maxiSample()
{
if (myData) delete[] myData;
- myChunkSize = NULL;
- mySubChunk1Size = NULL;
- myFormat = NULL;
- myChannels = NULL;
- mySampleRate = NULL;
- myByteRate = NULL;
- myBlockAlign = NULL;
- myBitsPerSample = NULL;
- myDataSize = NULL;
}
maxiSample():myData(NULL),position(0){};