int LOOP::doupdate() { double p[9]; update(p, 9); _amp = p[3]; _incr = getIncrement(p[4]); _pan = _usesPan ? p[8] : 0.5; return calculateLoop(p); }
int main() { try { calculateLoop(); return 0; } catch (exception &ex) { cerr << ex.what() << endl; return 1; } catch (...) { cerr << "Some exception occurred" << endl; return 2; } }
int LOOP::init(double p[], int n_args) { if (n_args < 7) return die("LOOP", "Usage: LOOP(start, inskip, dur, amp, trans, loopstart, looplen[, inchan, pan])"); const float outskip = p[0]; const float inskip = p[1]; float dur = p[2]; if (dur < 0.0) dur = -dur - inskip; _incr = getIncrement(p[4]); _inchan = (n_args > 7) ? (int) p[7] : 0; _usesPan = (n_args > 8); _pan = _usesPan ? p[8] : 0.5; if (calculateLoop(p) == -1) return DONT_SCHEDULE; if (rtsetoutput(outskip, dur, this) == -1) return DONT_SCHEDULE; if (outputChannels() > 2) return die("LOOP", "Use mono or stereo output only."); if (rtsetinput(inskip, this) == -1) return DONT_SCHEDULE; if (_inchan >= inputChannels()) return die("LOOP", "You asked for channel %d of a %d-channel input.", _inchan, inputChannels()); _position = inskip * SR; // Actual starting position in the input file _inOffset = 0; // Offset of first sample in _in array compared to _position. return nSamps(); }