aboutsummaryrefslogtreecommitdiffstats
path: root/maximilian.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'maximilian.cpp')
-rw-r--r--maximilian.cpp7
1 files changed, 3 insertions, 4 deletions
diff --git a/maximilian.cpp b/maximilian.cpp
index 538e3fb..0fe14d4 100644
--- a/maximilian.cpp
+++ b/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
@@ -1024,4 +1023,4 @@ double maxiEnv::adsr(double input, double attack, double decay, double sustain,
double convert::mtof(int midinote) {
return mtofarray[midinote];
-} \ No newline at end of file
+}