From 7f4bec02beedeb71725c65191b8d76f24b56b9a3 Mon Sep 17 00:00:00 2001 From: mick grierson Date: Sun, 9 Oct 2016 22:40:54 +0100 Subject: getLength --- main.cpp | 23 +++++++---------------- 1 file changed, 7 insertions(+), 16 deletions(-) (limited to 'main.cpp') diff --git a/main.cpp b/main.cpp index 1f36c7f..d7ca862 100755 --- a/main.cpp +++ b/main.cpp @@ -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]; } -- cgit v1.3