From 71f5a13bd245350b5924867f89f4621d05b9279f Mon Sep 17 00:00:00 2001 From: Mick Grierson Date: Fri, 28 Oct 2011 09:27:37 +0100 Subject: added maxisample::playOnce with a speed setting - only uses linear interpolation at the moment --- main.cpp | 4 ++-- maximilian.cpp | 13 +++++++++++++ maximilian.h | 2 ++ 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/main.cpp b/main.cpp index de3bb9c..5759515 100755 --- a/main.cpp +++ b/main.cpp @@ -56,9 +56,9 @@ void play(double *output) {//this is where the magic happens. Very slow magic. } - bassout=basscompress.compressor(sound1.pulse(slew.lopass(bassfreq/2,0.001), sound2.phasor(8)*0.25),10,0.5,0.0001,0.995)*0.25; + bassout=basscompress.compressor(sound1.pulse(slew.lopass(bassfreq/2,0.001), sound2.phasor(8)*0.25),5,0.5,0.0001,0.995)*0.125; - sampleOut=compress.compressor(kick.playOnce()+snare.playOnce(),5,0.5),0.0001,0.9995;//just play the file. No looping. + sampleOut=compress.compressor(kick.playOnce(0.5)+snare.playOnce(0.5),1,0.5),0.01,0.9995;//just play the file. No looping. output[0]=sampleOut+bassout;//left channel output[1]=sampleOut+bassout;//right channel 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