コード例 #1
0
ファイル: SpectacleBase.cpp プロジェクト: Angeldude/pd
// ---------------------------------------------------------------------- run --
void SpectacleBase::run(float in[], float out[], int nframes)
{
	if (_reading_input) {
		for (int i = 0; i < nframes; i++) {
			_bucket->drop(in[i]);	// may process <_decimation> input frames
			out[i] = _outbuf[_out_read_index];
			increment_out_read_index();
			_cursamp++;
		}
	}
	else {
		for (int i = 0; i < nframes; i++) {
			_bucket->drop(0.0f);		// may process <_decimation> input frames
			out[i] = _outbuf[_out_read_index];
			increment_out_read_index();
			_cursamp++;
		}
	}
}
コード例 #2
0
// ---------------------------------------------------------------------- run --
int SPECTACLE2_BASE::run()
{
	const int nframes = framesToRun();
	const int inchans = inputChannels();
	const int outchans = outputChannels();

	// If still taking input, store framesToRun() frames into <_inbuf>.
	const bool input_avail = (currentFrame() < _input_frames);
	const int insamps = nframes * inchans;
	if (input_avail)
		rtgetin(_inbuf, this, insamps);

	for (int i = 0; i < nframes; i++) {
		if (--_branch <= 0) {
			doupdate();
			subupdate();
			_branch = getSkip();
		}

		float insig;
		if (input_avail)
			insig = _inbuf[(i * inchans) + _inchan] * _iamp;
		else
			insig = 0.0f;
		_bucket->drop(insig);	// may process <_decimation> input frames

		float outsig = _outbuf[_out_read_index] * _wet;
		increment_out_read_index();

		float drysig = _dry_delay->next(insig);
		outsig += drysig * _dry;

		float out[outchans];
		out[0] = outsig * _oamp;
		if (outchans == 2) {
			out[1] = out[0] * (1.0f - _pan);
			out[0] *= _pan;
		}

		rtaddout(out);
		increment();
	}

	return nframes;
}