Permalink
Browse files

Fixed sample looping

  • Loading branch information...
1 parent dcdea18 commit f82385459b7dd3915bebebf3e6daff87df811069 @chriskiefer chriskiefer committed Mar 14, 2012
Showing with 4 additions and 8 deletions.
  1. +4 −8 ofxMaxim/ofxMaxim/libs/maximilian.cpp
@@ -433,15 +433,11 @@ bool maxiSample::read()
double maxiSample::play() {
- // long length=myDataSize*(1./myChannels);
- double remainder;
short* buffer = (short *)myData;
- position=(position+1);
- remainder = position - (long) position;
- if ((long) position>length) position=0;
- output =
- (double) ((1-remainder) * buffer[1+ (long) position] + remainder * buffer[2+(long) position])/32767;//linear interpolation
- return(output);
+ position++;
+ if ((long) position == length) position=0;
+ output = (double) buffer[(long)position]/32767.0;
+ return output;
}
double maxiSample::playOnce() {

0 comments on commit f823854

Please sign in to comment.