Just rename problematic Variant::VOID type.

This commit is contained in:
David Robillard 2014-11-07 17:21:43 -05:00
parent 4260d0ca0e
commit bb12c750bb
5 changed files with 16 additions and 20 deletions

View File

@ -42,7 +42,7 @@ struct ParameterDescriptor
ParameterDescriptor(const Evoral::Parameter& parameter)
: key((uint32_t)-1)
, datatype(Variant::VOID)
, datatype(Variant::NOTHING)
, unit(NONE)
, normal(parameter.normal())
, lower(parameter.min())
@ -66,7 +66,7 @@ struct ParameterDescriptor
ParameterDescriptor()
: key((uint32_t)-1)
, datatype(Variant::VOID)
, datatype(Variant::NOTHING)
, unit(NONE)
, normal(0)
, lower(0)

View File

@ -29,10 +29,6 @@
#include "ardour/libardour_visibility.h"
#include "pbd/compose.h"
#ifdef PLATFORM_WINDOWS
#undef VOID
#endif
namespace ARDOUR {
/** A value with dynamic type (tagged union). */
@ -40,7 +36,7 @@ class LIBARDOUR_API Variant
{
public:
enum Type {
VOID, ///< Nothing
NOTHING, ///< Nothing (void)
BOOL, ///< Boolean
DOUBLE, ///< C double (64-bit IEEE-754)
FLOAT, ///< C float (32-bit IEEE-754)
@ -51,12 +47,12 @@ public:
URI ///< URI string
};
explicit Variant() : _type(VOID) { _long = 0; }
explicit Variant(bool value) : _type(BOOL) { _bool = value; }
explicit Variant(double value) : _type(DOUBLE) { _double = value; }
explicit Variant(float value) : _type(FLOAT) { _float = value; }
explicit Variant(int32_t value) : _type(INT) { _int = value; }
explicit Variant(int64_t value) : _type(LONG) { _long = value; }
explicit Variant() : _type(NOTHING) { _long = 0; }
explicit Variant(bool value) : _type(BOOL) { _bool = value; }
explicit Variant(double value) : _type(DOUBLE) { _double = value; }
explicit Variant(float value) : _type(FLOAT) { _float = value; }
explicit Variant(int32_t value) : _type(INT) { _int = value; }
explicit Variant(int64_t value) : _type(LONG) { _long = value; }
/** Make a variant of a specific string type (string types only) */
Variant(Type type, const std::string& value)
@ -66,7 +62,7 @@ public:
/** Make a numeric variant from a double (numeric types only).
*
* If conversion is impossible, the variant will have type VOID.
* If conversion is impossible, the variant will have type NOTHING.
*/
Variant(Type type, double value)
: _type(type)
@ -90,7 +86,7 @@ public:
std::min(value, (double)INT64_MAX)));
break;
default:
_type = VOID;
_type = NOTHING;
_long = 0;
}
}

View File

@ -420,7 +420,7 @@ Automatable::control_factory(const Evoral::Parameter& param)
PluginInsert* pi = dynamic_cast<PluginInsert*>(this);
if (pi) {
desc = pi->plugin(0)->get_property_descriptor(param.id());
if (desc.datatype != Variant::VOID) {
if (desc.datatype != Variant::NOTHING) {
if (!Variant::type_is_numeric(desc.datatype)) {
list.reset(); // Can't automate non-numeric data yet
}

View File

@ -1222,7 +1222,7 @@ static void
forge_variant(LV2_Atom_Forge* forge, const Variant& value)
{
switch (value.type()) {
case Variant::VOID:
case Variant::NOTHING:
break;
case Variant::BOOL:
lv2_atom_forge_bool(forge, value.get_bool());
@ -1286,7 +1286,7 @@ LV2Plugin::set_property(uint32_t key, const Variant& value)
if (_patch_port_in_index == (uint32_t)-1) {
error << "LV2: set_property called with unset patch_port_in_index" << endmsg;
return;
} else if (value.type() == Variant::VOID) {
} else if (value.type() == Variant::NOTHING) {
error << "LV2: set_property called with void value" << endmsg;
return;
}

View File

@ -259,7 +259,7 @@ PluginInsert::create_automatable_parameters ()
} else if (i->type() == PluginPropertyAutomation) {
Evoral::Parameter param(*i);
const ParameterDescriptor& desc = _plugins.front()->get_property_descriptor(param.id());
if (desc.datatype != Variant::VOID) {
if (desc.datatype != Variant::NOTHING) {
boost::shared_ptr<AutomationList> list;
if (Variant::type_is_numeric(desc.datatype)) {
list = boost::shared_ptr<AutomationList>(new AutomationList(param));
@ -1313,7 +1313,7 @@ PluginInsert::PluginPropertyControl::set_value (double user_val)
This is lossy, but better than nothing until Ardour's automation system
can handle various datatypes all the way down. */
const Variant value(_desc.datatype, user_val);
if (value.type() == Variant::VOID) {
if (value.type() == Variant::NOTHING) {
error << "set_value(double) called for non-numeric property" << endmsg;
return;
}