tresult PLUGIN_API Plugin::process (ProcessData& data)
{
    if (hasInputParameterChanged(data, kCrackleAmountId)) {
        float amount = getInputParameterChange(data, kCrackleAmountId);
        leftProcessor.setCrackleAmount(amount);
        rightProcessor.setCrackleAmount(amount);
    }
    if (hasInputParameterChanged(data, kCrackleDepthId)) {
        float depth = getInputParameterChange(data, kCrackleDepthId);
        depth = depth/2;
        leftProcessor.setCrackleDepth(depth);
        rightProcessor.setCrackleDepth(depth);
    }

    if (numChannels > 0) {
        float* leftInputChannel = data.inputs[0].channelBuffers32[0];
        float* leftOutputChannel = data.outputs[0].channelBuffers32[0];
        leftProcessor.process(leftInputChannel, leftOutputChannel, data.numSamples);
    }
    if (numChannels > 1) {
        float* rightInputChannel = data.inputs[0].channelBuffers32[1];
        float* rightOutputChannel = data.outputs[0].channelBuffers32[1];
        rightProcessor.process(rightInputChannel, rightOutputChannel, data.numSamples);
    }
    return kResultTrue;
}
tresult PLUGIN_API Plugin::process (ProcessData& data)
{
    if (hasInputParameterChanged(data, kFrequencyId)){
        float frequency = getInputParameterChange(data, kFrequencyId);
		leftProcessor.setFrequency(frequency);
		rightProcessor.setFrequency(frequency);
    }
	if (hasInputParameterChanged(data, kDepthId)){
        float depth = getInputParameterChange(data, kDepthId);
		leftProcessor.setDepth(depth);
		rightProcessor.setDepth(depth);
    }
 	if (numChannels > 0){
		float* leftInputChannel = data.inputs[0].channelBuffers32[0];
		float* leftOutputChannel = data.outputs[0].channelBuffers32[0];
		leftProcessor.process(leftInputChannel, leftOutputChannel, data.numSamples);
	}
	if (numChannels > 1){
		float* rightInputChannel = data.inputs[0].channelBuffers32[1];
		float* rightOutputChannel = data.outputs[0].channelBuffers32[1];
		rightProcessor.process(rightInputChannel, rightOutputChannel, data.numSamples);
	}
	return kResultTrue;
}
Beispiel #3
0
tresult PLUGIN_API Instrument::process (ProcessData& data)
{
	// MIDI Events aus der Liste aller Events für diesen Block auslesen
	IEventList* inputEvents = data.inputEvents;
	if (inputEvents != 0) {
		Event e;
		int32 numEvents = inputEvents->getEventCount ();
		for (int32 i = 0; i < numEvents; i++) {
			if (inputEvents->getEvent (i, e) == kResultTrue) {
				if (e.type == Event::kNoteOnEvent) {
					if (e.noteOn.noteId == -1) { // for host which don't send unique noteId's
						e.noteOn.noteId = e.noteOn.pitch;
					}
					leftProcessor.noteOn(e.noteOn.pitch, e.noteOn.velocity);
					rightProcessor.noteOn(e.noteOn.pitch, e.noteOn.velocity);
				}
				else if (e.type == Event::kNoteOffEvent) {
					if (e.noteOn.noteId == -1) { // for host which don't send unique noteId's
						e.noteOn.noteId = e.noteOn.pitch;
					}
					leftProcessor.noteOff();
					rightProcessor.noteOff();
				}
			}
		}
	}
    if (hasInputParameterChanged(data, kGainId)){
        float paramValue = getInputParameterChange(data, kGainId);
		float dB = 106 * paramValue - 100;
		float gain = pow(10, dB/20);
		leftProcessor.setGain(gain);
		rightProcessor.setGain(gain);
    }
 
	if (numChannels > 0){
		float* leftOutputChannel = data.outputs[0].channelBuffers32[0];
		leftProcessor.process(leftOutputChannel, data.numSamples);
	}
	if (numChannels > 1){
		float* rightOutputChannel = data.outputs[0].channelBuffers32[1];
		rightProcessor.process(rightOutputChannel, data.numSamples);
	}
	return kResultTrue;
}
Beispiel #4
0
tresult PLUGIN_API Plugin::process (ProcessData& data)
{
    if (hasInputParameterChanged(data, kGainId)){
        float paramValue = getInputParameterChange(data, kGainId);
		float dB = 106 * paramValue - 100;
		float gain = pow(10, dB/20);
		leftProcessor.setGain(gain);
		rightProcessor.setGain(gain);
    }
 	if (numChannels > 0){
		float* leftInputChannel = data.inputs[0].channelBuffers32[0];
		float* leftOutputChannel = data.outputs[0].channelBuffers32[0];
		leftProcessor.process(leftInputChannel, leftOutputChannel, data.numSamples);
	}
	if (numChannels > 1){
		float* rightInputChannel = data.inputs[0].channelBuffers32[1];
		float* rightOutputChannel = data.outputs[0].channelBuffers32[1];
		rightProcessor.process(rightInputChannel, rightOutputChannel, data.numSamples);
	}
	return kResultTrue;
}
tresult PLUGIN_API Instrument::process (ProcessData& data)
{
   if (hasInputParameterChanged(data, kGainId)){
        float gain = getInputParameterChange(data, kGainId);
		float dB = 20 * log(gain);
		processor.setGain(dB);
    }

   if (hasInputParameterChanged(data, kAttackId)){
        float attack = getInputParameterChange(data, kAttackId) * 1000;
		processor.setAttack(attack);
    }

    if (hasInputParameterChanged(data, kDecayId)){
        float decay = getInputParameterChange(data, kDecayId) * 1000;
        processor.setDecay(decay);
    }

    if (hasInputParameterChanged(data, kSustainRateId)){
        float sustainRate = 20 * log(getInputParameterChange(data, kSustainRateId));
        processor.setSustainRate(sustainRate);
    }

   if (hasInputParameterChanged(data, kReleaseId)){
        float release = getInputParameterChange(data, kReleaseId) * 1000;
		processor.setRelease(release);
    }

   if (hasInputParameterChanged(data, kWaveTypeId)){
        float value = getInputParameterChange(data, kWaveTypeId);
		WaveType waveType = (WaveType) std::min<int8> ((int8)(NUMTYPES * value), NUMTYPES - 1);
		processor.setCutOff(CUTOFF_DEFAULT_FREQUENCY);
		processor.setType(waveType);
    }

   if (hasInputParameterChanged(data, kPWMId)){
        float pwm = getInputParameterChange(data, kPWMId) * 2 - 1;
		pwm = std::max<float>(-0.99,std::min<float>(0.99,pwm));
		processor.setPWM(pwm);
    }

   if (hasInputParameterChanged(data, kCutOffId)){
        float cutoff = getInputParameterChange(data, kCutOffId);
		cutoff *= cutoff * 19980;
		cutoff = cutoff + 20;
		processor.setCutOff(cutoff);
    }

   if (hasInputParameterChanged(data, kResId)){
        float res = getInputParameterChange(data, kResId);
		res *= 1.4;
		processor.setRes(res);
    }

   if (hasInputParameterChanged(data, kLFO_PWM_freqId)){
        float lfo_PWM_freq = getInputParameterChange(data, kLFO_PWM_freqId);
		lfo_PWM_freq *= 10;
		processor.setLFO_PWM_freq(lfo_PWM_freq);
    }

   if (hasInputParameterChanged(data, kLFO_autopan_freqId)){
        float lfo_autopan_freq = getInputParameterChange(data, kLFO_autopan_freqId);
		lfo_autopan_freq *= 15;
		processor.setLFO_autopan_freq(lfo_autopan_freq);
    }

   if (hasInputParameterChanged(data, kLFO_autopan_phaseId)){
        float lfo_autopan_phase = getInputParameterChange(data, kLFO_autopan_phaseId);
		lfo_autopan_phase *= 3.14;
		processor.setLFO_autopan_phase(lfo_autopan_phase);
    }
   

    // MIDI Events aus der Liste aller Events für diesen Block auslesen
	IEventList* inputEvents = data.inputEvents;
	if (inputEvents != 0) {
		Event e;
		int32 numEvents = inputEvents->getEventCount ();
		for (int32 i = 0; i < numEvents; i++) {
			if (inputEvents->getEvent (i, e) == kResultTrue) {
				if (e.type == Event::kNoteOnEvent) {
					if (e.noteOn.noteId == -1) { // for host which don't send unique noteId's
						e.noteOn.noteId = e.noteOn.pitch;
					}
					processor.noteOn(e.noteOn.pitch, e.noteOn.velocity);
				}
				else if (e.type == Event::kNoteOffEvent) {
					if (e.noteOn.noteId == -1) { // for host which don't send unique noteId's
						e.noteOn.noteId = e.noteOn.pitch;
					}
					processor.noteOff(e.noteOn.pitch);
				}
			}
		}
	}
	/*
	if (numChannels > 0){
		float* leftOutputChannel = data.outputs[0].channelBuffers32[0];
		processor.process(leftOutputChannel, leftOutputChannel, data.numSamples);
	}
	*/
	if (numChannels > 1){
		float* leftOutputChannel = data.outputs[0].channelBuffers32[0];
		float* rightOutputChannel = data.outputs[0].channelBuffers32[1];
		processor.process(leftOutputChannel, rightOutputChannel, data.numSamples);
	}
	return kResultTrue;
}
Beispiel #6
0
		tresult PLUGIN_API Plugin::process (ProcessData& data)
		{

			/* --- Low Band Changes --- */

			if (hasInputParameterChanged(data, kFilterTypeLowId)){
				float value = getInputParameterChange(data, kFilterTypeLowId);
				FilterType filterType = (FilterType) std::min<int8> ((int8)(NUMTYPES * value), NUMTYPES - 1);
				leftProcessor.lowBand.setType(filterType);
				rightProcessor.lowBand.setType(filterType);
			}
			if (hasInputParameterChanged(data, kFrequencyLowId)){
				float param = getInputParameterChange(data, kFrequencyLowId);
				float frequency = MINFREQ_low + param * (MAXFREQ_low - MINFREQ_low);
				leftProcessor.lowBand.setFrequency(frequency);
				rightProcessor.lowBand.setFrequency(frequency);
			}
			if (hasInputParameterChanged(data, kGainLowId)){
				float param = getInputParameterChange(data, kGainLowId);
				float gain = -MAXGAIN + (param * 2 * MAXGAIN);
				leftProcessor.lowBand.setGain(gain);
				rightProcessor.lowBand.setGain(gain);
			}
			if (hasInputParameterChanged(data, kQLowId)){
				float param = getInputParameterChange(data, kQLowId);		
				float Q = 1 + (MAXQ - 1) * param;
				leftProcessor.lowBand.setQ(Q);
				rightProcessor.lowBand.setQ(Q);	
			}
			if (hasInputParameterChanged(data, kBypassLowId)){
				bool param = getInputParameterChange(data, kBypassLowId);		
				leftProcessor.lowBand.setBypass(param);
				rightProcessor.lowBand.setBypass(param);	
			}

			/* --- Mid Band 1 Changes --- */

			if (hasInputParameterChanged(data, kFilterTypeMid1Id)){
				float value = getInputParameterChange(data, kFilterTypeMid1Id);
				FilterType filterType = (FilterType) std::min<int8> ((int8)(NUMTYPES * value), NUMTYPES - 1);
				leftProcessor.midBand1.setType(filterType);
				rightProcessor.midBand1.setType(filterType);
			}
			if (hasInputParameterChanged(data, kFrequencyMid1Id)){
				float param = getInputParameterChange(data, kFrequencyMid1Id);
				float frequency = MINFREQ_mid1 + param * (MAXFREQ_mid1 - MINFREQ_mid1);
				leftProcessor.midBand1.setFrequency(frequency);
				rightProcessor.midBand1.setFrequency(frequency);
			}
			if (hasInputParameterChanged(data, kGainMid1Id)){
				float param = getInputParameterChange(data, kGainMid1Id);
				float gain = -MAXGAIN + (param * 2 * MAXGAIN);
				leftProcessor.midBand1.setGain(gain);
				rightProcessor.midBand1.setGain(gain);
			}
			if (hasInputParameterChanged(data, kQMid1Id)){
				float param = getInputParameterChange(data, kQMid1Id);		
				float Q = 1 + (MAXQ - 1) * param;
				leftProcessor.midBand1.setQ(Q);
				rightProcessor.midBand1.setQ(Q);
			}
            if (hasInputParameterChanged(data, kBypassMid1Id)){
				bool param = getInputParameterChange(data, kBypassMid1Id);
				leftProcessor.midBand1.setBypass(param);
				rightProcessor.midBand1.setBypass(param);
			}

			/* --- Mid Band 2 Changes --- */

			if (hasInputParameterChanged(data, kFilterTypeMid2Id)){
				float value = getInputParameterChange(data, kFilterTypeMid2Id);
				FilterType filterType = (FilterType) std::min<int8> ((int8)(NUMTYPES * value), NUMTYPES - 1);
				leftProcessor.midBand2.setType(filterType);
				rightProcessor.midBand2.setType(filterType);
			}
			if (hasInputParameterChanged(data, kFrequencyMid2Id)){
				float param = getInputParameterChange(data, kFrequencyMid2Id);
				float frequency = MINFREQ_mid2 + param * (MAXFREQ_mid2 - MINFREQ_mid2);
				leftProcessor.midBand2.setFrequency(frequency);
				rightProcessor.midBand2.setFrequency(frequency);
			}
			if (hasInputParameterChanged(data, kGainMid2Id)){
				float param = getInputParameterChange(data, kGainMid2Id);
				float gain = -MAXGAIN + (param * 2 * MAXGAIN);
				leftProcessor.midBand2.setGain(gain);
				rightProcessor.midBand2.setGain(gain);
			}
			if (hasInputParameterChanged(data, kQMid2Id)){
				float param = getInputParameterChange(data, kQMid2Id);		
				float Q = 1 + (MAXQ - 1) * param;
				leftProcessor.midBand2.setQ(Q);
				rightProcessor.midBand2.setQ(Q);
			}
            if (hasInputParameterChanged(data, kBypassMid2Id)){
				bool param = getInputParameterChange(data, kBypassMid2Id);
				leftProcessor.midBand2.setBypass(param);
				rightProcessor.midBand2.setBypass(param);
			}
            
            /* --- Mid Band 3 Changes --- */
            
			if (hasInputParameterChanged(data, kFilterTypeMid3Id)){
				float value = getInputParameterChange(data, kFilterTypeMid3Id);
				FilterType filterType = (FilterType) std::min<int8> ((int8)(NUMTYPES * value), NUMTYPES - 1);
				leftProcessor.midBand3.setType(filterType);
				rightProcessor.midBand3.setType(filterType);
			}
			if (hasInputParameterChanged(data, kFrequencyMid3Id)){
				float param = getInputParameterChange(data, kFrequencyMid3Id);
				float frequency = MINFREQ_mid3 + param * (MAXFREQ_mid3 - MINFREQ_mid3);
				leftProcessor.midBand3.setFrequency(frequency);
				rightProcessor.midBand3.setFrequency(frequency);
			}
			if (hasInputParameterChanged(data, kGainMid3Id)){
				float param = getInputParameterChange(data, kGainMid3Id);
				float gain = -MAXGAIN + (param * 2 * MAXGAIN);
				leftProcessor.midBand3.setGain(gain);
				rightProcessor.midBand3.setGain(gain);
			}
			if (hasInputParameterChanged(data, kQMid3Id)){
				float param = getInputParameterChange(data, kQMid3Id);
				float Q = 1 + (MAXQ - 1) * param;
				leftProcessor.midBand3.setQ(Q);
				rightProcessor.midBand3.setQ(Q);
			}
            if (hasInputParameterChanged(data, kBypassMid3Id)){
				bool param = getInputParameterChange(data, kBypassMid3Id);
				leftProcessor.midBand3.setBypass(param);
				rightProcessor.midBand3.setBypass(param);
			}
            
            /* --- Mid Band 4 Changes --- */
            
			if (hasInputParameterChanged(data, kFilterTypeMid4Id)){
				float value = getInputParameterChange(data, kFilterTypeMid4Id);
				FilterType filterType = (FilterType) std::min<int8> ((int8)(NUMTYPES * value), NUMTYPES - 1);
				leftProcessor.midBand4.setType(filterType);
				rightProcessor.midBand4.setType(filterType);
			}
			if (hasInputParameterChanged(data, kFrequencyMid4Id)){
				float param = getInputParameterChange(data, kFrequencyMid4Id);
				float frequency = MINFREQ_mid4 + param * (MAXFREQ_mid4 - MINFREQ_mid4);
				leftProcessor.midBand4.setFrequency(frequency);
				rightProcessor.midBand4.setFrequency(frequency);
			}
			if (hasInputParameterChanged(data, kGainMid4Id)){
				float param = getInputParameterChange(data, kGainMid4Id);
				float gain = -MAXGAIN + (param * 2 * MAXGAIN);
				leftProcessor.midBand4.setGain(gain);
				rightProcessor.midBand4.setGain(gain);
			}
			if (hasInputParameterChanged(data, kQMid4Id)){
				float param = getInputParameterChange(data, kQMid4Id);
				float Q = 1 + (MAXQ - 1) * param;
				leftProcessor.midBand4.setQ(Q);
				rightProcessor.midBand4.setQ(Q);
			}
            if (hasInputParameterChanged(data, kBypassMid4Id)){
				bool param = getInputParameterChange(data, kBypassMid4Id);
				leftProcessor.midBand4.setBypass(param);
				rightProcessor.midBand4.setBypass(param);
			}
            
			/* --- high Band Changes --- */

			if (hasInputParameterChanged(data, kFilterTypeHighId)){
				float value = getInputParameterChange(data, kFilterTypeHighId);
				FilterType filterType = (FilterType) std::min<int8> ((int8)(NUMTYPES * value), NUMTYPES - 1);
				leftProcessor.highBand.setType(filterType);
				rightProcessor.highBand.setType(filterType);
			}
			if (hasInputParameterChanged(data, kFrequencyHighId)){
				float param = getInputParameterChange(data, kFrequencyHighId);
				float frequency = MINFREQ_high + param * (MAXFREQ_high - MINFREQ_high);
				leftProcessor.highBand.setFrequency(frequency);
				rightProcessor.highBand.setFrequency(frequency);
			}
			if (hasInputParameterChanged(data, kGainHighId)){
				float param = getInputParameterChange(data, kGainHighId);
				float gain = -MAXGAIN + (param * 2 * MAXGAIN);
				leftProcessor.highBand.setGain(gain);
				rightProcessor.highBand.setGain(gain);
			}
			if (hasInputParameterChanged(data, kQHighId)){
				float param = getInputParameterChange(data, kQHighId);		
				float Q = 1 + (MAXQ - 1) * param;
				leftProcessor.highBand.setQ(Q);
				rightProcessor.highBand.setQ(Q);
			}
            if (hasInputParameterChanged(data, kBypassHighId)){
				bool param = getInputParameterChange(data, kBypassHighId);
				leftProcessor.highBand.setBypass(param);
				rightProcessor.highBand.setBypass(param);
			}

			if (numChannels > 0){
				float* leftInputChannel = data.inputs[0].channelBuffers32[0];
				float* leftOutputChannel = data.outputs[0].channelBuffers32[0];
				leftProcessor.process(leftInputChannel, leftOutputChannel, data.numSamples);
			}
			if (numChannels > 1){
				float* rightInputChannel = data.inputs[0].channelBuffers32[1];
				float* rightOutputChannel = data.outputs[0].channelBuffers32[1];
				rightProcessor.process(rightInputChannel, rightOutputChannel, data.numSamples);
			}
			return kResultTrue;
		}