    //----------------------------------------------------------
// author: "Grame", "Yghe"
// copyright: "(c)GRAME 2009"
// license: "BSD"
// name: "NoiseMD"
// version: "1.1"
//
// Code generated with Faust 2.81.0 (https://faust.grame.fr)
//----------------------------------------------------------

/* link with  */
#include <math.h>
#ifndef FAUSTFLOAT
#define FAUSTFLOAT float
#endif 


#ifndef FAUSTCLASS 
#define FAUSTCLASS mydsp
#endif

class mydsp : public dsp {
  private:
	// Recursion delay iVeeec0 is of type kMonoDelay
	// While its definition is of type kZeroDelay
	int 	iVeeec0State; // Mono Delay
	FAUSTFLOAT 	fslider0;
	int fSampleRate;

  public:
	virtual void metadata(Meta* m) { 
		m->declare("author", "Grame");
		m->declare("contributor", "Yghe");
		m->declare("copyright", "(c)GRAME 2009");
		m->declare("filename", "noisemetadata.dsp");
		m->declare("license", "BSD");
		m->declare("name", "NoiseMD");
		m->declare("version", "1.1");
	}

	virtual int getNumInputs() { return 0; }
	virtual int getNumOutputs() { return 1; }
	static void classInit(int sample_rate) {
	}
	virtual void instanceConstants(int sample_rate) {
		fSampleRate = sample_rate;
	}
	virtual void instanceResetUserInterface() {
		fslider0 = 0.0697f;
	}
	virtual void instanceClear() {
		iVeeec0State = 0;
	}
	virtual void init(int sample_rate) {
		classInit(sample_rate);
		instanceInit(sample_rate);
	}
	virtual void instanceInit(int sample_rate) {
		instanceConstants(sample_rate);
		instanceResetUserInterface();
		instanceClear();
	}
	virtual mydsp* clone() {
		return new mydsp();
	}
	virtual int getSampleRate() {
		return fSampleRate;
	}
	virtual void buildUserInterface(UI* ui_interface) {
		ui_interface->openVerticalBox("NoiseMD");
		ui_interface->declare(&fslider0, "style", "knob");
		ui_interface->addVerticalSlider("Volume", &fslider0, 0.0697f, 0.0f, 1.0f, 0.1f);
		ui_interface->closeBox();
	}
	virtual void compute (int count, FAUSTFLOAT** input, FAUSTFLOAT** output) {
		int 	iVeeec0;
		float 	fSlow0 = (4.656613e-10f * float(fslider0)); // step: 13
		int fullcount = count;
		for (int index = 0; index < fullcount; index += 32) {
			int count = min(32, fullcount-index);
			FAUSTFLOAT* output0 = &output[0][index]; // Zone 3
			iVeeec0 = iVeeec0State;
			for (int i=0; i<count; i++) {
				iVeeec0 = ((1103515245 * iVeeec0) + 12345);
				output0[i] = (FAUSTFLOAT)((fSlow0 * float(iVeeec0)));  // Zone Exec Code
			}
			iVeeec0State = iVeeec0;
		}
	}
};


