13
0

avoid sending replicated fader set position messages

This commit is contained in:
Paul Davis 2015-10-02 19:24:04 -04:00
parent 3bc7f863ca
commit 04b9df1fd9
2 changed files with 9 additions and 0 deletions

View File

@ -60,6 +60,13 @@ Fader::update_message ()
}
int posi = lrintf (16384.0 * position);
if (posi == last_update_position) {
return MidiByteArray();
}
last_update_position = posi;
DEBUG_TRACE (DEBUG::MackieControl, string_compose ("generate fader message for position %1 (%2)\n", position, posi));
return MidiByteArray (3, 0xe0 + id(), posi & 0x7f, posi >> 7);
}

View File

@ -14,6 +14,7 @@ class Fader : public Control
Fader (int id, std::string name, Group & group)
: Control (id, name, group)
, position (0.0)
, last_update_position (-1)
{
}
@ -26,6 +27,7 @@ class Fader : public Control
private:
float position;
int last_update_position;
};
}