Ejemplo n.º 1
0
//-----------------------------------------------------------------------------------------
tf3Synth::tf3Synth (audioMasterCallback audioMaster, void* hInstance)
	: AudioEffectX (audioMaster, kNumPrograms, TF_PARAM_COUNT)
{
	// Initialize module path
	eChar mpath[512];
	eMemSet(mpath, 0, 512);
	GetModuleFileName((HMODULE)hInstance, mpath, 512);

	eChar *str = &mpath[511];
	while (str != mpath && *str!='/' && *str!='\\')
	{
		*str-- = '\0';
	}
	
	modulePath = QString(mpath);

	// Initialize tunefish
	tf = new tfInstrument();

	// initialize programs
	for (long i = 0; i < kNumPrograms; i++)
		programs[i].loadDefault(i);

	loadProgramAll();

	for (long i = 0; i < 16; i++)
		channelPrograms[i] = i;

	if (programs)
		setProgram (0);

    editor = new tfEditor(this);
	
	if (audioMaster)
	{
		setNumInputs (0);				// no inputs
		setNumOutputs (kNumOutputs);	// 2 outputs, 1 for each oscillator
		canProcessReplacing ();
		hasVu (false);
		hasClip (false);
		isSynth ();
		setUniqueID ('TF3');			// <<<! *must* change this!!!!
	}
	initProcess ();

	suspend ();
}
Ejemplo n.º 2
0
SynthCore::SynthCore(audioMasterCallback audioMaster, bool *error, int numprogs)
: VstWrap(audioMaster, numprogs, NUM_VST_PARAMS)
{
	const char *errfmt = "*** NeuronVS Core(err): %s failed\n";
	*error = false;
	
	remote = 0;
	snddat = 0;
	engine = NULL;
	params = 0;
	noise  = 0;
	editor = 0;
	
	if(audioMaster)
	{
		SynthEditor *sed=0;
		bool err=false, test=true;
		int i;
		
		for(i=0; i<NUM_VST_PARAMS; i++)
		{
			mVstParams[i] = 0;
		}
		
		remote = new CRemote;
		test = (!remote) ? true : remote->IsBad();
		err |= test; if(test) fprintf(stderr,errfmt,"remote");
		
		snddat = new SoundParams;
		test = (!snddat) ? true : snddat->IsBad();
		err |= test; if(test) fprintf(stderr,errfmt,"snddat"); 
		
		engine = NASEngineCreate();
		test = (!engine) ? true : false;
		err |= test; if(test) fprintf(stderr,errfmt,"engine");
		
		params = new ModuleParams(engine,snddat);
		test = (!params) ? true : params->IsBad();
		err |= test; if(test) fprintf(stderr,errfmt,"params");
		
		// need to do this here, examine why
		{
			mActualSound.mMin = 0.;
			mActualSound.mMax = 999.;
			mActualSoundNtf.inf[0] = this;
			mActualSoundNtf.inf[1] = 0;
			mActualSoundNtf.PstCbFn = stNewSound;
			mActualSound.AddNotify(&mActualSoundNtf,true);
		}
		
		noise  = new ModuleEngine(this,engine,params);
		test = (!noise) ? true : noise->IsBad();
		err |= test; if(test) fprintf(stderr,errfmt,"noise");
		
		sed = new SynthEditor(this);
		test = (!sed) ? true : sed->IsBad();
		err |= test; if(test) fprintf(stderr,errfmt,"editor");
		
		if(!err)
		{
			for(i=0; i<NUM_VST_PARAMS; i++)
			{
				const static int autparam[NUM_VST_PARAMS] =
				{
					R1L1Sphere1Value,R1L1Sphere2Value,
					R1L2Sphere1Value,R1L2Sphere2Value,
					R1L3Sphere1Value,R1L3Sphere2Value,
					R1L1Scape1Value,R1L1Scape2Value,
					R1L2Scape1Value,R1L2Scape2Value,
					R1L3Scape1Value,R1L3Scape2Value,
					
					R2L1Sphere1Value,R2L1Sphere2Value,
					R2L2Sphere1Value,R2L2Sphere2Value,
					R2L3Sphere1Value,R2L3Sphere2Value,
					R2L1Scape1Value,R2L1Scape2Value,
					R2L2Scape1Value,R2L2Scape2Value,
					R2L3Scape1Value,R2L3Scape2Value,
					
					FilterFreq, FilterReso,
				};
				
				mVstParamsNtf[i].clear();
				mVstParamsNtf[i].min = 0.;
				mVstParamsNtf[i].max = 1.;
				mVstParamsNtf[i].inf[0] = this;
				mVstParamsNtf[i].inf[1] = (void *)i;
				mVstParamsNtf[i].PstCbFn = stVstParam;
				mVstParams[i] = snddat->mParam + autparam[i];
				mVstParams[i]->AddNotify(&mVstParamsNtf[i],false,NFLG_FORCE|NFLG_ALL);
			}
			
			noise->SetNewPrgCb(stNewPrg,this);
			
			setNumInputs(0);  // no inputs, doesn't work anyways
			setNumOutputs(2); // 2 outputs
			canProcessReplacing();
			hasVu(false);
			hasClip(false);
			isSynth();
			setUniqueID('NAS2');			// NeuronVS tag
			editor = sed;
			
			
			if(remote)
			{
				void (*authcb[])(void*) = {stDeny,stAllow};
				remote->SetAuthCb(authcb,sed);
			}
			
			// SMB NEW
			//			stAllow(sed);
			
		}
		else
		{
			*error = true;
			fprintf(stderr,errfmt,"components");
			this->~SynthCore();
		}
	}
	else
	{
		fprintf(stderr,errfmt,"audiomaster");
		*error = true;
	}
	
	suspend();
}