示例#1
0
//-----------------------------------------------------------------------------
NoteExpressionType::NoteExpressionType (NoteExpressionTypeID _typeId, const TChar* _title, const TChar* _shortTitle, const TChar* _units,
										int32 _unitId, Parameter* _associatedParameter, int32 _flags)
: associatedParameter (_associatedParameter)
, precision (4)
{
	memset (&info, 0, sizeof (info));
	info.typeId = _typeId;
	if (_title)
		UString (info.title, str16BufferSize (String128)).assign (_title);
	if (_shortTitle)
		UString (info.shortTitle, str16BufferSize (String128)).assign (_shortTitle);
	if (_units)
		UString (info.shortTitle, str16BufferSize (String128)).assign (_units);
	info.unitId = _unitId;
	info.valueDesc.defaultValue = 0.5;
	info.valueDesc.minimum = 0.;
	info.valueDesc.maximum = 1.;
	info.flags = _flags;
	if (_associatedParameter)
	{
		info.valueDesc.stepCount = _associatedParameter->getInfo ().stepCount;
		info.valueDesc.defaultValue = _associatedParameter->getInfo ().defaultNormalizedValue;
		info.associatedParameterId = associatedParameter->getInfo ().id;
		info.flags |= NoteExpressionTypeInfo::kAssociatedParameterIDValid;
	}
}
示例#2
0
//------------------------------------------------------------------------
Parameter* ParameterContainer::addParameter (const TChar* title, const TChar* units,
                                             int32 stepCount, ParamValue defaultNormalizedValue,
                                             int32 flags, int32 tag, UnitID unitID, const TChar* shortTitle)
{
	if (!title)
	{
		return nullptr;
	}

	ParameterInfo info = {0};

	UString (info.title, str16BufferSize (String128)).assign (title);
	if (units)
		UString (info.units, str16BufferSize (String128)).assign (units);
	if (shortTitle)
		UString (info.shortTitle, str16BufferSize (String128)).assign (shortTitle);

	info.stepCount = stepCount;
	info.defaultNormalizedValue = defaultNormalizedValue;
	info.flags = flags;
	info.id = (tag >= 0) ? tag : getParameterCount ();
	info.unitId = unitID;

	return addParameter (info);
}
示例#3
0
//------------------------------------------------------------------------
StringListParameter::StringListParameter (const TChar* title, ParamID tag, const TChar* units,
                                          int32 flags, UnitID unitID, const TChar* shortTitle)
{
	UString (info.title, str16BufferSize (String128)).assign (title);
	if (units)
		UString (info.units, str16BufferSize (String128)).assign (units);
	if (shortTitle)
		UString (info.shortTitle, str16BufferSize (String128)).assign (shortTitle);

	info.stepCount = -1;
	info.defaultNormalizedValue = 0;
	info.flags = flags;
	info.id = tag;
	info.unitId = unitID;
}
示例#4
0
//------------------------------------------------------------------------
bool Bus::getInfo (BusInfo& info)
{
	name.copyTo (info.name, 0, str16BufferSize (info.name) - 1);
	info.busType = busType;
	info.flags = flags;
	return true;
}
示例#5
0
//------------------------------------------------------------------------
RangeParameter::RangeParameter (const TChar* title, ParamID tag, const TChar* units,
                                ParamValue minPlain, ParamValue maxPlain,
                                ParamValue defaultValuePlain, int32 stepCount, int32 flags,
                                UnitID unitID, const TChar* shortTitle)
: minPlain (minPlain), maxPlain (maxPlain)
{
	UString (info.title, str16BufferSize (String128)).assign (title);
	if (units)
		UString (info.units, str16BufferSize (String128)).assign (units);
	if (shortTitle)
		UString (info.shortTitle, str16BufferSize (String128)).assign (shortTitle);

	info.stepCount = stepCount;
	info.defaultNormalizedValue = valueNormalized = toNormalized (defaultValuePlain);
	info.flags = flags;
	info.id = tag;
	info.unitId = unitID;
}
示例#6
0
//------------------------------------------------------------------------
Parameter::Parameter (const TChar* title, ParamID tag, const TChar* units,
                      ParamValue defaultValueNormalized, int32 stepCount, int32 flags,
                      UnitID unitID, const TChar* shortTitle)
: precision (4)
{
	info = { 0 };

	UString (info.title, str16BufferSize (String128)).assign (title);
	if (units)
		UString (info.units, str16BufferSize (String128)).assign (units);
	if (shortTitle)
		UString (info.shortTitle, str16BufferSize (String128)).assign (shortTitle);

	info.stepCount = stepCount;
	info.defaultNormalizedValue = valueNormalized = defaultValueNormalized;
	info.flags = flags;
	info.id = tag;
	info.unitId = unitID;
}
示例#7
0
//-----------------------------------------------------------------------------
NoteExpressionType::NoteExpressionType (NoteExpressionTypeID _typeId, const TChar* _title, const TChar* _shortTitle, const TChar* _units,
										int32 _unitId, NoteExpressionValue _defaultValue, NoteExpressionValue _minimum, NoteExpressionValue _maximum,
										int32 _stepCount, int32 _flags, int32 _precision)
: precision (_precision)
{
	memset (&info, 0, sizeof (info));
	info.typeId = _typeId;
	if (_title)
		UString (info.title, str16BufferSize (String128)).assign (_title);
	if (_shortTitle)
		UString (info.shortTitle, str16BufferSize (String128)).assign (_shortTitle);
	if (_units)
		UString (info.shortTitle, str16BufferSize (String128)).assign (_units);
	info.unitId = _unitId;
	info.valueDesc.defaultValue = _defaultValue;
	info.valueDesc.minimum = _minimum;
	info.valueDesc.maximum = _maximum;
	info.valueDesc.stepCount = _stepCount;
	info.flags = _flags;
}
示例#8
0
//------------------------------------------------------------------------
void StringListParameter::toString (ParamValue _valueNormalized, String128 string) const
{
	int32 index = (int32)toPlain (_valueNormalized);
	const TChar* valueString = strings.at (index);
	if (valueString)
	{
		UString (string, str16BufferSize (String128)).assign (valueString);
	}
	else
		string[0] = 0;
}
示例#9
0
//------------------------------------------------------------------------
void RangeParameter::toString (ParamValue _valueNormalized, String128 string) const
{
	if (info.stepCount > 1)
	{
		UString wrapper (string, str16BufferSize (String128));
		int64 plain = static_cast<int64> (toPlain (_valueNormalized));
		if (!wrapper.printInt (plain))
			string[0] = 0;
	}
	else
	{
		Parameter::toString (toPlain (_valueNormalized), string);
	}
}
示例#10
0
//------------------------------------------------------------------------
void Parameter::toString (ParamValue normValue, String128 string) const
{
	UString wrapper (string, str16BufferSize (String128));
	if (info.stepCount == 1)
	{
		if (normValue > 0.5)
		{
			wrapper.assign (STR16 ("On"));
		}
		else
		{
			wrapper.assign (STR16 ("Off"));
		}
	}
	else
	{
		if (!wrapper.printFloat (normValue, precision))
			string[0] = 0;
	}
}