13
0

* Added support for ChannelNameSetAssignments (midnam_patch.(cc|h)

git-svn-id: svn://localhost/ardour2/branches/3.0@4238 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Hans Baier 2008-11-23 19:42:09 +00:00
parent 2f07b77503
commit 94537a47a1
2 changed files with 91 additions and 0 deletions

View File

@ -88,6 +88,50 @@ private:
PatchBanks _patch_banks;
};
class CustomDeviceMode : public PBD::Stateful
{
public:
CustomDeviceMode() {};
virtual ~CustomDeviceMode() {};
const string& name() const { return _name; }
void set_name(const string a_name) { _name = a_name; }
XMLNode& get_state (void);
int set_state (const XMLNode& a_node);
private:
/// array index = channel number
/// string contents = name of channel name set
string _name;
string _channel_name_set_assignments[16];
};
class MasterDeviceNames : public PBD::Stateful
{
public:
typedef std::list<ChannelNameSet> ChannelNameSets;
typedef std::list<std::string> Models;
MasterDeviceNames() {};
virtual ~MasterDeviceNames() {};
const string& manufacturer() const { return _manufacturer; }
void set_manufacturer(const string a_manufacturer) { _manufacturer = a_manufacturer; }
const Models& models() const { return _models; }
void set_models(const Models some_models) { _models = some_models; }
XMLNode& get_state (void);
int set_state (const XMLNode& a_node);
private:
string _manufacturer;
Models _models;
ChannelNameSets _channel_name_sets;
};
class MIDINameDocument : public PBD::Stateful
{
public:

View File

@ -131,6 +131,53 @@ ChannelNameSet::set_state (const XMLNode& node)
return 0;
}
int
CustomDeviceMode::set_state(const XMLNode& a_node)
{
assert(a_node.name() == "CustomDeviceNode");
boost::shared_ptr<XMLSharedNodeList> channel_name_set_assignments =
a_node.find("//ChannelNameSetAssign");
for(XMLSharedNodeList::const_iterator i = channel_name_set_assignments->begin();
i != channel_name_set_assignments->end();
++i) {
int channel = atoi((*i)->property("Channel")->value().c_str());
string name_set = (*i)->property("NameSet")->value();
assert( 1 <= channel && channel <= 16 );
_channel_name_set_assignments[channel -1] = name_set;
}
return 0;
}
XMLNode&
CustomDeviceMode::get_state(void)
{
XMLNode* custom_device_mode = new XMLNode("CustomDeviceMode");
custom_device_mode->add_property("Name", _name);
XMLNode* channel_name_set_assignments =
custom_device_mode->add_child("ChannelNameSetAssignments");
for (int i = 0; i < 15 && !_channel_name_set_assignments[i].empty(); i++) {
XMLNode* channel_name_set_assign =
channel_name_set_assignments->add_child("ChannelNameSetAssign");
channel_name_set_assign->add_property("Channel", i + 1);
channel_name_set_assign->add_property("NameSet", _channel_name_set_assignments[i]);
}
return *custom_device_mode;
}
int
MasterDeviceNames::set_state(const XMLNode& a_node)
{
return 0;
}
XMLNode&
MasterDeviceNames::get_state(void)
{
static XMLNode nothing("<nothing>");
return nothing;
}
int
MIDINameDocument::set_state(const XMLNode& a_node)
{