Example #1
0
int CHAIN::run()
{
	for (std::vector<Instrument *>::iterator it = mInstVector.begin(); it != mInstVector.end(); ++it) {
		Instrument *inst = *it;
		if (!inst->isDone()) {
			inst->setchunk(framesToRun());	// For outer instrument, this is done in inTraverse()
			inst->run(true);
		}
		else {
			inst->clearOutput(framesToRun());			// This should be optimized to happen only once
		}
		inst->addout(BUS_NONE_OUT, 0);		// Special bus type makes this a no-op
	}
	// Copy from inputChainedBuf, which points to the outbuf of the last instrument in the chain.
	unsigned copySize = framesToRun() * outputChannels() * sizeof(BUFTYPE);
	memcpy(outbuf, inputChainBuf, copySize);
	return framesToRun();
}
Example #2
0
double note_exists(const Arg args[], const int nargs)
{
	if (nargs != 1)
		return die("note_exists", "Usage:  val = note_exists(Instrument_Handle)");

	Instrument *Iptr = (Instrument *)args[0];
	if (Iptr == NULL) {
		warn("note_exists", "Instrument/note not initialized");
		return -1;
	}

	Iptr->ref(); // increase ref count on instrument

	double retval;
	if (Iptr->isDone() == true)
		retval = 0.0;
	else
		retval = 1.0;

	Iptr->unref();	// decrease ref count on instrument
	return retval;
}