diff options
Diffstat (limited to 'qmidiplayer-desktop/qmpplugin.cpp')
-rw-r--r-- | qmidiplayer-desktop/qmpplugin.cpp | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/qmidiplayer-desktop/qmpplugin.cpp b/qmidiplayer-desktop/qmpplugin.cpp index f014902..b05ca0c 100644 --- a/qmidiplayer-desktop/qmpplugin.cpp +++ b/qmidiplayer-desktop/qmpplugin.cpp @@ -9,7 +9,7 @@ #include "qmpplugin.hpp" #include "qmpmainwindow.hpp" #include "qmpsettingswindow.hpp" -qmpPluginAPI pluginAPI; +qmpPluginAPI* pluginAPI; qmpMainWindow* qmw; qmpSettingsWindow* qsw; #ifdef _WIN32 @@ -48,7 +48,7 @@ void qmpPluginManager::scanPlugins() void* hndi=dlsym(hso,"qmpPluginGetInterface"); if(!hndi)continue; qmpPluginEntry e=(qmpPluginEntry)hndi; - qmpPluginIntf* intf=e(&pluginAPI); + qmpPluginIntf* intf=e(pluginAPI); plugins.push_back(qmpPlugin(std::string(intf->pluginGetName()),std::string(intf->pluginGetVersion()),std::string(cpluginpaths[i]),intf)); } } @@ -57,11 +57,16 @@ qmpPluginManager::qmpPluginManager() { qmw=qmpMainWindow::getInstance(); qsw=qmw->getSettingsWindow(); + pluginAPI=new qmpPluginAPI(); } qmpPluginManager::~qmpPluginManager() { - for(unsigned i=0;i<plugins.size();++i)delete plugins[i].interface; - qmw=NULL;qsw=NULL; + for(unsigned i=0;i<plugins.size();++i) + { + if(plugins[i].enabled)plugins[i].interface->deinit(); + delete plugins[i].interface; + } + qmw=NULL;qsw=NULL;delete pluginAPI; } std::vector<qmpPlugin> *qmpPluginManager::getPlugins() { @@ -82,6 +87,8 @@ void qmpPluginManager::deinitPlugins() plugins[i].interface->deinit(); } +qmpPluginAPI::~qmpPluginAPI(){} + uint32_t qmpPluginAPI::getDivision() {return qmw&&qmw->getPlayer()?qmw->getPlayer()->getDivision():0;} uint32_t qmpPluginAPI::getRawTempo() |