aboutsummaryrefslogtreecommitdiff
path: root/qmidiplayer-desktop/qmpplugin.cpp
diff options
context:
space:
mode:
authorGravatar Chris Xiong <chirs241097@gmail.com> 2016-04-26 23:16:46 +0800
committerGravatar Chris Xiong <chirs241097@gmail.com> 2016-04-26 23:16:46 +0800
commitdfcc193d4070c99bf217ac74a492160968dba766 (patch)
tree444132b8cf98ef3d8bc7b346f6e5bf515e662f1b /qmidiplayer-desktop/qmpplugin.cpp
parent4ffde0ad55d041229793ca4457123bcbcbf8e0c0 (diff)
downloadQMidiPlayer-dfcc193d4070c99bf217ac74a492160968dba766.tar.xz
The visualization plugin is usable now...
Diffstat (limited to 'qmidiplayer-desktop/qmpplugin.cpp')
-rw-r--r--qmidiplayer-desktop/qmpplugin.cpp29
1 files changed, 18 insertions, 11 deletions
diff --git a/qmidiplayer-desktop/qmpplugin.cpp b/qmidiplayer-desktop/qmpplugin.cpp
index aea01da..a71b869 100644
--- a/qmidiplayer-desktop/qmpplugin.cpp
+++ b/qmidiplayer-desktop/qmpplugin.cpp
@@ -62,25 +62,30 @@ void qmpPluginManager::initPlugins()
plugins[i].interface->init();
}
}
+void qmpPluginManager::deinitPlugins()
+{
+ for(unsigned i=0;i<plugins.size();++i)
+ plugins[i].interface->deinit();
+}
uint32_t qmpPluginAPI::getDivision()
-{return qmw->getPlayer()->getDivision();}
+{return qmw&&qmw->getPlayer()?qmw->getPlayer()->getDivision():0;}
uint32_t qmpPluginAPI::getRawTempo()
-{return qmw->getPlayer()->getRawTempo();}
+{return qmw&&qmw->getPlayer()?qmw->getPlayer()->getRawTempo():0;}
double qmpPluginAPI::getRealTempo()
-{return qmw->getPlayer()->getTempo();}
+{return qmw&&qmw->getPlayer()?qmw->getPlayer()->getTempo():0;}
uint32_t qmpPluginAPI::getTimeSig()
-{int n,d=0,t;qmw->getPlayer()->getCurrentTimeSignature(&n,&t);for(;t>>=1;++d);return n<<8|d;}
+{int n,d=0,t;qmw&&qmw->getPlayer()?qmw->getPlayer()->getCurrentTimeSignature(&n,&t):void(0);for(;t>>=1;++d);return n<<8|d;}
int qmpPluginAPI::getKeySig()
-{return qmw->getPlayer()->getCurrentKeySignature();}
+{return qmw&&qmw->getPlayer()?qmw->getPlayer()->getCurrentKeySignature():0;}
uint32_t qmpPluginAPI::getNoteCount()
-{return qmw->getPlayer()->getFileNoteCount();}
+{return qmw&&qmw->getPlayer()?qmw->getPlayer()->getFileNoteCount():0;}
uint32_t qmpPluginAPI::getCurrentPolyphone()
-{return qmw->getPlayer()->getPolyphone();}
+{return qmw&&qmw->getPlayer()?qmw->getPlayer()->getPolyphone():0;}
uint32_t qmpPluginAPI::getMaxPolyphone()
-{return qmw->getPlayer()->getMaxPolyphone();}
+{return qmw&&qmw->getPlayer()?qmw->getPlayer()->getMaxPolyphone():0;}
uint32_t qmpPluginAPI::getCurrentTimeStamp()
-{return qmw->getPlayer()->getTCeptr();}
+{return qmw&&qmw->getPlayer()?qmw->getPlayer()->getTick():0;}
int qmpPluginAPI::registerEventHandlerIntf(IMidiCallBack *cb,void *userdata)
{return qmw->getPlayer()->setEventHandlerCB(cb,userdata);}
void qmpPluginAPI::unregisterEventHandlerIntf(int intfhandle)
@@ -89,8 +94,10 @@ int qmpPluginAPI::registerEventReaderIntf(IMidiCallBack *cb,void *userdata)
{return qmw->getPlayer()->setEventReaderCB(cb,userdata);}
void qmpPluginAPI::unregisterEventReaderIntf(int intfhandle)
{qmw->getPlayer()->unsetEventReaderCB(intfhandle);}
-int qmpPluginAPI::registerVisualizationIntf(qmpVisualizationIntf*){return 0;}
-void qmpPluginAPI::unregisterVisualizationIntf(int){}
+int qmpPluginAPI::registerVisualizationIntf(qmpVisualizationIntf* intf)
+{return qmw->registerVisualizationIntf(intf);}
+void qmpPluginAPI::unregisterVisualizationIntf(int intfhandle)
+{qmw->unregisterVisualizationIntf(intfhandle);}
void qmpPluginAPI::registerOptionInt(std::string,std::string,int){}
int qmpPluginAPI::getOptionInt(std::string){return 0;}
void qmpPluginAPI::registerOptionDouble(std::string,std::string,double){}