<commit_before>#include <iostream.h>
#include <stdio.h>
#include <stdlib.h>
#include <mixerr.h>
#include <Instrument.h>
#include "PANECHO.h"
#include <rt.h>
#include <rtdefs.h>

extern "C" {
	#include <ugens.h>
	extern int resetval;
}

PANECHO::PANECHO() : Instrument()
{
}

PANECHO::~PANECHO()
{
	delete [] delarray1;
	delete [] delarray2;
}

int PANECHO::init(float p[], short n_args)
{
// p0 = output skip; p1 = input skip; p2 = output duration
// p3 = amplitude multiplier 
// p4 = chennel 0 delay time
// p5 = chennel 1 delay time
// p6 = regeneration multiplier (< 1!)
// p7 = ring-down duration
// p8 = input channel [optional]
// assumes function table 1 is the amplitude envelope

	long delsamps;

	rtsetinput(p[1], this);
	nsamps = rtsetoutput(p[0], p[2]+p[7], this);
	insamps = (int)(p[2] * SR);

	if (NCHANS != 2) {
		fprintf(stderr,"output must be stereo!\n");
		exit(-1);
		}

	delsamps = (long)(p[4] * SR + 0.5);
	delarray1 = new float[delsamps];
	if (!delarray1) {
		fprintf(stderr,"Sorry, Charlie -- no space\n");
		exit(-1);
	}
	wait1 = p[4];
	delset(delarray1, deltabs1, wait1);

	delsamps = (long)(p[5] * SR + 0.5);
	delarray2 = new float[delsamps];
	if (!delarray2) {
		fprintf(stderr,"Sorry, Charlie -- no space\n");
		exit(-1);
	}
	wait2 = p[5];
	delset(delarray2, deltabs2, wait2);

	regen = p[5];

	amptable = floc(1);
	if (amptable) {
		int amplen = fsize(1);
		tableset(p[2], amplen, amptabs);
	}
	else
		printf("Setting phrase curve to all 1's\n");

	amp = p[3];
	skip = (int)(SR/(float)resetval);
	inchan = (int)p[8];
	if ((inchan+1) > inputchans) {
		fprintf(stderr,"uh oh, you have asked for channel %d of a %d-channel file...\n",inchan,inputchans);
		exit(-1);
		}

	return(nsamps);
}

int PANECHO::run()
{
	int i,rsamps;
	float in[MAXBUF], out[2];
	float aamp;
	int branch;

	Instrument::run();

	rsamps = chunksamps*inputchans;
<commit_msg><regen> set from wrong pfield.<commit_after>#include <iostream.h>
#include <stdio.h>
#include <stdlib.h>
#include <mixerr.h>
#include <Instrument.h>
#include "PANECHO.h"
#include <rt.h>
#include <rtdefs.h>

extern "C" {
	#include <ugens.h>
	extern int resetval;
}

PANECHO::PANECHO() : Instrument()
{
}

PANECHO::~PANECHO()
{
	delete [] delarray1;
	delete [] delarray2;
}

int PANECHO::init(float p[], short n_args)
{
// p0 = output skip; p1 = input skip; p2 = output duration
// p3 = amplitude multiplier 
// p4 = chennel 0 delay time
// p5 = chennel 1 delay time
// p6 = regeneration multiplier (< 1!)
// p7 = ring-down duration
// p8 = input channel [optional]
// assumes function table 1 is the amplitude envelope

	long delsamps;

	rtsetinput(p[1], this);
	nsamps = rtsetoutput(p[0], p[2]+p[7], this);
	insamps = (int)(p[2] * SR);

	if (NCHANS != 2) {
		fprintf(stderr,"output must be stereo!\n");
		exit(-1);
		}

	delsamps = (long)(p[4] * SR + 0.5);
	delarray1 = new float[delsamps];
	if (!delarray1) {
		fprintf(stderr,"Sorry, Charlie -- no space\n");
		exit(-1);
	}
	wait1 = p[4];
	delset(delarray1, deltabs1, wait1);

	delsamps = (long)(p[5] * SR + 0.5);
	delarray2 = new float[delsamps];
	if (!delarray2) {
		fprintf(stderr,"Sorry, Charlie -- no space\n");
		exit(-1);
	}
	wait2 = p[5];
	delset(delarray2, deltabs2, wait2);

	regen = p[6];

	amptable = floc(1);
	if (amptable) {
		int amplen = fsize(1);
		tableset(p[2], amplen, amptabs);
	}
	else
		printf("Setting phrase curve to all 1's\n");

	amp = p[3];
	skip = (int)(SR/(float)resetval);
	inchan = (int)p[8];
	if ((inchan+1) > inputchans) {
		fprintf(stderr,"uh oh, you have asked for channel %d of a %d-channel file...\n",inchan,inputchans);
		exit(-1);
		}

	return(nsamps);
}

int PANECHO::run()
{
	int i,rsamps;
	float in[MAXBUF], out[2];
	float aamp;
	int branch;

	Instrument::run();

	rsamps = chunksamps*inputchans;

{'fraction_non_alphanumeric': 0.18406374501992032, 'fraction_numerical': 0.028685258964143426, 'mean_word_length': 3.9293193717277486, 'pattern_counts': {'":': 0, '<': 22, '<?xml version=': 0, '>': 22, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '944028', 'n_tokens_mistral': 1658, 'n_tokens_neox': 1555, 'n_words': 382}