MCP: stubbed device info file loading
git-svn-id: svn://localhost/ardour2/branches/3.0@11938 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
@@ -38,13 +38,12 @@ DeviceInfo::DeviceInfo()
|
||||
|
||||
}
|
||||
|
||||
DeviceInfo::DeviceInfo (const XMLNode& node)
|
||||
: _strip_cnt (8)
|
||||
, _has_two_character_display (true)
|
||||
, _has_master_fader (true)
|
||||
, _has_segmented_display (false)
|
||||
, _has_timecode_display (true)
|
||||
, _name (X_("Mackie Control Universal Pro"))
|
||||
DeviceInfo::~DeviceInfo()
|
||||
{
|
||||
}
|
||||
|
||||
int
|
||||
DeviceInfo::set_state (const XMLNode& node, int /* version */)
|
||||
{
|
||||
const XMLProperty* prop;
|
||||
|
||||
@@ -73,6 +72,8 @@ DeviceInfo::DeviceInfo (const XMLNode& node)
|
||||
if ((prop = node.property ("name")) != 0) {
|
||||
_name = prop->value();
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint32_t
|
||||
|
||||
@@ -31,9 +31,10 @@ class DeviceInfo
|
||||
{
|
||||
public:
|
||||
DeviceInfo();
|
||||
DeviceInfo(const XMLNode&);
|
||||
~DeviceInfo();
|
||||
|
||||
int set_state (const XMLNode&, int version);
|
||||
|
||||
uint32_t strip_cnt () const;
|
||||
bool has_two_character_display() const;
|
||||
bool has_master_fader () const;
|
||||
|
||||
@@ -73,16 +73,9 @@ MackieControlProtocolGUI::MackieControlProtocolGUI (MackieControlProtocol& p)
|
||||
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);
|
||||
|
||||
@@ -92,6 +92,7 @@ bool MackieControlProtocol::probe()
|
||||
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))
|
||||
@@ -562,6 +563,8 @@ MackieControlProtocol::get_state()
|
||||
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;
|
||||
@@ -583,8 +586,12 @@ MackieControlProtocol::set_state (const XMLNode & node, int /*version*/)
|
||||
|
||||
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);
|
||||
@@ -1138,3 +1145,45 @@ MackieControlProtocol::force_special_route_to_strip (boost::shared_ptr<Route> r,
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -40,6 +40,7 @@
|
||||
#include "controls.h"
|
||||
#include "mackie_jog_wheel.h"
|
||||
#include "timer.h"
|
||||
#include "device_info.h"
|
||||
|
||||
namespace MIDI {
|
||||
class Port;
|
||||
@@ -112,6 +113,9 @@ class MackieControlProtocol
|
||||
|
||||
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; }
|
||||
@@ -219,64 +223,6 @@ class MackieControlProtocol
|
||||
|
||||
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 *);
|
||||
|
||||
bool periodic();
|
||||
sigc::connection periodic_connection;
|
||||
|
||||
/// The initial remote_id of the currently switched in bank.
|
||||
uint32_t _current_initial_bank;
|
||||
|
||||
/// protects the port list
|
||||
Glib::Mutex update_mutex;
|
||||
|
||||
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;
|
||||
|
||||
// last written timecode string
|
||||
std::string _timecode_last;
|
||||
|
||||
// Which timecode are we displaying? BBT or Timecode
|
||||
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 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);
|
||||
|
||||
/* BUTTON HANDLING */
|
||||
|
||||
struct ButtonHandlers {
|
||||
Mackie::LedState (MackieControlProtocol::*press) (Mackie::Button&);
|
||||
Mackie::LedState (MackieControlProtocol::*release) (Mackie::Button&);
|
||||
@@ -288,10 +234,54 @@ class MackieControlProtocol
|
||||
};
|
||||
|
||||
typedef std::map<int,ButtonHandlers> ButtonMap;
|
||||
ButtonMap button_map;
|
||||
typedef std::list<GSource*> PortSources;
|
||||
|
||||
static MackieControlProtocol* _instance;
|
||||
|
||||
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;
|
||||
// last written timecode string
|
||||
std::string _timecode_last;
|
||||
// Which timecode are we displaying? BBT or Timecode
|
||||
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 ();
|
||||
bool midi_input_handler (Glib::IOCondition ioc, MIDI::Port* port);
|
||||
void clear_ports ();
|
||||
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 */
|
||||
|
||||
/* implemented button handlers */
|
||||
Mackie::LedState frm_left_press(Mackie::Button &);
|
||||
Mackie::LedState frm_left_release(Mackie::Button &);
|
||||
|
||||
Reference in New Issue
Block a user