OSC make strippable null on drop references
[ardour.git] / libs / surfaces / faderport8 / faderport8.h
index d4ab0c7ccc2270a111fabf827a1fc3d922b19c1c..1f5c25e3fd728e5462cc09e9175be8d15e4b6551 100644 (file)
 #ifndef ardour_surface_faderport8_h
 #define ardour_surface_faderport8_h
 
+// allow to undo "mute clear", "solo clear"
+// eventually this should use some libardour mixer history/undo
+#define FP8_MUTESOLO_UNDO
+
 #include <list>
 #include <map>
 #include <glibmm/threads.h>
@@ -27,6 +31,7 @@
 #define ABSTRACT_UI_EXPORTS
 #include "pbd/abstract_ui.h"
 #include "pbd/properties.h"
+#include "pbd/controllable.h"
 
 #include "ardour/types.h"
 #include "ardour/async_midi_port.h"
@@ -45,9 +50,10 @@ namespace ARDOUR {
        class Bundle;
        class Session;
        class Processor;
+       class PluginInsert;
 }
 
-namespace ArdourSurface {
+namespace ArdourSurface { namespace FP_NAMESPACE {
 
 struct FaderPort8Request : public BaseUI::BaseRequestObject
 {
@@ -83,7 +89,17 @@ public:
        std::string get_button_action (FP8Controls::ButtonId, bool);
        FP8Controls const& control () const { return  _ctrls; }
 
-       int stop ();
+       void set_clock_mode (uint32_t m) { _clock_mode = m; }
+       void set_scribble_mode (uint32_t m) { _scribble_mode = m; }
+       void set_two_line_text (bool yn) { _two_line_text = yn; }
+       void set_auto_pluginui (bool yn) { _auto_pluginui = yn; }
+
+       uint32_t clock_mode () const { return _clock_mode; }
+       uint32_t scribble_mode () const { return _scribble_mode; }
+       bool twolinetext () const { return _two_line_text; }
+       bool auto_pluginui () const { return _auto_pluginui; }
+
+       void stop ();
        void do_request (FaderPort8Request*);
        void thread_init ();
 
@@ -100,7 +116,7 @@ private:
        void stop_midi_handling ();
 
        /* I/O Ports */
-       PBD::ScopedConnection port_connection;
+       PBD::ScopedConnectionList port_connections;
        boost::shared_ptr<ARDOUR::AsyncMIDIPort> _input_port;
        boost::shared_ptr<ARDOUR::AsyncMIDIPort> _output_port;
        boost::shared_ptr<ARDOUR::Bundle>        _input_bundle;
@@ -108,7 +124,8 @@ private:
 
        bool midi_input_handler (Glib::IOCondition ioc, boost::weak_ptr<ARDOUR::AsyncMIDIPort> port);
 
-       bool connection_handler (boost::weak_ptr<ARDOUR::Port>, std::string name1, boost::weak_ptr<ARDOUR::Port>, std::string name2, bool yn);
+       bool connection_handler (std::string name1, std::string name2);
+       void engine_reset ();
 
        enum ConnectionState {
                InputConnected = 0x1,
@@ -139,7 +156,7 @@ private:
        void assign_stripables (bool select_only = false);
        void set_periodic_display_mode (FP8Strip::DisplayMode);
 
-       void assign_strips (bool reset_bank);
+       void assign_strips ();
        void bank (bool down, bool page);
        void move_selected_into_view ();
        void select_prev_next (bool next);
@@ -147,12 +164,19 @@ private:
        void assign_sends ();
        void spill_plugins ();
        void assign_processor_ctrls ();
+       bool assign_plugin_presets (boost::shared_ptr<ARDOUR::PluginInsert>);
        void build_well_known_processor_ctrls (boost::shared_ptr<ARDOUR::Stripable>, bool);
+       void preset_changed ();
        void select_plugin (int num);
+       void select_plugin_preset (size_t num);
 
+       void toggle_preset_param_mode ();
        void bank_param (bool down, bool page);
        /* bank offsets */
-       int _channel_off;
+       int  get_channel_off (FP8Types::MixMode m) const { return _channel_off [m]; }
+       void set_channel_off (FP8Types::MixMode m, int off) {_channel_off [m] = off ; }
+
+       int _channel_off[FP8Types::MixModeMax + 1];
        int _plugin_off;
        int _parameter_off;
 
@@ -173,9 +197,10 @@ private:
        void drop_ctrl_connections ();
 
        void select_strip (boost::weak_ptr<ARDOUR::Stripable>);
+
        void notify_pi_property_changed (const PBD::PropertyChange&);
        void notify_stripable_property_changed (boost::weak_ptr<ARDOUR::Stripable>, const PBD::PropertyChange&);
-       void gui_track_selection_changed ();
+       void stripable_selection_changed ();
 
        PBD::ScopedConnection selection_connection;
        PBD::ScopedConnectionList automation_state_connections;
@@ -190,6 +215,8 @@ private:
                boost::shared_ptr<ARDOUR::AutomationControl> ac;
        };
        std::list <ProcessorCtrl> _proc_params;
+       boost::weak_ptr<ARDOUR::PluginInsert> _plugin_insert;
+       bool _show_presets;
        int _showing_well_known;
        /* **************************************************************************/
 
@@ -197,7 +224,14 @@ private:
        sigc::connection _periodic_connection;
        bool periodic ();
        std::string _timecode;
+       std::string _musical_time;
        std::string const& timecode () const { return _timecode; }
+       std::string const& musical_time () const { return _musical_time; }
+
+       int _timer_divider;
+
+       bool show_meters () const { return _scribble_mode & 1; }
+       bool show_panner () const { return _scribble_mode & 2; }
 
        /* sync button blink -- the FP's blink mode does not work */
        sigc::connection _blink_connection;
@@ -207,9 +241,9 @@ private:
        /* shift key */
        sigc::connection _shift_connection;
        bool _shift_lock;
-       bool _shift_pressed;
+       int _shift_pressed;
        bool shift_timeout () { _shift_lock = true; return false; }
-       bool shift_mod () const { return _shift_lock | _shift_pressed; }
+       bool shift_mod () const { return _shift_lock || (_shift_pressed > 0); }
 
        /* GUI */
        void build_gui ();
@@ -232,6 +266,7 @@ private:
        void notify_solo_changed ();
        void notify_mute_changed ();
        void notify_automation_mode_changed ();
+       void notify_plugin_active_changed ();
 
        /* actions */
        PBD::ScopedConnectionList button_connections;
@@ -240,7 +275,14 @@ private:
        void button_record ();
        void button_loop ();
        void button_metronom ();
+       void button_bypass ();
+       void button_open ();
+       void button_link ();
+       void button_lock ();
        void button_varispeed (bool);
+#ifdef FP8_MUTESOLO_UNDO
+       void button_solo_clear ();
+#endif
        void button_mute_clear ();
        void button_arm (bool);
        void button_arm_all ();
@@ -253,6 +295,34 @@ private:
        void encoder_navigate (bool, int);
        void encoder_parameter (bool, int);
 
+       /* mute undo history */
+#ifdef FP8_MUTESOLO_UNDO
+       std::vector <boost::weak_ptr<ARDOUR::AutomationControl> > _mute_state;
+       std::vector <boost::weak_ptr<ARDOUR::AutomationControl> > _solo_state;
+#endif
+
+       /* Encoder handlers */
+       void handle_encoder_pan (int steps);
+       void handle_encoder_link (int steps);
+
+       /* Control Link */
+       void stop_link ();
+       void start_link ();
+       void lock_link ();
+       void unlock_link (bool drop = false);
+       void nofity_focus_control (boost::weak_ptr<PBD::Controllable>);
+       PBD::ScopedConnection link_connection;
+       PBD::ScopedConnection link_locked_connection;
+       boost::weak_ptr<PBD::Controllable> _link_control;
+       bool _link_enabled;
+       bool _link_locked; // can only be true if _link_enabled
+
+       /* user prefs */
+       uint32_t _clock_mode;
+       uint32_t _scribble_mode;
+       bool     _two_line_text;
+       bool     _auto_pluginui;
+
        /* user bound actions */
        void button_user (bool, FP8Controls::ButtonId);
 
@@ -331,6 +401,6 @@ private:
        UserActionMap _user_action_map;
 };
 
-} /* namespace */
+} /* namespace */
 
 #endif /* ardour_surface_faderport8_h */