[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[sc-dev] UGen Creation q



Ok, i fixed the mistake recompiled that plugin and
then checked out a new version of sc but it still
doesnt work i get this error, any thoughts?

I put the plugin in plugins and the sc file in common

*** ERROR: dlsym _load err 'symbol not found'
exception in GrafDef_Load: UGen 'LFPulseLock' not
installed.

LFPulseLock : UGen {
	*ar {
		arg freq = 440.0, iphase = 0.0, width = 0.5, mul =
1.0, add = 0.0;
		^this.multiNew('audio', freq, iphase,
width).madd(mul, add)
	}
	*kr {
		arg freq = 440.0, iphase = 0.0, width = 0.5, mul =
1.0, add = 0.0;
		^this.multiNew('control', freq, iphase,
width).madd(mul, add)
	}
	signalRange { ^\unipolar }
}

#include "SC_PlugIn.h"

static InterfaceTable *ft;


struct LFPulseLock : public Unit
{
	float mPhase, mFreqMul, mDuty;
	float mPrevFreq;
};

extern "C"
{
    void LFPulseLock_next_a(LFPulseLock *unit, int
inNumSamples);
    void LFPulseLock_next_k(LFPulseLock *unit, int
inNumSamples);
    void LFPulseLock_Ctor(LFPulseLock* unit);
}

void LFPulseLock_next_a(LFPulseLock *unit, int
inNumSamples)
{
	float *out = ZOUT(0);
	float *freq = ZIN(0);
	float nextDuty = ZIN0(2);
	float duty = unit->mDuty;
	
	float freqmul = unit->mFreqMul;
	float phase = unit->mPhase;
	float frequency = unit->mPrevFreq;
	
	LOOP(inNumSamples, 
		float z;
		if (phase >= 1.f) {
			phase -= 1.f;
			duty = unit->mDuty = nextDuty;
			// output at least one sample from the opposite
polarity
			z = duty < 0.5 ? 1.f : 0.f;
			frequency = ZXP(freq) * freqmul;
		} else {
			z = phase < duty ? 1.f : 0.f;
			ZXP(freq);
		}

		phase += frequency;
		ZXP(out) = z;
	);

	unit->mPrevFreq = frequency;
	unit->mPhase = phase;
}

void LFPulseLock_next_k(LFPulseLock *unit, int
inNumSamples)
{
	float *out = ZOUT(0);
	float freq = ZIN0(0) * unit->mFreqMul;
	float nextDuty = ZIN0(2);
	float duty = unit->mDuty;
	
	float phase = unit->mPhase;
	float frequency = unit->mPrevFreq;
	LOOP(inNumSamples, 
		float z;
		if (phase >= 1.f) {
			phase -= 1.f;
			duty = unit->mDuty = nextDuty;
			// output at least one sample from the opposite
polarity
			z = duty < 0.5 ? 1.f : 0.f;
			frequency = freq;
		} else {
			z = phase < duty ? 1.f : 0.f;
		}
		phase += frequency;
		ZXP(out) = z;
	);

	unit->mPrevFreq = frequency;
	unit->mPhase = phase;
}

void LFPulseLock_Ctor(LFPulseLock* unit)
{
	if (INRATE(0) == calc_FullRate) {
		SETCALC(LFPulseLock_next_a);
	} else {
		SETCALC(LFPulseLock_next_k);
	}

	unit->mFreqMul = unit->mRate->mSampleDur;
	unit->mPhase = ZIN0(1);
	unit->mDuty = ZIN0(2);
	unit->mPrevFreq = ZIN0(0) * unit->mFreqMul;
	
	LFPulseLock_next_k(unit, 1);

}

void load(InterfaceTable *inTable)
{
	ft = inTable;

	DefineSimpleUnit(LFPulseLock);
}

__________________________________________________
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com