table->attach (*manage (new Gtk::Label (_("Surface type:"))), 0, 1, 0, 1);
table->attach (_surface_combo, 1, 2, 0, 1);
- vector<string> surfaces;
- surfaces.push_back (_("Mackie Control"));
- surfaces.push_back (_("Behringer BCF2000"));
+ vector<string> surfaces = p.get_possible_devices ();
Gtkmm2ext::set_popdown_strings (_surface_combo, surfaces);
-
- if (ARDOUR::Config->get_mackie_emulation () == X_("mcu")) {
- _surface_combo.set_active_text (surfaces.front ());
- } else {
- _surface_combo.set_active_text (surfaces.back ());
- }
+ _surface_combo.set_active_text (p.device_name());
_extenders.set_range (0, 8);
_extenders.set_increments (1, 4);
MackieControlProtocol::MackieControlProtocol (Session& session)
: ControlProtocol (session, X_("Mackie"), this)
, AbstractUI<MackieControlUIRequest> ("mackie")
+ , _device_name (get_possible_devices().front())
, _current_initial_bank (0)
, _timecode_type (ARDOUR::AnyTime::BBT)
, _input_bundle (new ARDOUR::Bundle (_("Mackie Control In"), true))
XMLNode* node = new XMLNode (X_("Protocol"));
node->add_property (X_("name"), ARDOUR::ControlProtocol::_name);
+ node->add_property (X_("device"), _device_name);
+
// add current bank
ostringstream os;
os << _current_initial_bank;
int retval = 0;
const XMLProperty* prop;
- // fetch current bank
+ if ((prop = node.property (X_("device"))) != 0) {
+ load_device_info (prop->value());
+ }
+
+ // fetch current bank
if ((prop = node.property (X_("bank"))) != 0) {
string bank = prop->value();
set_active (true);
}
}
+vector<string>
+MackieControlProtocol::get_possible_devices ()
+{
+ vector<string> s;
+
+ s.push_back (X_("Mackie Control Universal Pro"));
+ s.push_back (X_("Behringer BCF2000"));
+ s.push_back (X_("SSL Nucleus"));
+ s.push_back (X_("Presonus FaderPort"));
+
+ return s;
+}
+
+string
+MackieControlProtocol::find_device_info_file (const string& name)
+{
+ return string();
+}
+
+void
+MackieControlProtocol::load_device_info (const string& name)
+{
+ string path = find_device_info_file (name);
+
+ if (path.empty()) {
+ error << string_compose (_("No device info for Mackie Control device \"%1\" - ignored"), name) << endmsg;
+ return;
+ }
+
+ XMLTree tree;
+ if (tree.read (path)) {
+ error << string_compose (_("Cannot load device info file %1 - ignored"), path) << endmsg;
+ return;
+ }
+
+ XMLNode* root = tree.root();
+ if (root) {
+ if (_device_info.set_state (*root, 3000)) { // version is currently ignored
+ _device_name = name;
+ }
+ }
+}
#include "controls.h"
#include "mackie_jog_wheel.h"
#include "timer.h"
+#include "device_info.h"
namespace MIDI {
class Port;
static MackieControlProtocol* instance() { return _instance; }
+ const std::string& device_name() const { return _device_name; }
+ static std::vector<std::string> get_possible_devices ();
+
int set_active (bool yn);
FlipMode flip_mode () const { return _flip_mode; }
private:
- static MackieControlProtocol* _instance;
-
- void create_surfaces ();
- void port_connected_or_disconnected (std::string, std::string, bool);
- bool control_in_use_timeout (Mackie::Surface*, Mackie::Control *, Mackie::Control *);
+ struct ButtonHandlers {
+ Mackie::LedState (MackieControlProtocol::*press) (Mackie::Button&);
+ Mackie::LedState (MackieControlProtocol::*release) (Mackie::Button&);
+
+ ButtonHandlers (Mackie::LedState (MackieControlProtocol::*p) (Mackie::Button&),
+ Mackie::LedState (MackieControlProtocol::*r) (Mackie::Button&))
+ : press (p)
+ , release (r) {}
+ };
- bool periodic();
- sigc::connection periodic_connection;
+ typedef std::map<int,ButtonHandlers> ButtonMap;
+ typedef std::list<GSource*> PortSources;
- /// The initial remote_id of the currently switched in bank.
- uint32_t _current_initial_bank;
+ static MackieControlProtocol* _instance;
- /// protects the port list
- Glib::Mutex update_mutex;
-
+ std::string _device_name;
+ Mackie::DeviceInfo _device_info;
+ sigc::connection periodic_connection;
+ uint32_t _current_initial_bank;
PBD::ScopedConnectionList audio_engine_connections;
PBD::ScopedConnectionList session_connections;
PBD::ScopedConnectionList port_connections;
PBD::ScopedConnectionList route_connections;
-
bool _transport_previously_rolling;
-
// timer for two quick marker left presses
- Mackie::Timer _frm_left_last;
-
+ Mackie::Timer _frm_left_last;
// last written timecode string
- std::string _timecode_last;
-
+ std::string _timecode_last;
// Which timecode are we displaying? BBT or Timecode
- ARDOUR::AnyTime::Type _timecode_type;
-
+ ARDOUR::AnyTime::Type _timecode_type;
// Bundle to represent our input ports
boost::shared_ptr<ARDOUR::Bundle> _input_bundle;
// Bundle to represent our output ports
boost::shared_ptr<ARDOUR::Bundle> _output_bundle;
+ void* _gui;
+ bool _zoom_mode;
+ bool _scrub_mode;
+ FlipMode _flip_mode;
+ ViewMode _view_mode;
+ int _current_selected_track;
+ int _modifier_state;
+ PortSources port_sources;
+ std::vector<std::string> _f_actions;
+ ButtonMap button_map;
+ std::string find_device_info_file (const std::string& name);
+ void load_device_info (const std::string&);
+ void create_surfaces ();
+ void port_connected_or_disconnected (std::string, std::string, bool);
+ bool control_in_use_timeout (Mackie::Surface*, Mackie::Control *, Mackie::Control *);
+ bool periodic();
void build_gui ();
- void* _gui;
-
- bool _zoom_mode;
- bool _scrub_mode;
- FlipMode _flip_mode;
- ViewMode _view_mode;
- int _current_selected_track;
- int _modifier_state;
-
- typedef std::list<GSource*> PortSources;
- PortSources port_sources;
-
bool midi_input_handler (Glib::IOCondition ioc, MIDI::Port* port);
void clear_ports ();
-
- std::vector<std::string> _f_actions;
-
void force_special_route_to_strip (boost::shared_ptr<ARDOUR::Route> r, uint32_t surface, uint32_t strip_number);
+ void build_button_map ();
/* BUTTON HANDLING */
- struct ButtonHandlers {
- Mackie::LedState (MackieControlProtocol::*press) (Mackie::Button&);
- Mackie::LedState (MackieControlProtocol::*release) (Mackie::Button&);
-
- ButtonHandlers (Mackie::LedState (MackieControlProtocol::*p) (Mackie::Button&),
- Mackie::LedState (MackieControlProtocol::*r) (Mackie::Button&))
- : press (p)
- , release (r) {}
- };
-
- typedef std::map<int,ButtonHandlers> ButtonMap;
- ButtonMap button_map;
-
- void build_button_map ();
-
/* implemented button handlers */
Mackie::LedState frm_left_press(Mackie::Button &);
Mackie::LedState frm_left_release(Mackie::Button &);