aboutsummaryrefslogtreecommitdiff
path: root/qmidiplayer-desktop
diff options
context:
space:
mode:
authorGravatar Chris Xiong <chirs241097@gmail.com> 2016-04-24 23:47:04 +0800
committerGravatar Chris Xiong <chirs241097@gmail.com> 2016-04-24 23:47:04 +0800
commit800a0417e9ed175f220c472842a283202c77060b (patch)
tree6609fcccf55d176d8eb61aa69526a19ba1859487 /qmidiplayer-desktop
parentaa8af83ff8889aa136e9152b2cca9a88d99c5f47 (diff)
downloadQMidiPlayer-800a0417e9ed175f220c472842a283202c77060b.tar.xz
Problematic commit...
Diffstat (limited to 'qmidiplayer-desktop')
-rw-r--r--qmidiplayer-desktop/qmpchannelswindow.cpp2
-rw-r--r--qmidiplayer-desktop/qmpchannelswindow.hpp3
-rw-r--r--qmidiplayer-desktop/qmpinfowindow.cpp2
-rw-r--r--qmidiplayer-desktop/qmpmainwindow.cpp1
-rw-r--r--qmidiplayer-desktop/qmpplugin.cpp33
5 files changed, 38 insertions, 3 deletions
diff --git a/qmidiplayer-desktop/qmpchannelswindow.cpp b/qmidiplayer-desktop/qmpchannelswindow.cpp
index 282a4cc..7def34d 100644
--- a/qmidiplayer-desktop/qmpchannelswindow.cpp
+++ b/qmidiplayer-desktop/qmpchannelswindow.cpp
@@ -17,7 +17,7 @@ qmpChannelsWindow::qmpChannelsWindow(QWidget *parent) :
mapper=qmpMainWindow::getInstance()->getPlayer()->getMidiMapper();
cha=new QPixmap(":/img/ledon.png");chi=new QPixmap(":/img/ledoff.png");
cb=new qmpCWNoteOnCB();fused=callbacksc=cbcnt=0;
- qmpMainWindow::getInstance()->getPlayer()->setNoteOnCallBack(cb,NULL);
+ qmpMainWindow::getInstance()->getPlayer()->setEventHandlerCB(cb,NULL);
connect(cb,SIGNAL(onNoteOn()),this,SLOT(updateChannelActivity()));
int devc=mapper->enumDevices();
//We setup default output here...
diff --git a/qmidiplayer-desktop/qmpchannelswindow.hpp b/qmidiplayer-desktop/qmpchannelswindow.hpp
index 15a53d6..0fa1e06 100644
--- a/qmidiplayer-desktop/qmpchannelswindow.hpp
+++ b/qmidiplayer-desktop/qmpchannelswindow.hpp
@@ -63,7 +63,8 @@ class qmpCWNoteOnCB:public QObject,public IMidiCallBack
{
Q_OBJECT
public:
- void callBack(void*,void*){emit onNoteOn();}
+ void callBack(void* callerdata,void*)
+ {if(((((SEventCallBackData*)callerdata)->type)&0xF0)==0x90)emit onNoteOn();}
signals:
void onNoteOn();
};
diff --git a/qmidiplayer-desktop/qmpinfowindow.cpp b/qmidiplayer-desktop/qmpinfowindow.cpp
index 689a756..95ad223 100644
--- a/qmidiplayer-desktop/qmpinfowindow.cpp
+++ b/qmidiplayer-desktop/qmpinfowindow.cpp
@@ -45,7 +45,7 @@ void qmpInfoWindow::updateInfo()
}
else ui->lbCopyright->setText(QString("Copyright: "));
ui->lbTempo->setText(QString("Tempo: ")+QString::number(player->getTempo(),'g',5));
- int t,r;player->getCurrentKeySignature(&t);r=(int8_t)((t>>8)&0xFF)+7;
+ int t,r;t=player->getCurrentKeySignature();r=(int8_t)((t>>8)&0xFF)+7;
strncpy(str,t&0xFF?minors+2*r:majors+2*r,2);str[2]='\0';
ui->lbKeySig->setText(QString("Key Sig.: ")+str);
player->getCurrentTimeSignature(&t,&r);sprintf(str,"Time Sig.: %d/%d",t,r);
diff --git a/qmidiplayer-desktop/qmpmainwindow.cpp b/qmidiplayer-desktop/qmpmainwindow.cpp
index 84697a4..9d73626 100644
--- a/qmidiplayer-desktop/qmpmainwindow.cpp
+++ b/qmidiplayer-desktop/qmpmainwindow.cpp
@@ -75,6 +75,7 @@ void qmpMainWindow::init()
ui->lbFileName->addAction(fnA1);
ui->lbFileName->addAction(fnA2);
ui->lbFileName->addAction(fnA3);
+ pmgr->scanPlugins();pmgr->initPlugins();
if(singleFS){player->fluidPreInitialize();playerSetup();player->fluidInitialize();
for(int i=settingsw->getSFWidget()->count()-1;i>=0;--i)
LOAD_SOUNDFONT;}
diff --git a/qmidiplayer-desktop/qmpplugin.cpp b/qmidiplayer-desktop/qmpplugin.cpp
index 4da1698..559b575 100644
--- a/qmidiplayer-desktop/qmpplugin.cpp
+++ b/qmidiplayer-desktop/qmpplugin.cpp
@@ -4,6 +4,7 @@
#include <dlfcn.h>
#include <dirent.h>
#endif
+#include <cstdio>
#include <cstring>
#include "qmpplugin.hpp"
#include "qmpmainwindow.hpp"
@@ -53,6 +54,38 @@ qmpPluginManager::~qmpPluginManager()
{
qmw=NULL;qsw=NULL;
}
+void qmpPluginManager::initPlugins()
+{
+ for(unsigned i=0;i<plugins.size();++i)
+ {
+ printf("Loaded plugin: %s\n",plugins[i].path.c_str());
+ plugins[i].interface->init();
+ }
+}
uint32_t qmpPluginAPI::getDivision()
{return qmw->getPlayer()->getDivision();}
+uint32_t qmpPluginAPI::getRawTempo()
+{return qmw->getPlayer()->getRawTempo();}
+double qmpPluginAPI::getRealTempo()
+{return qmw->getPlayer()->getTempo();}
+uint32_t qmpPluginAPI::getTimeSig()
+{int n,d=0,t;qmw->getPlayer()->getCurrentTimeSignature(&n,&t);for(;t>>=1;++d);return n<<8|d;}
+int qmpPluginAPI::getKeySig()
+{return qmw->getPlayer()->getCurrentKeySignature();}
+uint32_t qmpPluginAPI::getNoteCount()
+{return qmw->getPlayer()->getFileNoteCount();}
+uint32_t qmpPluginAPI::getCurrentPolyphone()
+{return qmw->getPlayer()->getPolyphone();}
+uint32_t qmpPluginAPI::getMaxPolyphone()
+{return qmw->getPlayer()->getMaxPolyphone();}
+uint32_t qmpPluginAPI::getCurrentTimeStamp()
+{return qmw->getPlayer()->getTCeptr();}
+int qmpPluginAPI::registerEventHandlerIntf(IMidiCallBack *cb,void *userdata)
+{return qmw->getPlayer()->setEventHandlerCB(cb,userdata);}
+void qmpPluginAPI::unregisterEventHandlerIntf(int intfhandle)
+{qmw->getPlayer()->unsetEventHandlerCB(intfhandle);}
+int qmpPluginAPI::registerEventReaderIntf(IMidiCallBack *cb,void *userdata)
+{return qmw->getPlayer()->setEventReaderCB(cb,userdata);}
+void qmpPluginAPI::unregisterEventReaderIntf(int intfhandle)
+{qmw->getPlayer()->unsetEventReaderCB(intfhandle);}