Good day good-looking computer people,
I might be asking a bit too much, but here it goes.
I'm trying to do a bit of reserve engineering on this sound library. Looking at the main.cpp file (which I have posted below) it has two methods, setup and play. I'm a bit confused as to how this is working:
When you run the Xcode project, shouldn't there be a main function that is the first method called? I don't see that here.
The play function is being called (because I hear music), but it must be from elsewhere since in needs the argument output. Where could it be being called from?
To try to be a bit more specific, this is my question:
- If the program isn't starting from a main method in the main.cpp file, where else could it be starting from ?
#include "maximilian.h"
double outputs[2],moreoutputs[2]; //some track outputs
double filtered, ramped, filtered2;
osc buffertest,ramp;
mix mymix,bobbins;//some panning busses
double env[4]={200,0,0,50};//the kick drum pitch envelope data
double env2[6]={10000,0,9000,5,0,5};//the hi hat pitch envelope dat
envelope b,f;//two envelopers
sample beats;
extern int channels=2;//stereo-must be supported by hardware
extern int buffersize=256;//should be fine for most things
extern int samplerate=44100;//SR must be supported by card. It's always the default
void setup() {//some inits
b.amplitude=env[0];//starting value for envelope b
f.amplitude=env2[0];//same for f
beats.load("/Users/ericbrotto/Desktop/beats.wav");//put a path to a soundfile here. Wav format only.
printf("Summary:\n%s", beats.getSummary());//get info on samples if you like
}
void play(double *output) {//this is where the magic happens. Very slow magic.
filtered2=beats.play(1*(1./34), 0, beats.length());
bobbins.stereo(filtered2, moreoutputs, 0.5);//invert the pan
output[0]=outputs[0]+moreoutputs[0];//stick it in the out!!
output[1]=outputs[1]+moreoutputs[1];
}
Thanks!