Beispiel #1
0
//-----------------------------------------------------------------------------------------
// return the 0->1 version of the variable
float CPlugIn::getParameter (UINT index)
{
	if(index < 0) return 0.0;

	CUICtrl* pUICtrl = m_UIControlList.getAt(index);

	if(!pUICtrl)
	{
		return 0.0;
	}

	float fRawValue = 0;
	switch(pUICtrl->uUserDataType)
	{
		case intData:
		{
			fRawValue = calcSliderVariable(pUICtrl->fUserDisplayDataLoLimit, pUICtrl->fUserDisplayDataHiLimit, *(pUICtrl->m_pUserCookedIntData));
			break;
		}

		case floatData:
		{
			fRawValue = calcSliderVariable(pUICtrl->fUserDisplayDataLoLimit, pUICtrl->fUserDisplayDataHiLimit, *(pUICtrl->m_pUserCookedFloatData));
			break;
		}

		case doubleData:
		{
			fRawValue = calcSliderVariable(pUICtrl->fUserDisplayDataLoLimit, pUICtrl->fUserDisplayDataHiLimit, *(pUICtrl->m_pUserCookedDoubleData));
			break;
		}

		case UINTData:
		{
			fRawValue = calcSliderVariable(pUICtrl->fUserDisplayDataLoLimit, pUICtrl->fUserDisplayDataHiLimit, *(pUICtrl->m_pUserCookedUINTData));
			break;
		}

		default:
			break;
	}

	return fRawValue;
}
Beispiel #2
0
//------------------------------------------------------------------------
// setProgram()
// called by the client when the user selects a preset
void CSoftExciter::setProgram (VstInt32 program)
{
	// store (this is a base class variable
	curProgram = program;

	if(m_pRAFXPlugIn)
	{
		int nParams = m_pRAFXPlugIn->m_UIControlList.countLegalVSTIF();

		// iterate
		for(int i = 0; i < nParams; i++)
		{
			// they are in AU proper order in the ControlList - do NOT reference them with RackAFX ID values any more!
			CUICtrl* pUICtrl = m_pRAFXPlugIn->m_UIControlList.getAt(i);

			if(pUICtrl)
			{
				// call our own setParameter()
				setParameter(i, calcSliderVariable(pUICtrl->fUserDisplayDataLoLimit,
												   pUICtrl->fUserDisplayDataHiLimit,
												   pUICtrl->dPresetData[curProgram])); // control object stores its presets!
			}
		}

		// now do the Vector Joystick Programs
		float* pJSProg = m_pRAFXPlugIn->m_PresetJSPrograms[curProgram];
		for(int i=0; i<MAX_JS_PROGRAM_STEPS; i++)
		{
			m_pRAFXPlugIn->m_pVectorJSProgram[JS_PROG_INDEX(i,0)] = pJSProg[JS_PROG_INDEX(i,0)];
			m_pRAFXPlugIn->m_pVectorJSProgram[JS_PROG_INDEX(i,1)] = pJSProg[JS_PROG_INDEX(i,1)];
			m_pRAFXPlugIn->m_pVectorJSProgram[JS_PROG_INDEX(i,2)] = pJSProg[JS_PROG_INDEX(i,2)];
			m_pRAFXPlugIn->m_pVectorJSProgram[JS_PROG_INDEX(i,3)] = pJSProg[JS_PROG_INDEX(i,3)];
			m_pRAFXPlugIn->m_pVectorJSProgram[JS_PROG_INDEX(i,4)] = pJSProg[JS_PROG_INDEX(i,4)];
			m_pRAFXPlugIn->m_pVectorJSProgram[JS_PROG_INDEX(i,5)] = pJSProg[JS_PROG_INDEX(i,5)];
			m_pRAFXPlugIn->m_pVectorJSProgram[JS_PROG_INDEX(i,6)] = pJSProg[JS_PROG_INDEX(i,6)];
		}
	}

	// now the additional presets (advanced, only if you support it)
	float* pPresetData = m_pRAFXPlugIn->m_AddlPresetValues[curProgram];
	if(pPresetData)
	{
		int nCount = m_pRAFXPlugIn->getNumAddtlPresets();
		for(int i=0; i<nCount; i++)
		{
			m_pRAFXPlugIn->setAddtlPresetValue(i, pPresetData[i]);
		}
	}
}