2016-11-17 07:08:38 -05:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2016 Robin Gareus <robin@gareus.org>
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
2019-08-03 08:34:29 -04:00
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
2016-11-17 07:08:38 -05:00
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
2019-08-03 08:34:29 -04:00
|
|
|
* You should have received a copy of the GNU General Public License along
|
|
|
|
* with this program; if not, write to the Free Software Foundation, Inc.,
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
2016-11-17 07:08:38 -05:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef _ardour_maschine2_knob_h_
|
|
|
|
#define _ardour_maschine2_knob_h_
|
|
|
|
|
2023-02-16 12:59:41 -05:00
|
|
|
#include <memory>
|
|
|
|
|
2016-11-17 07:08:38 -05:00
|
|
|
#include <sigc++/trackable.h>
|
|
|
|
|
|
|
|
#include <cairomm/refptr.h>
|
|
|
|
|
|
|
|
#include "pbd/signals.h"
|
|
|
|
|
|
|
|
#include "canvas/container.h"
|
|
|
|
|
|
|
|
namespace ArdourCanvas {
|
|
|
|
class Text;
|
|
|
|
}
|
|
|
|
|
|
|
|
namespace ARDOUR {
|
|
|
|
class AutomationControl;
|
|
|
|
}
|
|
|
|
|
|
|
|
namespace Cairo {
|
|
|
|
class Context;
|
|
|
|
class Region;
|
|
|
|
}
|
|
|
|
|
|
|
|
namespace ArdourSurface {
|
|
|
|
|
|
|
|
class Maschine2;
|
|
|
|
class M2EncoderInterface;
|
|
|
|
|
|
|
|
class Maschine2Knob : public sigc::trackable, public ArdourCanvas::Container
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
Maschine2Knob (PBD::EventLoop*, ArdourCanvas::Item*);
|
|
|
|
virtual ~Maschine2Knob ();
|
|
|
|
|
2023-02-16 18:33:28 -05:00
|
|
|
void set_controllable (std::shared_ptr<ARDOUR::AutomationControl>);
|
2016-11-17 07:08:38 -05:00
|
|
|
void set_control (M2EncoderInterface*);
|
2023-02-16 18:33:28 -05:00
|
|
|
std::shared_ptr<ARDOUR::AutomationControl> controllable() const { return _controllable; }
|
2016-11-17 07:08:38 -05:00
|
|
|
|
|
|
|
void render (ArdourCanvas::Rect const &, Cairo::RefPtr<Cairo::Context>) const;
|
|
|
|
void compute_bounding_box() const;
|
|
|
|
|
|
|
|
protected:
|
|
|
|
void controllable_changed ();
|
|
|
|
void encoder_changed (int);
|
|
|
|
|
|
|
|
PBD::ScopedConnection watch_connection;
|
|
|
|
PBD::ScopedConnection encoder_connection;
|
|
|
|
|
2023-02-16 18:33:28 -05:00
|
|
|
std::shared_ptr<ARDOUR::AutomationControl> _controllable;
|
2016-11-17 07:08:38 -05:00
|
|
|
M2EncoderInterface* _ctrl;
|
|
|
|
|
|
|
|
private:
|
|
|
|
PBD::EventLoop* _eventloop;
|
|
|
|
|
|
|
|
float _radius;
|
|
|
|
float _val; // current value [0..1]
|
|
|
|
float _normal; // default value, arc
|
|
|
|
|
|
|
|
ArdourCanvas::Text* text;
|
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace
|
|
|
|
|
|
|
|
#endif
|