diff options
author | Chris Xiong <chirs241097@gmail.com> | 2017-02-08 23:45:18 +0800 |
---|---|---|
committer | Chris Xiong <chirs241097@gmail.com> | 2017-02-08 23:45:18 +0800 |
commit | 1976c49f835267d33ef88bd3fc20d18363e12c0b (patch) | |
tree | e1eaca367a37238c1b2a5fc0f4ff7cb29a723a86 /qmidiplayer-desktop | |
parent | 1afedc4cc39c1dcbe49f8c99843a1732bf22fa28 (diff) | |
download | QMidiPlayer-1976c49f835267d33ef88bd3fc20d18363e12c0b.tar.xz |
Add API version verification. This breaks compatibility
with old versions of plugins.
Add RIFF MIDI support to the SMF reader.
Documentation.
Diffstat (limited to 'qmidiplayer-desktop')
-rw-r--r-- | qmidiplayer-desktop/qmpplistwindow.cpp | 4 | ||||
-rw-r--r-- | qmidiplayer-desktop/qmpplugin.cpp | 10 | ||||
-rw-r--r-- | qmidiplayer-desktop/qmpplugin.hpp | 1 |
3 files changed, 13 insertions, 2 deletions
diff --git a/qmidiplayer-desktop/qmpplistwindow.cpp b/qmidiplayer-desktop/qmpplistwindow.cpp index 75e2e44..5805fcb 100644 --- a/qmidiplayer-desktop/qmpplistwindow.cpp +++ b/qmidiplayer-desktop/qmpplistwindow.cpp @@ -149,7 +149,7 @@ void qmpPlistWindow::on_pbAdd_clicked() if(qmpSettingsWindow::getSettingsIntf()->value("Behavior/DialogStatus","").toInt()) sl=QFileDialog::getOpenFileNames(this,"Add File",qmpSettingsWindow::getSettingsIntf()->value("DialogStatus/FileDialogPath","").toString(),"Midi files (*.mid *.midi)"); else - sl=QFileDialog::getOpenFileNames(this,"Add File","","Midi files (*.mid *.midi)"); + sl=QFileDialog::getOpenFileNames(this,"Add File","","Midi files (*.mid *.midi *.rmi)"); if(sl.empty())return; for(int i=0;i<sl.size();++i) { @@ -166,7 +166,7 @@ void qmpPlistWindow::on_pbAddFolder_clicked() while(di.hasNext()) { QString c=di.next(); - if((c.endsWith(".mid")||c.endsWith(".midi"))&&fluid_is_midifile(c.toStdString().c_str())) + if((c.endsWith(".mid")||c.endsWith(".midi")||c.endsWith(".rmi"))&&fluid_is_midifile(c.toStdString().c_str())) ui->lwFiles->addItem(new QListWidgetItem(c)); } } diff --git a/qmidiplayer-desktop/qmpplugin.cpp b/qmidiplayer-desktop/qmpplugin.cpp index 5f5d82e..96936bd 100644 --- a/qmidiplayer-desktop/qmpplugin.cpp +++ b/qmidiplayer-desktop/qmpplugin.cpp @@ -31,6 +31,11 @@ void qmpPluginManager::scanPlugins() if(!hso){fprintf(stderr,"Error while loading library: %d\n",GetLastError());continue;} FARPROC hndi=GetProcAddress(hso,"qmpPluginGetInterface"); if(!hndi){fprintf(stderr,"file %s doesn't seem to be a qmidiplayer plugin.\n",cpluginpaths[i].c_str());continue;} + FARPROC hndiv=GetProcAddress(hso,"qmpPluginGetAPIRev"); + if(!hndiv){fprintf(stderr,"file %s is incompatible with this version of qmidiplayer.\n",cpluginpaths[i].c_str());continue;} + qmpPluginAPIRevEntry getv=(qmpPluginAPIRevEntry)hndiv; + if(strcmp(getv(),QMP_PLUGIN_API_REV)) + {fprintf(stderr,"file %s is incompatible with this version of qmidiplayer.\n",cpluginpaths[i].c_str());continue;} qmpPluginEntry e=(qmpPluginEntry)hndi; qmpPluginIntf* intf=e(pluginAPI); plugins.push_back(qmpPlugin(std::string(intf->pluginGetName()),std::string(intf->pluginGetVersion()),std::string(cpluginpaths[i]),intf)); @@ -65,6 +70,11 @@ void qmpPluginManager::scanPlugins() if(!hso){fprintf(stderr,"%s\n",dlerror());continue;} void* hndi=dlsym(hso,"qmpPluginGetInterface"); if(!hndi){fprintf(stderr,"file %s doesn't seem to be a qmidiplayer plugin.\n",cpluginpaths[i].c_str());continue;} + void* hndiv=dlsym(hso,"qmpPluginGetAPIRev"); + if(!hndiv){fprintf(stderr,"file %s is incompatible with this version of qmidiplayer.\n",cpluginpaths[i].c_str());continue;} + qmpPluginAPIRevEntry getv=(qmpPluginAPIRevEntry)hndiv; + if(strcmp(getv(),QMP_PLUGIN_API_REV)) + {fprintf(stderr,"file %s is incompatible with this version of qmidiplayer.\n",cpluginpaths[i].c_str());continue;} qmpPluginEntry e=(qmpPluginEntry)hndi; qmpPluginIntf* intf=e(pluginAPI); plugins.push_back(qmpPlugin(std::string(intf->pluginGetName()),std::string(intf->pluginGetVersion()),std::string(cpluginpaths[i]),intf)); diff --git a/qmidiplayer-desktop/qmpplugin.hpp b/qmidiplayer-desktop/qmpplugin.hpp index d69adeb..512fc35 100644 --- a/qmidiplayer-desktop/qmpplugin.hpp +++ b/qmidiplayer-desktop/qmpplugin.hpp @@ -3,6 +3,7 @@ #define QMP_MAIN #include <string> #include <vector> +#define QMP_MAIN #include "../include/qmpcorepublic.hpp" struct qmpPlugin { |