2 * Copyright (C) 2016 Robin Gareus <robin@gareus.org>
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2, or (at your option)
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software Foundation,
16 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19 #ifndef _ardour_maschine2_knob_h_
20 #define _ardour_maschine2_knob_h_
22 #include <boost/shared_ptr.hpp>
23 #include <sigc++/trackable.h>
25 #include <cairomm/refptr.h>
27 #include "pbd/signals.h"
29 #include "canvas/container.h"
31 namespace ArdourCanvas {
36 class AutomationControl;
44 namespace ArdourSurface {
47 class M2EncoderInterface;
49 class Maschine2Knob : public sigc::trackable, public ArdourCanvas::Container
52 Maschine2Knob (PBD::EventLoop*, ArdourCanvas::Item*);
53 virtual ~Maschine2Knob ();
55 void set_controllable (boost::shared_ptr<ARDOUR::AutomationControl>);
56 void set_control (M2EncoderInterface*);
57 boost::shared_ptr<ARDOUR::AutomationControl> controllable() const { return _controllable; }
59 void render (ArdourCanvas::Rect const &, Cairo::RefPtr<Cairo::Context>) const;
60 void compute_bounding_box() const;
63 void controllable_changed ();
64 void encoder_changed (int);
66 PBD::ScopedConnection watch_connection;
67 PBD::ScopedConnection encoder_connection;
69 boost::shared_ptr<ARDOUR::AutomationControl> _controllable;
70 M2EncoderInterface* _ctrl;
73 PBD::EventLoop* _eventloop;
76 float _val; // current value [0..1]
77 float _normal; // default value, arc
79 ArdourCanvas::Text* text;