diff options
| author | mick grierson <mickgrierson@gmail.com> | 2016-10-09 22:40:54 +0100 |
|---|---|---|
| committer | mick grierson <mickgrierson@gmail.com> | 2016-10-09 22:40:54 +0100 |
| commit | 7f4bec02beedeb71725c65191b8d76f24b56b9a3 (patch) | |
| tree | 8dedba32c2a476d83c47bd226e0c54bac67a8836 | |
| parent | ff891983f82464506b2f6545fd1d26c413638c64 (diff) | |
getLength
| -rwxr-xr-x | main.cpp | 23 | ||||
| -rw-r--r-- | maximilian.cpp | 4 | ||||
| -rwxr-xr-x | maximilian.h | 2 |
3 files changed, 10 insertions, 19 deletions
@@ -1,31 +1,22 @@ #include "maximilian.h" maxiSample beats; //We give our sample a name. It's called beats this time. We could have loads of them, but they have to have different names. -maxiDyn compressor; //this is a compressor -double out; void setup() {//some inits + beats.load("/Users/michaelgrierson/Documents/workspace/Maximilian/beat2.wav");//load in your samples. Provide the full path to a wav file. printf("Summary:\n%s", beats.getSummary());//get info on samples if you like. - - compressor.setAttack(200); - compressor.setRelease(500); - compressor.setThreshold(0.2); - compressor.setRatio(5); - - //you can set these any time you like. + cout << beats.getLength(); } void play(double *output) {//this is where the magic happens. Very slow magic. + //output[0]=beats.play();//just play the file. Looping is default for all play functions. + output[0]=beats.play(0.68);//play the file with a speed setting. 1. is normal speed. + //output[0]=beats.play(0.5,0,44100);//linear interpolationplay with a frequency input, start point and end point. Useful for syncing. + //output[0]=beats.play4(0.5,0,44100);//cubic interpolation play with a frequency input, start point and end point. Useful for syncing. - //here, we're just compressing the file in real-time - //arguments are input,ratio,threshold,attack,release - out=compressor.compress(beats.play()); - - output[0]=out; - output[1]=out; - + output[1]=output[0]; } diff --git a/maximilian.cpp b/maximilian.cpp index adbb97d..8f358f7 100644 --- a/maximilian.cpp +++ b/maximilian.cpp @@ -1082,8 +1082,8 @@ double maxiSample::bufferPlay4(unsigned char &bufferin,double frequency, double } -void maxiSample::getLength() { - length=myDataSize*0.5; +long maxiSample::getLength() { + return (length=myDataSize*0.5); } void maxiSample::setLength(unsigned long numSamples) { diff --git a/maximilian.h b/maximilian.h index c292598..5f1d2f7 100755 --- a/maximilian.h +++ b/maximilian.h @@ -221,7 +221,7 @@ public: short myChannels; int mySampleRate; long length; - void getLength(); + long getLength(); void setLength(unsigned long numSamples); short myBitsPerSample; |
