aboutsummaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorGravatar Chris Xiong <chirs241097@gmail.com> 2017-06-21 13:03:30 +0800
committerGravatar Chris Xiong <chirs241097@gmail.com> 2017-06-21 13:03:30 +0800
commit0c3fe540e925829022d9d8aa567c2dc2bd3d33d5 (patch)
treeab9ecae4def5a329b5e796839ece97f4b9c0297f /doc
parent64c91c7da66ba71e2bb32077680f234aba4ac65d (diff)
downloadQMidiPlayer-0c3fe540e925829022d9d8aa567c2dc2bd3d33d5.tar.xz
Complete rewrite of the MIDI mapper.
Enforces single fluidsynth instance. Documentation update. Minor changes to make lite version work.
Diffstat (limited to 'doc')
-rw-r--r--doc/APIdoc.md130
-rw-r--r--doc/optionsdialog.html5
2 files changed, 120 insertions, 15 deletions
diff --git a/doc/APIdoc.md b/doc/APIdoc.md
index 5569e49..c050869 100644
--- a/doc/APIdoc.md
+++ b/doc/APIdoc.md
@@ -92,18 +92,122 @@ When the user requests to open a file, the core tries to load the file with regi
accepts the first valid result. Therefore you can implement your own file reader, which may even add
eXtended Module support to QMidiPlayer!
-# 5. Reference
+## 4.4 MIDI Output Device
+This is not a functionality either. By implementing the interface qmpMidiOutDevice and registering it, you can
+add custom MIDI Devices in the built-in MIDI mapper.
+
+# 5. Generic Considerations
+
+1. If you implemented a API that returns a pointer to something, you can forget about the pointer after returning
+it. The core will free its memory after it is no longer used. You shouldn't extend the class pointed to because
+if you do so, the core will not be able to destruct it correctly. Examples include IMidiFileReader::readFile which
+returns a pointer to a CMidiFile class.
+2. However if you passed a pointer to the core through a function in qmpPluginAPI, you cannot forget about the pointer
+later. As these pointers are mostly polymorphic, the core cannot handle their destruction. You have to delete them
+yourself in the deinit() function of your plugin.
+
+# 6. 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)
+## Structures & Classes
+
+### struct SEvent
+Describes an MIDI event.
+
+- `uint32_t iid`
+internal id. Usually set to the size of the event pool when current event is read.
+- `uint32_t time`
+timestamp of the event in MIDI tick.
+- `uint32_t p1`
+parameter 1 for the midi event.
+- `uint32_t p2`
+parameter 2 for the midi event.
+- `uint8_t type`
+type of the event together with the channel this event goes to.
+- `std::string str`
+Contains the raw data for string-like events.
+- default constructor: `SEvent()`
+sets everything to zero or empty.
+- constructor with parameters: `SEvent(uint32_t _iid,uint32_t _t,char _tp,uint32_t _p1,uint32_t _p2,const char* s=NULL)`
+fills the event with the parameters given.
+- `friend bool operator <(const SEvent& a,const SEvent& b)`
+compares events by their timestamps. Ties are broken by comparing precedence in file.
+
+### struct SEventCallBackData
+A stripped down version of SEvent that is used to pass event data in APIs.
+
+- `uint32_t time`
+- `uint32_t type`
+- `uint32_t p1`
+- `uint32_t p2`
+
+### class CMidiTrack
+Describes a single MIDI track. A MIDI track consists of multiple MIDI events.
+
+- `std::vector<SEvent> eventList`
+Vector of SEvent's.
+- `void appendEvent(SEvent e)`
+Append an event to the end of the event list.
+- `SEvent& operator[](size_t sub)`
+Get the reference to the contained event with the given index.
+
+### class CMidiFile
+Describes a MIDI file. A MIDI file consists of multiple MIDI tracks.
+
+- `bool valid`
+Is the MIDI file a valid one?
+- `char* title`
+Title of the MIDI file.
+- `char* copyright`
+Copyright information of the MIDI file.
+- `std::vector<CMidiTrack> tracks`
+Tracks in the MIDI file.
+- `uint32_t std`
+File standard of the MIDI file.
+ - 0: unknown
+ - 1: GM Level 1
+ - 2: GM Level 2
+ - 3: GS
+ - 4: XG
+- `uint32_t div`
+Ticks per quarter note. SMTPE format is not supported by QMidiPlayer.
+- `~CMidiFile()`
+Frees memory occupied by the title and copyright string.
+
+### class IMidiCallBack
+Generic callback function that can be used for hooking the core.
+
+- `IMidiCallBack()`
+Default empty constructor.
+- `virtual void callBack(void* callerdata,void* userdata)=0;`
+Abstract function of the callback. callerdata is filled by the caller and
+userdata is set to whatever you asked for when registering the callback.
+- `virtual ~IMidiCallBack()`
+Virtual empty destructor.
+
+### class IMidiFileReader
+MIDI file reader interface. Use this to implement your file importer.
+
+- `IMidiFileReader()`
+Default empty constructor.
+- `virtual ~IMidiFileReader()`
+Virtual empty destructor.
+- `virtual CMidiFile* readFile(const char* fn)=0`
+Abstract function to be implemented by the plugin.
+This function should read file from the given path (fn) and return a
+pointer to the resulting CMidiFile structure. You shoudn't handle the
+destruction of the resulting structure as the core will handle it.
+Read 5.1 for more details.
+After reading each event, you should call qmpPluginAPI::callEventReaderCB
+to invoke event reader callbacks and process their requests.
+- `virtual void discardCurrentEvent()=0`
+Only called by event reader callbacks.
+Expected behavior: Sets the discard flag for the last event you have read.
+If an event has its discard flag set, it shouldn't be pushed into its track.
+discardCurrentEvent may be called multiple times by different event reader
+callbacks. In such case, there's still only one event discarded.
+- `virtual void commitEventChange(SEventCallBackData d)=0`
+Only called by event reader callbacks.
+Expected behavior: modifies the last event you have read to the provided data.
+commitEventChange may be called multiple times by different event reader callbacks.
+In such case, only the last modification to the current event counts.
diff --git a/doc/optionsdialog.html b/doc/optionsdialog.html
index c512447..d90cf45 100644
--- a/doc/optionsdialog.html
+++ b/doc/optionsdialog.html
@@ -70,9 +70,10 @@
same folder to the playlist when started with a file.</li>
<li>Save dialog status*: Save dialog positions and restore on start up.</li>
<li>Save parameters in effects window</li>
- <li>Persistent fluidsynth instance*: If checked, the synthesizer engine will keep running
- through the whole session. Otherwise it is restarted every time when a new song is played.</li>
+ <li>Persistent fluidsynth instance: Deprecated. Removing before 0.9.</li>
<li>Icon Theme: Leave it unchanged unless you can't see the icons on those buttons.</li>
+ <li>Customize toolbar: customize the functionalities shown in the main window.</li>
+ <li>Customize actions: customize the functionalities shown in the file action menu.</li>
</ul>
<img src="../img/options5.png"><br>
Plugin manager. View details of plugins, enable or disable them here.<br>