From 37ba9dd1ce449bc2c2f422dd04225bc68bd89c59 Mon Sep 17 00:00:00 2001 From: Chris Xiong Date: Fri, 2 Jun 2017 21:12:27 +0800 Subject: Some changes from earlier this year. Read ChangeLog for details. --- ChangeLog | 7 +++++ INSTALL | 12 -------- INSTALL.md | 37 +++++++++++++++++++++++++ README.md | 1 + core/qmpmidimapperrtmidi.cpp | 14 +++++++--- debian/changelog | 6 ++++ debian/control | 5 ++++ debian/qmidiplayer-plugin-visualization.install | 2 +- doc/APIdoc.md | 37 +++++++++++++++++++++++-- qmidiplayer.pro | 2 -- visualization/qmpvisualization.cpp | 2 +- 11 files changed, 103 insertions(+), 22 deletions(-) delete mode 100644 INSTALL create mode 100644 INSTALL.md diff --git a/ChangeLog b/ChangeLog index e00527e..f7626be 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2017-06-02 0.8.5 indev +Accumulative changes from 2017-03: + Don't crash if RtMidi initialization failed. + Hopefully fixed crash when closing the + visualization window on Windows. + Documentation update. + 2017-02-14 0.8.5 indev Scan for plugins in the executable directory instead of the working directory. diff --git a/INSTALL b/INSTALL deleted file mode 100644 index 631d26d..0000000 --- a/INSTALL +++ /dev/null @@ -1,12 +0,0 @@ -Use qmake or Qt Creator. - -Dependencies: -> libfluidsynth 1.1.4+, Qt5 and RtMidi. - -C++11 is required to build the project. Qt4 will not work without -several tweaks. - -To build the default visualization plugin, you need the latest SMELT, -which can be found [here](https://github.com/BearKidsTeam/SMELT). -Some dependencies in the project file are hard-coded paths. You may -have to modify them first. diff --git a/INSTALL.md b/INSTALL.md new file mode 100644 index 0000000..e9e5c8d --- /dev/null +++ b/INSTALL.md @@ -0,0 +1,37 @@ +# General instructions +Use qmake or Qt Creator. + +Dependencies: + +> libfluidsynth 1.1.4+, Qt5, Qt5 Qt quick controls(lite version) and RtMidi. + +C++11 is _required_ to build the project. Qt4 will not work without +several tweaks. + +To build the default visualization plugin, you need the latest SMELT library +(along with all its dependencies), which can be found +[here](https://github.com/BearKidsTeam/SMELT). + +Some dependencies in the project file are hard-coded paths. You may +have to modify them first. Alternatively, you can set the environmental +variable `SMELT_DIR` to where your SMELT build is. + +If you don't want to build the default visualization plugin, just remove +the line containing "visualization" in qmidiplayer.pro. + +# Instruction for dumbs + +1. Get SMELT [here](https://github.com/BearKidsTeam/SMELT). +2. Get the source code [here](https://github.com/chirs241097/QMidiPlayer). +3. The following steps are done in an interactive shell. +4. Change directory (`cd`) to the folder with the source code of SMELT. + type `make` to build it. +5. Type `export QMP_BUILD_MODE=1` to allow QMP to scan plugins in + /usr/lib/qmidiplayer. +6. Type `export SMELT_DIR=` in order + to tell qmake where SMELT is. +7. Change directory to the folder with the source code of QMidiPlayer. + type `qmake` and then `make` to build it. Appending `PREFIX=/usr` to `qmake` + is highly recommended because QMidiPlayer only scans for plugins in + working directory and /usr/lib/qmidiplayer at this moment. +8. Use `sudo make install` to install QMidiPlayer. diff --git a/README.md b/README.md index ba87e64..8c7632a 100644 --- a/README.md +++ b/README.md @@ -11,6 +11,7 @@ Features: * Rendering midi to wave file * Visualization using SMELT (highly experimental Windows version now available) * MIDI mapping (based on RtMidi) +* Plugin interface for extending the player easily Tested on Debian sid and Windows Vista~10. diff --git a/core/qmpmidimapperrtmidi.cpp b/core/qmpmidimapperrtmidi.cpp index 2d4fc26..263cada 100644 --- a/core/qmpmidimapperrtmidi.cpp +++ b/core/qmpmidimapperrtmidi.cpp @@ -6,20 +6,26 @@ RtMidiOut* qmpMidiMapperRtMidi::dummy=NULL; qmpMidiMapperRtMidi::qmpMidiMapperRtMidi() { - dummy=new RtMidiOut(); + try{dummy=new RtMidiOut();} + catch(RtMidiError &e) + { + printf("Failed to initialize the dummy device: %s\n",e.what()); + dummy=NULL; + } memset(ports,0,sizeof(ports)); } qmpMidiMapperRtMidi::~qmpMidiMapperRtMidi() { - delete dummy;for(int i=0;i<16;++i)if(ports[i])delete ports[i]; + delete dummy;dummy=NULL; + for(int i=0;i<16;++i)if(ports[i])delete ports[i]; } int qmpMidiMapperRtMidi::enumDevices() { - return dummy->getPortCount(); + return dummy?dummy->getPortCount():0; } std::string qmpMidiMapperRtMidi::deviceName(int id) { - return dummy->getPortName(id); + return dummy?dummy->getPortName(id):""; } int qmpMidiMapperRtMidi::deviceInit(int id) { diff --git a/debian/changelog b/debian/changelog index 8e099e7..1eb0adc 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +qmidiplayer (0.8.5-1) UNRELEASED; urgency=low + + * New upstream release. + + -- chrisoft Tue, 14 Feb 2017 20:10:58 +0800 + qmidiplayer (0.8.3-2) UNRELEASED; urgency=low * New upstream release. diff --git a/debian/control b/debian/control index 2773d44..703ad68 100644 --- a/debian/control +++ b/debian/control @@ -32,3 +32,8 @@ Package: qmidiplayer-plugin-visualization Architecture: any Depends: qmidiplayer, ${shlibs:Depends}, ${misc:Depends} Description: Midi visualization plugin for QMidiPlayer. + +Package: qmidiplayer-plugin-midifmt +Architecture: any +Depends: qmidiplayer, ${shlibs:Depends}, ${misc:Depends} +Description: Extra midi formats support for QMidiPlayer. diff --git a/debian/qmidiplayer-plugin-visualization.install b/debian/qmidiplayer-plugin-visualization.install index 2c02e3e..070b409 100644 --- a/debian/qmidiplayer-plugin-visualization.install +++ b/debian/qmidiplayer-plugin-visualization.install @@ -1,4 +1,4 @@ -usr/lib/qmidiplayer/* +usr/lib/qmidiplayer/libvisualization.* usr/share/qmidiplayer/img/chequerboard.png usr/share/qmidiplayer/img/kb_128.png usr/share/qmidiplayer/img/particle.png diff --git a/doc/APIdoc.md b/doc/APIdoc.md index bc5e210..5569e49 100644 --- a/doc/APIdoc.md +++ b/doc/APIdoc.md @@ -71,6 +71,39 @@ reader and handler hooks have `SEventCallBackData*` as their `callerdata` while `callerdata` (`NULL`). # 4. Functionalities -Plugins extend the hosts with extra functionalities. With hooks, handlers and the built-in core API, you can already do a +Plugins extend the host with extra functionalities. With hooks, handlers and the built-in core API, you can already do a lot of hacking. If that cannot make you satisfied, QMidiPlayer have several vacancies that are expected to be implemented -by plugins. +by plugins. And with the introduction of the general functionality API, you can now virtually add anything to QMidiPlayer! + +## 4.1 What is a functionality? +Have a look at the main window. By default there're three or four buttons at the bottom of it. +These are functionalities. Functionalties go into two types: checkable and non-checkable. +Checkable functionalities can be toggled on or off, while non-checkable functionalities have +no such states. For non-checkable functionalities, only show() is called when the user invokes it. +The user can arrange functionalities shown on the toolbar and the action menu to their needs. + +## 4.2 Visualization +Visualization was once a feature of QMidiPlayer's core. But you can now write your own visualization with the +Visualization interface(`qmpVisualizationIntf`). The methods in this interface should be self-explanatory. + +## 4.3 MIDI File Reader +This is not strictly a "functionality", because its interface IMidiFileReader does not inherit qmpFuncBaseIntf. +When the user requests to open a file, the core tries to load the file with registered file readers and +accepts the first valid result. Therefore you can implement your own file reader, which may even add +eXtended Module support to QMidiPlayer! + +# 5. Reference +Well, everything above is just nonsense compared to this one. The full reference of the API is here. + +struct SEvent: +members: + +- iid (uint32_t): internal id. Usually set to the size of the event pool when current event is read. +- time (uint32_t): event time in tick. +- p1 (uint32_t): parameter 1 for the midi device. +- p2 (uint32_t): parameter 2 for the midi device. +- type (uint8_t): type of the event together with the channel this event goes to. +- str (std::string): Contains the raw data for string-like events. +- default constructor: sets everything to zero or empty. +- constructor with parameters +- friend bool operator <(const SEvent& a,const SEvent& b) diff --git a/qmidiplayer.pro b/qmidiplayer.pro index 86d69bd..728f958 100644 --- a/qmidiplayer.pro +++ b/qmidiplayer.pro @@ -12,5 +12,3 @@ android { SUBDIRS = \ qmidiplayer-lite } - -SUBDIRS += \ diff --git a/visualization/qmpvisualization.cpp b/visualization/qmpvisualization.cpp index 831c1af..ffc01ad 100644 --- a/visualization/qmpvisualization.cpp +++ b/visualization/qmpvisualization.cpp @@ -190,6 +190,7 @@ void qmpVisualization::showThread() rot[2]=api->getOptionDouble("Visualization/rz"); } sm->smMainLoop(); + sm->smFinale(); } void qmpVisualization::show() { @@ -208,7 +209,6 @@ void qmpVisualization::close() if(showpiano&&!horizontal)for(int i=0;i<16;++i)delete p3d[i]; if(showparticle&&!horizontal)for(int i=0;i>16;++i)for(int j=0;j<128;++j){delete pss[i][j];pss[i][j]=0;} if(noteappearance==1)delete nebuf; - sm->smFinale(); if(savevp) { api->setOptionDouble("Visualization/px",pos[0]); -- cgit v1.2.3