23 #ifndef MIDNAM_PATCH_H_
24 #define MIDNAM_PATCH_H_
50 : _bank(std::max(0, std::min(bank_num, 16383)))
51 , _program(std::max(0, std::min(program_num, 127)))
56 , _program(id._program)
61 _program =
id._program;
66 return (_bank ==
id._bank &&
67 _program ==
id._program);
72 if (_bank <
id._bank) {
74 }
else if (_bank ==
id._bank && _program <
id._program) {
80 void set_bank(
int bank) { _bank = std::max(0, std::min(bank, 16383)); }
83 inline uint16_t
bank()
const {
return _bank; }
84 inline uint8_t
program()
const {
return _program; }
97 Patch (std::string a_name = std::string(), uint8_t a_number = 0, uint16_t bank_number = 0);
100 const std::string&
name()
const {
return _name; }
127 PatchBank (uint16_t n = UINT16_MAX, std::string a_name = std::string()) : _name(a_name), _number (n) {};
130 const std::string&
name()
const {
return _name; }
131 void set_name(
const std::string& a_name) { _name = a_name; }
155 typedef std::map<PatchPrimaryKey, std::shared_ptr<Patch> >
PatchMap;
162 const std::string&
name()
const {
return _name; }
168 return _available_for_channels.find(channel) != _available_for_channels.end();
172 return _patch_map[key];
176 for (PatchList::const_iterator i = _patch_list.begin();
177 i != _patch_list.end();
180 if (i != _patch_list.begin()) {
182 return _patch_map[*i];
187 return std::shared_ptr<Patch>();
191 for (PatchList::const_iterator i = _patch_list.begin();
192 i != _patch_list.end();
195 if (++i != _patch_list.end()) {
196 return _patch_map[*i];
203 return std::shared_ptr<Patch>();
234 Note(uint8_t number,
const std::string&
name) : _number(number), _name(
name) {}
236 const std::string&
name()
const {
return _name; }
239 uint8_t
number()
const {
return _number; }
253 typedef std::vector< std::shared_ptr<Note> >
Notes;
258 const std::string&
name()
const {
return _name; }
276 const std::string&
name)
281 uint16_t
number()
const {
return _number; }
282 const std::string&
name()
const {
return _name; }
298 typedef std::map<uint16_t, std::shared_ptr<Value> >
Values;
303 const std::string&
name()
const {
return _name; }
307 std::shared_ptr<const Value>
value(uint16_t num)
const;
325 const uint16_t number,
326 const std::string&
name)
332 const std::string&
type()
const {
return _type; }
333 uint16_t
number()
const {
return _number; }
334 const std::string&
name()
const {
return _name; }
337 std::shared_ptr<const ValueNameList>
value_name_list()
const {
return _value_name_list; }
339 void set_type(
const std::string& type) { _type = type; }
358 typedef std::map<uint16_t, std::shared_ptr<Control> >
Controls;
363 const std::string&
name()
const {
return _name; }
367 std::shared_ptr<const Control>
control(uint16_t num)
const;
385 const std::string&
name()
const {
return _name; }
394 assert(channel <= 15);
395 return _channel_name_set_assignments[channel];
402 std::string _channel_name_set_assignments[16];
414 typedef std::map<std::string, std::shared_ptr<NoteNameList> >
NoteNameLists;
432 const std::string& mode,
478 const std::string&
file_path ()
const {
return _file_path; }
479 const std::string&
author()
const {
return _author; }
481 void set_author(
const std::string& author) { _author = author; }
482 void set_file_path(
const std::string& file_path) { _file_path = file_path; }
std::set< uint8_t > AvailableForChannels
const std::string & name() const
ChannelNameSet(std::string &name)
std::list< PatchPrimaryKey > PatchList
void set_patch_banks(const PatchBanks &)
std::string _control_list_name
std::map< PatchPrimaryKey, std::shared_ptr< Patch > > PatchMap
virtual ~ChannelNameSet()
const std::string & note_list_name() const
std::shared_ptr< Patch > previous_patch(const PatchPrimaryKey &key)
std::list< std::shared_ptr< PatchBank > > PatchBanks
const PatchBanks & patch_banks() const
const std::string & control_list_name() const
std::string _note_list_name
int set_state(const XMLTree &, const XMLNode &)
void set_name(const std::string &name)
std::string _patch_list_name
bool available_for_channel(uint8_t channel) const
AvailableForChannels _available_for_channels
XMLNode & get_state() const
void use_patch_name_list(const PatchNameList &)
std::shared_ptr< Patch > find_patch(const PatchPrimaryKey &key)
std::shared_ptr< Patch > next_patch(const PatchPrimaryKey &key)
std::shared_ptr< const Control > control(uint16_t num) const
XMLNode & get_state() const
const Controls & controls() const
void set_name(const std::string &name)
std::map< uint16_t, std::shared_ptr< Control > > Controls
int set_state(const XMLTree &, const XMLNode &)
const std::string & name() const
ControlNameList(const std::string &name)
std::shared_ptr< ValueNameList > _value_name_list
Local, ValueNameList.
void set_name(const std::string &name)
int set_state(const XMLTree &, const XMLNode &)
std::shared_ptr< const ValueNameList > value_name_list() const
XMLNode & get_state() const
void set_number(uint16_t number)
Control(const std::string &type, const uint16_t number, const std::string &name)
void set_type(const std::string &type)
const std::string & name() const
const std::string & value_name_list_name() const
std::string _value_name_list_name
Global, UsesValueNameList.
const std::string & type() const
int set_state(const XMLTree &, const XMLNode &)
virtual ~CustomDeviceMode()
XMLNode & get_state() const
const std::string & channel_name_set_name_by_channel(uint8_t channel)
Note: channel here is 0-based while in the MIDNAM-file it's 1-based.
void set_name(const std::string &name)
const std::string & name() const
MasterDeviceNames::Models _all_models
MasterDeviceNamesList _master_device_names_list
const MasterDeviceNames::Models & all_models() const
void set_author(const std::string &author)
const std::string & file_path() const
const MasterDeviceNamesList & master_device_names_by_model() const
const std::string & author() const
void set_file_path(const std::string &file_path)
int set_state(const XMLTree &, const XMLNode &)
virtual ~MIDINameDocument()
std::map< std::string, std::shared_ptr< MasterDeviceNames > > MasterDeviceNamesList
std::shared_ptr< MasterDeviceNames > master_device_names(const std::string &model)
MIDINameDocument(const std::string &file_path)
XMLNode & get_state() const
std::shared_ptr< ChannelNameSet > channel_name_set_by_channel(const std::string &mode, uint8_t channel)
ValueNameLists _value_name_lists
const ControlNameLists & controls() const
XMLNode & get_state() const
virtual ~MasterDeviceNames()
std::shared_ptr< ChannelNameSet > channel_name_set(const std::string &name)
std::shared_ptr< CustomDeviceMode > custom_device_mode_by_name(const std::string &mode_name)
std::shared_ptr< NoteNameList > note_name_list(const std::string &name)
CustomDeviceModes _custom_device_modes
std::map< std::string, PatchNameList > PatchNameLists
std::shared_ptr< const ValueNameList > value_name_list_by_control(const std::string &mode, uint8_t channel, uint8_t number)
const std::string & manufacturer() const
const CustomDeviceModeNames & custom_device_mode_names() const
std::map< std::string, std::shared_ptr< ChannelNameSet > > ChannelNameSets
maps name to ChannelNameSet
std::shared_ptr< ValueNameList > value_name_list(const std::string &name)
std::shared_ptr< Patch > find_patch(const std::string &mode, uint8_t channel, const PatchPrimaryKey &key)
std::list< std::string > CustomDeviceModeNames
CustomDeviceModeNames _custom_device_mode_names
PatchNameLists _patch_name_lists
ControlNameLists _control_name_lists
std::map< std::string, std::shared_ptr< CustomDeviceMode > > CustomDeviceModes
maps name to CustomDeviceMode
std::string note_name(const std::string &mode_name, uint8_t channel, uint16_t bank, uint8_t program, uint8_t number)
const ValueNameLists & values() const
ChannelNameSets _channel_name_sets
const Models & models() const
std::map< std::string, std::shared_ptr< ValueNameList > > ValueNameLists
int set_state(const XMLTree &, const XMLNode &)
std::shared_ptr< ControlNameList > control_name_list(const std::string &name)
std::map< std::string, std::shared_ptr< NoteNameList > > NoteNameLists
void set_models(const Models some_models)
NoteNameLists _note_name_lists
void set_manufacturer(const std::string &manufacturer)
std::set< std::string > Models
std::string _manufacturer
std::map< std::string, std::shared_ptr< ControlNameList > > ControlNameLists
NoteNameList(const std::string &name)
std::vector< std::shared_ptr< Note > > Notes
const Notes & notes() const
const std::string & name() const
int set_state(const XMLTree &, const XMLNode &)
void set_name(const std::string &name)
XMLNode & get_state() const
int set_state(const XMLTree &, const XMLNode &)
XMLNode & get_state() const
const std::string & name() const
void set_name(const std::string &name)
Note(uint8_t number, const std::string &name)
void set_number(uint8_t number)
std::string _patch_list_name
PatchBank(uint16_t n=UINT16_MAX, std::string a_name=std::string())
int set_state(const XMLTree &, const XMLNode &)
XMLNode & get_state() const
void set_name(const std::string &a_name)
const std::string & name() const
const PatchNameList & patch_name_list() const
const std::string & patch_list_name() const
PatchNameList _patch_name_list
int set_patch_name_list(const PatchNameList &)
XMLNode & get_state() const
void set_program_number(uint8_t n)
uint8_t program_number() const
int set_state(const XMLTree &, const XMLNode &)
uint16_t bank_number() const
const PatchPrimaryKey & patch_primary_key() const
Patch(std::string a_name=std::string(), uint8_t a_number=0, uint16_t bank_number=0)
void set_name(const std::string &name)
std::string _note_list_name
void set_bank_number(uint16_t n)
const std::string & name() const
const std::string & note_list_name() const
ValueNameList(const std::string &name)
void set_name(const std::string &name)
const Values & values() const
std::shared_ptr< const Value > value(uint16_t num) const
const std::string & name() const
std::map< uint16_t, std::shared_ptr< Value > > Values
std::shared_ptr< const Value > max_value_below(uint16_t num) const
XMLNode & get_state() const
int set_state(const XMLTree &, const XMLNode &)
const std::string & name() const
int set_state(const XMLTree &, const XMLNode &)
void set_number(uint16_t number)
void set_name(const std::string &name)
Value(const uint16_t number, const std::string &name)
XMLNode & get_state() const
GtkImageIconNameData name
std::ostream & operator<<(std::ostream &, const ChannelNameSet &)
std::list< std::shared_ptr< Patch > > PatchNameList
void set_program(int program)
PatchPrimaryKey(int program_num=0, int bank_num=0)
PatchPrimaryKey & operator=(const PatchPrimaryKey &id)
PatchPrimaryKey(const PatchPrimaryKey &id)
bool operator==(const PatchPrimaryKey &id) const
bool operator<(const PatchPrimaryKey &id) const