2008-06-02 17:41:35 -04:00
|
|
|
/*
|
|
|
|
Copyright (C) 2006,2007 John Anderson
|
2012-04-08 11:16:34 -04:00
|
|
|
Copyright (C) 2012 Paul Davis
|
2008-06-02 17:41:35 -04:00
|
|
|
|
|
|
|
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
|
|
|
|
the Free Software Foundation; either version 2 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
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.
|
|
|
|
|
|
|
|
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., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
|
|
*/
|
2012-04-08 11:16:34 -04:00
|
|
|
|
|
|
|
#ifndef __mackie_controls_h__
|
|
|
|
#define __mackie_controls_h__
|
2008-06-02 17:41:35 -04:00
|
|
|
|
|
|
|
#include <map>
|
|
|
|
#include <vector>
|
|
|
|
#include <string>
|
2012-04-08 10:11:00 -04:00
|
|
|
#include <stdint.h>
|
2008-06-02 17:41:35 -04:00
|
|
|
|
2012-04-12 17:02:43 -04:00
|
|
|
#include <boost/smart_ptr.hpp>
|
|
|
|
|
2016-01-18 11:57:55 -05:00
|
|
|
#include "pbd/controllable.h"
|
2009-12-19 15:26:31 -05:00
|
|
|
#include "pbd/signals.h"
|
2009-12-17 13:24:23 -05:00
|
|
|
|
2008-06-02 17:41:35 -04:00
|
|
|
#include "mackie_control_exception.h"
|
2012-04-11 09:03:41 -04:00
|
|
|
#include "midi_byte_array.h"
|
2008-06-02 17:41:35 -04:00
|
|
|
|
2012-04-12 17:02:43 -04:00
|
|
|
namespace ARDOUR {
|
|
|
|
class AutomationControl;
|
|
|
|
}
|
|
|
|
|
2015-04-15 20:37:20 -04:00
|
|
|
namespace ArdourSurface {
|
|
|
|
|
|
|
|
namespace Mackie {
|
2008-06-02 17:41:35 -04:00
|
|
|
|
2012-04-09 09:59:35 -04:00
|
|
|
class Strip;
|
|
|
|
class Group;
|
|
|
|
class Surface;
|
2008-06-02 17:41:35 -04:00
|
|
|
|
2015-04-15 20:37:20 -04:00
|
|
|
class Control {
|
2008-06-02 17:41:35 -04:00
|
|
|
public:
|
2012-04-10 10:27:44 -04:00
|
|
|
Control (int id, std::string name, Group& group);
|
2008-06-02 17:41:35 -04:00
|
|
|
virtual ~Control() {}
|
2015-10-05 10:17:49 -04:00
|
|
|
|
2012-04-11 12:31:23 -04:00
|
|
|
int id() const { return _id; }
|
2012-04-07 14:43:06 -04:00
|
|
|
const std::string & name() const { return _name; }
|
2012-04-10 10:27:44 -04:00
|
|
|
Group & group() const { return _group; }
|
2012-04-11 09:03:41 -04:00
|
|
|
|
2011-05-04 05:22:32 -04:00
|
|
|
bool in_use () const;
|
|
|
|
void set_in_use (bool);
|
2015-10-05 10:17:49 -04:00
|
|
|
|
2015-04-15 20:37:20 -04:00
|
|
|
// Keep track of the timeout so it can be updated with more incoming events
|
2009-12-20 11:49:55 -05:00
|
|
|
sigc::connection in_use_connection;
|
2011-05-04 05:22:32 -04:00
|
|
|
|
2012-04-11 09:03:41 -04:00
|
|
|
virtual MidiByteArray zero() = 0;
|
|
|
|
|
2011-05-04 05:22:32 -04:00
|
|
|
/** If we are doing an in_use timeout for a fader without touch, this
|
|
|
|
* is its touch button control; otherwise 0.
|
|
|
|
*/
|
|
|
|
Control* in_use_touch_control;
|
2012-04-07 14:43:06 -04:00
|
|
|
|
2012-04-16 15:05:27 -04:00
|
|
|
boost::shared_ptr<ARDOUR::AutomationControl> control () const { return normal_ac; }
|
|
|
|
virtual void set_control (boost::shared_ptr<ARDOUR::AutomationControl>);
|
2012-04-12 17:02:43 -04:00
|
|
|
|
2012-04-16 15:05:27 -04:00
|
|
|
float get_value ();
|
2016-01-18 11:57:55 -05:00
|
|
|
void set_value (float val, PBD::Controllable::GroupControlDisposition gcd = PBD::Controllable::UseGroup);
|
2015-10-05 10:17:49 -04:00
|
|
|
|
2012-04-16 15:05:27 -04:00
|
|
|
virtual void start_touch (double when);
|
2017-07-23 19:22:50 -04:00
|
|
|
virtual void stop_touch (double when);
|
2012-04-12 17:02:43 -04:00
|
|
|
|
|
|
|
protected:
|
|
|
|
boost::shared_ptr<ARDOUR::AutomationControl> normal_ac;
|
|
|
|
|
|
|
|
private:
|
2012-04-14 15:02:54 -04:00
|
|
|
int _id; /* possibly device-dependent ID */
|
2008-06-02 17:41:35 -04:00
|
|
|
std::string _name;
|
2012-04-07 14:54:31 -04:00
|
|
|
Group& _group;
|
2008-12-12 17:55:03 -05:00
|
|
|
bool _in_use;
|
2008-06-02 17:41:35 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|
2015-04-15 20:37:20 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
std::ostream & operator << (std::ostream & os, const ArdourSurface::Mackie::Control & control);
|
2008-06-02 17:41:35 -04:00
|
|
|
|
2012-04-08 11:16:34 -04:00
|
|
|
#endif /* __mackie_controls_h__ */
|