static bool hasMIDISync() { JSONUI jsonui; mydsp* tmp_dsp = new mydsp(); tmp_dsp->buildUserInterface(&jsonui); std::string json = jsonui.JSON(); delete tmp_dsp; return ((json.find("midi") != std::string::npos) && ((json.find("start") != std::string::npos) || (json.find("stop") != std::string::npos) || (json.find("clock") != std::string::npos))); }
/* * init(samplingRate, bufferFrames) * Initializes the Audio engine and the DSP code * with samplingRate and bufferFrames. * This method also looks for the [style:poly] * metadata in the Faust code and initializes a * polyphonic object or not based on that. init * should be called before start. */ bool init(int samplingRate, int bufferSize) { DSP.init(samplingRate); inChanNumb = DSP.getNumInputs(); outChanNumb = DSP.getNumOutputs(); // configuring the UI DSP.buildUserInterface(&mapUI); DSP.buildUserInterface(&json); jsonString = json.JSON(); if (jsonString.find("keyboard") != std::string::npos || jsonString.find("poly") != std::string::npos){ polyMax = 4; DSPpoly = new mydsp_poly(polyMax, true); DSPpoly->init(samplingRate); } else { polyMax = 0; } return (fAudioDevice.Open(((polyMax > 0) ? DSPpoly : &DSP), inChanNumb, outChanNumb, bufferSize, samplingRate) == 0); }
/* * init(samplingRate, bufferFrames) * Initializes the Audio engine and the DSP code * with samplingRate and bufferFrames. * This method also looks for the [style:poly] * metadata in the Faust code and initializes a * polyphonic object or not based on that. init * should be called before start. */ void init(int samplingRate, int bufferFrames) { // configuring global variables SR = samplingRate; bufferSize = bufferFrames; vecSamps = bufferSize; DSP.init(SR); inChanNumb = DSP.getNumInputs(); outChanNumb = DSP.getNumOutputs(); // configuring the UI DSP.buildUserInterface(&mapUI); DSP.buildUserInterface(&json); jsonString = json.JSON(); if(jsonString.find("keyboard") != std::string::npos || jsonString.find("poly") != std::string::npos){ polyMax = 4; polyCoef = 1.0f / polyMax; DSPpoly = new mydsp_poly(SR, bufferSize, polyMax); } else{ polyMax = 0; } // allocating memory for output channel bufferout = new float *[outChanNumb]; for (int i = 0; i < outChanNumb; i++) { bufferout[i] = new float[vecSamps]; } // allocating memory for input channel if (inChanNumb >= 1) { bufferin = new float *[inChanNumb]; for (int i = 0; i < inChanNumb; i++) { bufferin[i] = new float[vecSamps]; } } }