23 #ifndef MIDI_PATCH_MANAGER_H_
24 #define MIDI_PATCH_MANAGER_H_
78 {
return _master_devices_by_model[model_name]; }
82 std::string custom_device_mode,
84 std::shared_ptr<MIDI::Name::MasterDeviceNames> master_device = master_device_by_model(model);
86 if (master_device != 0 && custom_device_mode !=
"") {
87 return master_device->channel_name_set_by_channel(custom_device_mode, channel);
89 return std::shared_ptr<ChannelNameSet>();
95 std::string custom_device_mode,
99 std::shared_ptr<ChannelNameSet> channel_name_set = find_channel_name_set(model, custom_device_mode, channel);
101 if (channel_name_set) {
102 return channel_name_set->find_patch(patch_key);
104 return std::shared_ptr<Patch>();
110 std::string custom_device_mode,
114 std::shared_ptr<ChannelNameSet> channel_name_set = find_channel_name_set(model, custom_device_mode, channel);
116 if (channel_name_set) {
117 return channel_name_set->previous_patch(patch_key);
119 return std::shared_ptr<Patch>();
125 std::string custom_device_mode,
129 std::shared_ptr<ChannelNameSet> channel_name_set = find_channel_name_set(model, custom_device_mode, channel);
131 if (channel_name_set) {
132 return channel_name_set->next_patch(patch_key);
134 return std::shared_ptr<Patch>();
139 if (model_name !=
"") {
140 if (master_device_by_model(model_name)) {
141 return master_device_by_model(model_name)->custom_device_mode_names();
144 return std::list<std::string>();
154 const std::function<
void()>& slot,
std::map< std::string, std::shared_ptr< MasterDeviceNames > > MasterDeviceNamesList
std::set< std::string > Models
bool remove_custom_midnam(const std::string &id)
const DeviceNamesByMaker & devices_by_manufacturer() const
PBD::Searchpath _search_path
MidiPatchManager(const MidiPatchManager &)
void remove_search_path(const PBD::Searchpath &search_path)
bool add_custom_midnam(const std::string &id, char const *)
void load_midnams_in_thread()
std::map< std::string, std::shared_ptr< MIDINameDocument > > MidiNameDocuments
bool remove_midi_name_document(const std::string &file_path, bool emit_signal=true)
static MidiPatchManager & instance()
bool no_patch_changed_messages
void add_midnam_files_from_directory(const std::string &directory_path)
std::map< std::string, MIDINameDocument::MasterDeviceNamesList > DeviceNamesByMaker
void remove_midnam_files_from_directory(const std::string &directory_path)
std::shared_ptr< ChannelNameSet > find_channel_name_set(std::string model, std::string custom_device_mode, uint8_t channel)
MIDINameDocument::MasterDeviceNamesList _master_devices_by_model
MasterDeviceNames::Models _all_models
bool load_midi_name_document(const std::string &file_path)
bool add_midi_name_document(std::shared_ptr< MIDINameDocument >)
static MidiPatchManager * _manager
MidiPatchManager()
Singleton.
std::shared_ptr< MIDINameDocument > document_by_model(std::string model_name) const
std::shared_ptr< Patch > find_patch(std::string model, std::string custom_device_mode, uint8_t channel, PatchPrimaryKey patch_key)
void add_search_path(const PBD::Searchpath &search_path)
bool is_custom_model(const std::string &model) const
std::shared_ptr< MasterDeviceNames > master_device_by_model(std::string model_name)
std::list< std::string > custom_device_mode_names_by_model(std::string model_name)
DeviceNamesByMaker _devices_by_manufacturer
const MasterDeviceNames::Models & all_models() const
Glib::Threads::Mutex _lock
MidiNameDocuments _documents
std::shared_ptr< Patch > previous_patch(std::string model, std::string custom_device_mode, uint8_t channel, PatchPrimaryKey patch_key)
bool update_custom_midnam(const std::string &id, char const *)
PBD::Thread * _midnam_load_thread
void maybe_use(PBD::ScopedConnectionList &clist, PBD::EventLoop::InvalidationRecord *ir, const std::function< void()> &slot, PBD::EventLoop *event_loop)
std::shared_ptr< Patch > next_patch(std::string model, std::string custom_device_mode, uint8_t channel, PatchPrimaryKey patch_key)
PBD::Signal< void()> PatchesChanged