/* * PluginHost.h * * Created on: 17 déc. 2023 * Author: fanch */ #ifndef SRC_CORE_PLUGININDEX_H_ #define SRC_CORE_PLUGININDEX_H_ #include #include #include #include #include #include struct DllEntry { std::string path; int count; void* ptr; }; typedef std::vector DllTable; class DllManager; class DllManager { public: DllManager(){ } virtual ~DllManager(){ } void* _open(const std::string& path){ for(size_t i=0; i_open(path); } static void close(void* ptr){ return DllManager::m_instance->_close(ptr); } protected: DllTable m_table; static DllManager* m_instance; }; struct PluginPort { PluginPort() : index(0), is_input(false), is_output(false), is_audio(false), is_control(false){ } virtual ~PluginPort(){ } std::string name; int index; bool is_input; bool is_output; bool is_audio; bool is_control; std::string& to_string(std::string& out) const { out += "[" + name +"] "; if(is_input) out+="AUDIO "; if(is_output) out+="OUTPUT "; if(is_audio) out+="AUDIO "; if(is_control) out+="CONTROL "; out+="\n"; return out; } }; typedef std::vector PluginPorts; class PluginEntry { public: PluginEntry(const std::string& plugin_path){ set_path(plugin_path); } PluginEntry(){ _clear(); } PluginEntry(const PluginEntry& other){ m_loaded = other.m_loaded; m_name = other.m_name; m_path = other.m_path; m_error = other.m_error; m_is_error = other.m_is_error; m_label = other.m_label; m_id = other.m_id; m_ports = other.m_ports; } virtual ~PluginEntry(){ } void set_path(const std::string& path){ if(path == m_path) return; m_loaded = false; this->m_path = path; } void load(); const std::string& path() const{ return m_path; } std::string& to_string(std::string& out) const { char tmp[1024]; sprintf(tmp, "=== [%s] %s%s===\n id=%d\n name=%s\n label=%s\n ports:\n", m_path.c_str(), (m_is_error?"Erreur: ":""), (m_is_error?m_error.c_str():""), m_id, m_name.c_str(), m_label.c_str()); out+=tmp; for(size_t i=0; i m_plugin_pathes; std::vector m_plugins; }; #endif /* SRC_CORE_PLUGININDEX_H_ */