aboutsummaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
authorGravatar Chris Xiong <chirs241097@gmail.com> 2016-04-23 23:50:31 +0800
committerGravatar Chris Xiong <chirs241097@gmail.com> 2016-04-23 23:50:31 +0800
commitaa8af83ff8889aa136e9152b2cca9a88d99c5f47 (patch)
tree54af0c407c08d86c1fbf5e5856ee66c4f80e1b0b /core
parent446263beafeafa831530a6f9711aa891955b7db3 (diff)
downloadQMidiPlayer-aa8af83ff8889aa136e9152b2cca9a88d99c5f47.tar.xz
Add stubs for plugin support.
Diffstat (limited to 'core')
-rw-r--r--core/qmpmidiplay.cpp6
-rw-r--r--core/qmpmidiplay.hpp14
2 files changed, 8 insertions, 12 deletions
diff --git a/core/qmpmidiplay.cpp b/core/qmpmidiplay.cpp
index e33f804..cbed018 100644
--- a/core/qmpmidiplay.cpp
+++ b/core/qmpmidiplay.cpp
@@ -49,6 +49,7 @@ void CMidiPlayer::fluidDeinitialize()
}
void CMidiPlayer::processEvent(const SEvent *e)
{
+ SEventCallBackData cbd(e->type,e->p1,e->p2);
switch(e->type&0xF0)
{
case 0x80://Note off
@@ -60,7 +61,7 @@ void CMidiPlayer::processEvent(const SEvent *e)
case 0x90://Note on
if((mute>>(e->type&0x0F))&1)break;//muted
if(solo&&!((solo>>(e->type&0x0F))&1))break;
- if(noteOnCB)noteOnCB->callBack(noteOnCBUserData);
+ if(noteOnCB)noteOnCB->callBack(&cbd,noteOnCBUserData);
if(mappedoutput[e->type&0x0F])
mapper->noteOn(mappedoutput[e->type&0x0F]-1,e->type&0x0F,e->p1,e->p2);
else
@@ -397,6 +398,7 @@ uint32_t CMidiPlayer::getFileStandard(){return midiFile?midiFile->getStandard():
const char* CMidiPlayer::getTitle(){return midiFile?midiFile->getTitle():"";}
const char* CMidiPlayer::getCopyright(){return midiFile?midiFile->getCopyright():"";}
double CMidiPlayer::getTempo(){return 60./(ctempo/1e6);}
+uint32_t CMidiPlayer::getDivision(){return divs;}
uint32_t CMidiPlayer::getTCpaused(){return tcpaused;}
void CMidiPlayer::setTCpaused(uint32_t ps){tcpaused=ps;}
uint32_t CMidiPlayer::isFinished(){return finished;}
@@ -528,5 +530,5 @@ void CMidiPlayer::setChannelOutput(int ch,int devid)
}else fluid_synth_all_notes_off(synth,ch);
}
uint8_t* CMidiPlayer::getChstates(){return chstate;}
-void CMidiPlayer::setNoteOnCallBack(CMidiCallBack *cb,void *userdata)
+void CMidiPlayer::setNoteOnCallBack(IMidiCallBack *cb,void *userdata)
{noteOnCB=cb;noteOnCBUserData=userdata;}
diff --git a/core/qmpmidiplay.hpp b/core/qmpmidiplay.hpp
index 9bb6323..4f3b50f 100644
--- a/core/qmpmidiplay.hpp
+++ b/core/qmpmidiplay.hpp
@@ -2,10 +2,10 @@
#ifndef QMPMIDIPLAY_H
#define QMPMIDIPLAY_H
#include <cstring>
-#include <cstdint>
#include <cstdlib>
#include <vector>
#include <fluidsynth.h>
+#include "../include/qmpcorepublic.hpp"
#include "qmpmidimappers.hpp"
struct SEvent
{
@@ -21,13 +21,6 @@ struct SEvent
if(s){str=new char[strlen(s)+2];strcpy(str,s);}else str=NULL;
}
};
-class CMidiCallBack
-{
- public:
- CMidiCallBack(){}
- virtual void callBack(void* data)=0;
- virtual ~CMidiCallBack(){}
-};
class CMidiFile
{
private:
@@ -83,7 +76,7 @@ class CMidiPlayer
qmpMidiMapperRtMidi *mapper;
int mappedoutput[16],deviceusage[16],deviceiid[128];
uint8_t chstate[16],chstatus[16][130];//0..127: cc 128: pc
- CMidiCallBack *noteOnCB;
+ IMidiCallBack *noteOnCB;
void* noteOnCBUserData;
void setBit(uint16_t &n,uint16_t bn,uint16_t b);
@@ -126,6 +119,7 @@ class CMidiPlayer
uint32_t getFileNoteCount();
uint32_t getFileStandard();
double getTempo();
+ uint32_t getDivision();
const char* getTitle();
const char* getCopyright();
@@ -154,6 +148,6 @@ class CMidiPlayer
qmpMidiMapperRtMidi* getMidiMapper();
void setChannelOutput(int ch,int devid);
uint8_t* getChstates();
- void setNoteOnCallBack(CMidiCallBack *cb,void *userdata);
+ void setNoteOnCallBack(IMidiCallBack *cb,void *userdata);
};
#endif