summaryrefslogtreecommitdiffstats
path: root/src/server/ControlBindings.cpp
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2020-08-01 17:51:16 +0200
committerDavid Robillard <d@drobilla.net>2020-08-02 01:48:48 +0200
commitd13e41341f687b9f526887aba7e664d71ae34aec (patch)
tree2f68f12e6c182169ad840b1710fa3e376c47ed00 /src/server/ControlBindings.cpp
parent95ceaf902f95baa431cdda972c0ebb48293e2022 (diff)
downloadingen-d13e41341f687b9f526887aba7e664d71ae34aec.tar.gz
ingen-d13e41341f687b9f526887aba7e664d71ae34aec.tar.bz2
ingen-d13e41341f687b9f526887aba7e664d71ae34aec.zip
Use consistent naming for context parameters
Diffstat (limited to 'src/server/ControlBindings.cpp')
-rw-r--r--src/server/ControlBindings.cpp40
1 files changed, 20 insertions, 20 deletions
diff --git a/src/server/ControlBindings.cpp b/src/server/ControlBindings.cpp
index 4664b590..75acd7b2 100644
--- a/src/server/ControlBindings.cpp
+++ b/src/server/ControlBindings.cpp
@@ -220,18 +220,18 @@ ControlBindings::start_learn(PortImpl* port)
}
static void
-get_range(RunContext& context, const PortImpl* port, float* min, float* max)
+get_range(RunContext& ctx, const PortImpl* port, float* min, float* max)
{
*min = port->minimum().get<float>();
*max = port->maximum().get<float>();
if (port->is_sample_rate()) {
- *min *= context.engine().sample_rate();
- *max *= context.engine().sample_rate();
+ *min *= ctx.engine().sample_rate();
+ *max *= ctx.engine().sample_rate();
}
}
float
-ControlBindings::control_to_port_value(RunContext& context,
+ControlBindings::control_to_port_value(RunContext& ctx,
const PortImpl* port,
Type type,
int16_t value)
@@ -258,13 +258,13 @@ ControlBindings::control_to_port_value(RunContext& context,
float min = 0.0f;
float max = 1.0f;
- get_range(context, port, &min, &max);
+ get_range(ctx, port, &min, &max);
return normal * (max - min) + min;
}
int16_t
-ControlBindings::port_value_to_control(RunContext& context,
+ControlBindings::port_value_to_control(RunContext& ctx,
PortImpl* port,
Type type,
const Atom& value_atom)
@@ -275,7 +275,7 @@ ControlBindings::port_value_to_control(RunContext& context,
float min = 0.0f;
float max = 1.0f;
- get_range(context, port, &min, &max);
+ get_range(ctx, port, &min, &max);
const float value = value_atom.get<float>();
float normal = (value - min) / (max - min);
@@ -337,29 +337,29 @@ forge_binding(const URIs& uris,
}
void
-ControlBindings::set_port_value(RunContext& context,
+ControlBindings::set_port_value(RunContext& ctx,
PortImpl* port,
Type type,
int16_t value) const
{
float min = 0.0f;
float max = 1.0f;
- get_range(context, port, &min, &max);
+ get_range(ctx, port, &min, &max);
- const float val = control_to_port_value(context, port, type, value);
+ const float val = control_to_port_value(ctx, port, type, value);
// TODO: Set port value property so it is saved
- port->set_control_value(context, context.start(), val);
+ port->set_control_value(ctx, ctx.start(), val);
- URIs& uris = context.engine().world().uris();
- context.notify(uris.ingen_value, context.start(), port,
- sizeof(float), _forge.Float, &val);
+ URIs& uris = ctx.engine().world().uris();
+ ctx.notify(uris.ingen_value, ctx.start(), port,
+ sizeof(float), _forge.Float, &val);
}
bool
-ControlBindings::finish_learn(RunContext& context, Key key)
+ControlBindings::finish_learn(RunContext& ctx, Key key)
{
- const ingen::URIs& uris = context.engine().world().uris();
+ const ingen::URIs& uris = ctx.engine().world().uris();
Binding* binding = _learn_binding.exchange(nullptr);
if (!binding || (key.type == Type::MIDI_NOTE && !binding->port->is_toggled())) {
return false;
@@ -373,10 +373,10 @@ ControlBindings::finish_learn(RunContext& context, Key key)
lv2_atom_forge_set_buffer(&_forge, reinterpret_cast<uint8_t*>(buf), sizeof(buf));
forge_binding(uris, &_forge, key.type, key.num);
const LV2_Atom* atom = buf;
- context.notify(uris.midi_binding,
- context.start(),
- binding->port,
- atom->size, atom->type, LV2_ATOM_BODY_CONST(atom));
+ ctx.notify(uris.midi_binding,
+ ctx.start(),
+ binding->port,
+ atom->size, atom->type, LV2_ATOM_BODY_CONST(atom));
return true;
}