X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Finput%2Fbinarycontrol.cpp;h=df07fb9eaf47c430d1a204f1dab7ad394d4e1491;hb=a6eecc5117d91534aaf13e93baf64855f4b963c0;hp=70a816570fb2d33bcc697ec52fe1fe770cd19147;hpb=c9626e6953c16efc66575eff80c4c0de2f739041;p=libs%2Fgui.git diff --git a/source/input/binarycontrol.cpp b/source/input/binarycontrol.cpp index 70a8165..df07fb9 100644 --- a/source/input/binarycontrol.cpp +++ b/source/input/binarycontrol.cpp @@ -4,33 +4,28 @@ namespace Msp { namespace Input { -BinaryControl::BinaryControl(): - state(false), - threshold(0.5) -{ } - BinaryControl::BinaryControl(const ControlSource &s): - Control(s), - state(false), - threshold(0.5) + Control(s) { } BinaryControl::BinaryControl(Device &d, ControlSrcType t, unsigned i): - Control(d, t, i), - state(false), - threshold(0.5) + Control(d, t, i) +{ } + +BinaryControl::~BinaryControl() { } void BinaryControl::set_threshold(float t) { - threshold=t; + threshold = t; } void BinaryControl::on_press() { if(!state) { - state=true; + state = true; + rising_edge = true; signal_press.emit(); } } @@ -39,7 +34,8 @@ void BinaryControl::on_release() { if(state) { - state=false; + state = false; + falling_edge = true; signal_release.emit(); } }