diff --git a/libs/surfaces/mackie/device_info.cc b/libs/surfaces/mackie/device_info.cc new file mode 100644 index 0000000000..9acf6e5791 --- /dev/null +++ b/libs/surfaces/mackie/device_info.cc @@ -0,0 +1,107 @@ +/* + Copyright (C) 2006,2007 John Anderson + Copyright (C) 2012 Paul Davis + + 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. +*/ + +#include "pbd/xml++.h" + +#include "device_info.h" + +#include "i18n.h" + +using namespace Mackie; +using namespace PBD; +using std::string; + +DeviceInfo::DeviceInfo() + : _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 (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")) +{ + const XMLProperty* prop; + + if ((prop = node.property ("strips")) != 0) { + if ((_strip_cnt = atoi (prop->value())) == 0) { + _strip_cnt = 8; + } + } + + if ((prop = node.property ("two-character-display")) != 0) { + _has_two_character_display = string_is_affirmative (prop->value()); + } + + if ((prop = node.property ("master-fader")) != 0) { + _has_master_fader = string_is_affirmative (prop->value()); + } + + if ((prop = node.property ("display-segmented")) != 0) { + _has_segmented_display = string_is_affirmative (prop->value()); + } + + if ((prop = node.property ("timecode-display")) != 0) { + _has_timecode_display = string_is_affirmative (prop->value()); + } + + if ((prop = node.property ("name")) != 0) { + _name = prop->value(); + } +} + +uint32_t +DeviceInfo::strip_cnt() const +{ + return _strip_cnt; +} + +bool +DeviceInfo::has_master_fader() const +{ + return _has_master_fader; +} + +bool +DeviceInfo::has_two_character_display() const +{ + return _has_two_character_display; +} + +bool +DeviceInfo::has_segmented_display() const +{ + return _has_segmented_display; +} + +bool +DeviceInfo::has_timecode_display () const +{ + return _has_timecode_display; +} + diff --git a/libs/surfaces/mackie/device_info.h b/libs/surfaces/mackie/device_info.h new file mode 100644 index 0000000000..83ddf13c54 --- /dev/null +++ b/libs/surfaces/mackie/device_info.h @@ -0,0 +1,65 @@ +/* + Copyright (C) 2006,2007 John Anderson + Copyright (C) 2012 Paul Davis + + 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. +*/ + +#ifndef __ardour_mackie_control_protocol_device_info_h__ +#define __ardour_mackie_control_protocol_device_info_h__ + +#include +#include + +class XMLNode; + +namespace Mackie { + +class DeviceInfo +{ + public: + DeviceInfo(); + DeviceInfo(const XMLNode&); + ~DeviceInfo(); + + uint32_t strip_cnt () const; + bool has_two_character_display() const; + bool has_master_fader () const; + bool has_segmented_display() const; + bool has_timecode_display() const; + const std::string& name() const; + + private: + uint32_t _strip_cnt; + bool _has_two_character_display; + bool _has_master_fader; + bool _has_segmented_display; + bool _has_timecode_display; + std::string _name; +}; + +class DeviceProfile +{ + public: + DeviceProfile (DeviceInfo& info); + ~DeviceProfile(); + + const std::string& get_f_action (uint32_t fn, int modifier_state); + void set_f_action (uint32_t fn, int modifier_state, const std::string&); +}; + +} + +#endif /* __ardour_mackie_control_protocol_device_info_h__ */