aboutsummaryrefslogtreecommitdiff
path: root/qmidiplayer-desktop/qmpplugin.cpp
diff options
context:
space:
mode:
authorGravatar Chris Xiong <chirs241097@gmail.com> 2019-11-02 22:13:32 +0800
committerGravatar Chris Xiong <chirs241097@gmail.com> 2019-11-02 22:13:32 +0800
commitb2ef363f49db70219ac1eaebb7d69dcdade8d60b (patch)
treecfc0e8da88dc27b62578dccbce367736e020f63d /qmidiplayer-desktop/qmpplugin.cpp
parent23525e2a648a23f099c2b533aa91839a2f8e829f (diff)
downloadQMidiPlayer-b2ef363f49db70219ac1eaebb7d69dcdade8d60b.tar.xz
Keyboard plugin: show additional information on the side.
qmpPluginAPI::registerEventHandler now accepts an optional argument that determines whether the handler is called prior to or after an event is sent.
Diffstat (limited to 'qmidiplayer-desktop/qmpplugin.cpp')
-rw-r--r--qmidiplayer-desktop/qmpplugin.cpp12
1 files changed, 9 insertions, 3 deletions
diff --git a/qmidiplayer-desktop/qmpplugin.cpp b/qmidiplayer-desktop/qmpplugin.cpp
index fd79b16..774f0da 100644
--- a/qmidiplayer-desktop/qmpplugin.cpp
+++ b/qmidiplayer-desktop/qmpplugin.cpp
@@ -179,7 +179,13 @@ std::string qmpPluginAPI::getChannelPresetString(int ch)
std::string nm;
if(qmw&&qmw->getPlayer())
{
- qmw->getPlayer()->getChannelOutputDevice(ch)->getChannelPreset(ch,&b,&p,nm);
+ int r=qmw->getPlayer()->getChannelOutputDevice(ch)->getChannelPreset(ch,&b,&p,nm);
+ if(!r)
+ {
+ b=qmw->getPlayer()->getCC(ch,0)<<7|qmw->getPlayer()->getCC(ch,32);
+ p=qmw->getPlayer()->getCC(ch,128);
+ nm=qmw->getPlayer()->getChannelOutputDevice(ch)->getPresetName(b,p);
+ }
snprintf(ret,320,"%03d:%03d %s",b,p,nm.c_str());
}
return std::string(ret);
@@ -223,8 +229,8 @@ void qmpPluginAPI::registerFileReader(qmpFileReader* reader,std::string name)
{qmw->getPlayer()->registerReader(reader,name);}
void qmpPluginAPI::unregisterFileReader(std::string name)
{qmw->getPlayer()->unregisterReader(name);}
-int qmpPluginAPI::registerEventHandler(callback_t cb,void *userdata)
-{return qmw->getPlayer()->registerEventHandler(cb,userdata);}
+int qmpPluginAPI::registerEventHandler(callback_t cb,void *userdata,bool post)
+{return qmw->getPlayer()->registerEventHandler(cb,userdata,post);}
void qmpPluginAPI::unregisterEventHandler(int id)
{qmw->getPlayer()->unregisterEventHandler(id);}
int qmpPluginAPI::registerEventReadHandler(callback_t cb,void *userdata)