예제 #1
0
//-----------------------------------------------------------------------------
tresult PLUGIN_API MultiBandController::getParamStringByValue (ParamID tag, ParamValue valueNormalized, String128 string)
{
	UString128 result;
	switch (tag)
	{
		case 1:
		{
			float fi1 = (float)pow (10.0,valueNormalized - 1.70);
			result.printInt (getSampleRate () * fi1 * (0.098 + 0.09*fi1 + 0.5*(float)pow (fi1,8.2f)));
			break;
		}
		case 2:
		{
			float fi2 = (float)pow (10.0,valueNormalized - 1.05);
			result.printInt (getSampleRate () * fi2 * (0.015 + 0.15*fi2 + 0.9*(float)pow (fi2,8.2f)));
			break;
		}
		case 9:
		{
			float att2 = (float)pow (10.0, -0.05 -(2.0 * valueNormalized));
			result.printInt (-301030.1 / (getSampleRate () * log10(1.0 - att2)));
			break;
		}
		case 10:
		{
			float rel2 = (float)pow (10.0, -2.0 - (3.0 * valueNormalized));
			result.printInt (-301.0301 / (getSampleRate () * log10(1.0 - rel2)));
			break;
		}
		default:
			return BaseController::getParamStringByValue (tag, valueNormalized, string);
	}
	result.copyTo (string, 128);
	return kResultTrue;
}
예제 #2
0
//-----------------------------------------------------------------------------
tresult NoteExpressionType::getStringByValue (NoteExpressionValue valueNormalized /*in*/, String128 string /*out*/)
{
	if (associatedParameter)
	{
		associatedParameter->toString (valueNormalized, string);
		return kResultTrue;
	}
	UString128 wrapper;
	if (info.valueDesc.stepCount > 0)
	{
		int32 value = Min<int32> (info.valueDesc.stepCount, (int32)(valueNormalized * (info.valueDesc.stepCount + 1)));
		wrapper.printInt (value);
	}
	else
	{
		wrapper.printFloat (valueNormalized, precision);
	}
	wrapper.copyTo (string, 128);
	return kResultTrue;
}