added set_long, set_float and set_atoms methods to min::instance class #199
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I added these 3 setters, because I'm currently working on an external that exposes as parameter to Ableton Live via the getvalueof/setvalueof interface. To set attributes on this exposed parameter, i have to edit attributes on the object using
max::object_attr_setlong, max::object_attr_setfloat and max::object_attr_setvalueof
so I wrapped those in the same place where object_attr_setchar and object_attr_setsym are wrapped. I'm not sure if there's a better way to overload the existing set functions for a more consistent call style, but when I tried just overloading them everything became ambigous obviously.
Here's a simplified snippet from my code where I use these new functions on a min::box that exposes the getvalueof/setvalueof interface:
min::box box; MyParamWrapper paramProp; box.set ("parameter_enable", 1); box.set ("presentation", 1); box.set ("_parameter_initial_enable", 1); box.set_long ("_parameter_type", getMaxParameterType () ); box.set_float ("_parameter_initial", paramProp.getInitialValue ()); const auto paramId = paramProp.getName ().toRawUTF8(); const auto displayName = paramProp.getDisplayName ().toRawUTF8(); const auto range = paramProp.getRange (); box.set ("_parameter_longname", displayName); box.set ("_parameter_shortname", displayName); box.set_long ("_parameter_steps", paramProp.getNumSteps ()); box.set ("_parameter_unitstyle", 9 /*custom*/); box.set ("_parameter_units", paramProp.getUnit ().toRawUTF8()); box.set ("_parameter_invisible", paramProp.hasYumMetaData () ? 0 : 1); if (paramProp.isEnum ()) { min::atoms enumAtoms; for (auto enumVal : paramProp.getEnumValues ()) enumAtoms.push_back (min::atom { enumVal.toRawUTF8() }); box.set_atoms ("_parameter_range", enumAtoms); } else { box.set_atoms ("_parameter_range", min::atoms { min::atom { range.getStart () }, min::atom { range.getEnd () } }); }