diff options
| author | Mick Grierson <mickgrierson@strangebook.lan> | 2011-10-28 09:27:37 +0100 |
|---|---|---|
| committer | Mick Grierson <mickgrierson@strangebook.lan> | 2011-10-28 09:27:37 +0100 |
| commit | 71f5a13bd245350b5924867f89f4621d05b9279f (patch) | |
| tree | b5ade6790e44cad8887cb1bf002727164727a32c /maximilian.cpp | |
| parent | 9fd23b3d03639eca7b2e3b0fba76cff8b3d837ff (diff) | |
added maxisample::playOnce with a speed setting - only uses linear interpolation at the moment
Diffstat (limited to 'maximilian.cpp')
| -rw-r--r-- | maximilian.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/maximilian.cpp b/maximilian.cpp index 92f1292..12ea302 100644 --- a/maximilian.cpp +++ b/maximilian.cpp @@ -457,6 +457,19 @@ double maxiSample::playOnce() { return(output); } +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)); + if ((long) position<length) + output = (double) ((1-remainder) * buffer[1+ (long) position] + remainder * buffer[2+(long) position])/32767;//linear interpolation + else + output=0; + return(output); +} + double maxiSample::play(double speed) { double remainder; long a,b; |
