diff options
author | Chris Xiong <chirs241097@gmail.com> | 2020-05-12 00:58:40 +0800 |
---|---|---|
committer | Chris Xiong <chirs241097@gmail.com> | 2020-05-12 00:58:40 +0800 |
commit | a7407edaf81c685d4a389785a405a53a5de4b148 (patch) | |
tree | e6e4f2d85f2172c94ac83a6e8f01e1e90a78ede9 /visualization/qmpvisualization.hpp | |
parent | 437b7b16c322a8e53ac55a5f831098494d9a7073 (diff) | |
download | QMidiPlayer-a7407edaf81c685d4a389785a405a53a5de4b148.tar.xz |
Format EVERYTHING.
Hopefully this will make the source code less horrendous and actually
readable.
The command used was:
```
astyle --suffix=none --style=allman --attach-extern-c --attach-closing-while --indent-switches --indent-after-parens --pad-oper --pad-header --unpad-paren --align-pointer=name --recursive './*.cpp,*.hpp'
```
Diffstat (limited to 'visualization/qmpvisualization.hpp')
-rw-r--r-- | visualization/qmpvisualization.hpp | 188 |
1 files changed, 102 insertions, 86 deletions
diff --git a/visualization/qmpvisualization.hpp b/visualization/qmpvisualization.hpp index 8a8d832..c0bc067 100644 --- a/visualization/qmpvisualization.hpp +++ b/visualization/qmpvisualization.hpp @@ -15,105 +15,121 @@ class qmpVisualization; struct MidiVisualEvent { - uint32_t tcs,tce; - uint32_t key,vel; - uint32_t ch; + uint32_t tcs, tce; + uint32_t key, vel; + uint32_t ch; }; -class qmpVisualization:public qmpPluginIntf,public qmpFuncBaseIntf +class qmpVisualization: public qmpPluginIntf, public qmpFuncBaseIntf { - friend class CloseHandler; - private: - qmpPluginAPI* api; - std::thread* rendererTh; - std::vector<MidiVisualEvent*>pool; - smHandler *h,*closeh; - std::stack<uint32_t> pendingt[16][128],pendingv[16][128]; - SMELT *sm; - SMTRG tdscn,tdparticles; - SMTEX chequer,bgtex,particletex,pianotex; - smTTFont font,font2,fonthdpi; - qmpVirtualPiano3D* p3d[16]; - smEntity3DBuffer* nebuf; - smParticleSystem* pss[16][128]; - smPSEmissionPositionGenerator* psepg; - float pos[3],rot[3],lastx,lasty; - uint32_t ctc,ctk,elb,lstk,cfr; - uint32_t cts,cks,ctp,cpbr[16],cpw[16]; - uint32_t rpnid[16],rpnval[16]; - std::chrono::steady_clock::time_point lst; - double etps; - bool shouldclose,playing,debug; - bool rendermode,hidewindow; - int herh,heh,hfrf; - int uihb,uihs,uihp,uihr,uihk; - void(*framecb)(void*,size_t,uint32_t,uint32_t); - DWORD* fbcont; - std::vector<std::pair<uint32_t,uint32_t>>tspool; - int traveld[16][128];bool notestatus[16][128],lastnotestatus[16][128]; - int spectra[16][128],spectrar[16][128]; - void drawCube(smvec3d a,smvec3d b,DWORD col,SMTEX tex,int faces=63); - void showThread(); - void pushNoteOn(uint32_t tc,uint32_t ch,uint32_t key,uint32_t vel); - void pushNoteOff(uint32_t tc,uint32_t ch,uint32_t key); - void updateVisualization3D(); - void updateVisualization2D(); + friend class CloseHandler; +private: + qmpPluginAPI *api; + std::thread *rendererTh; + std::vector<MidiVisualEvent *>pool; + smHandler *h, *closeh; + std::stack<uint32_t> pendingt[16][128], pendingv[16][128]; + SMELT *sm; + SMTRG tdscn, tdparticles; + SMTEX chequer, bgtex, particletex, pianotex; + smTTFont font, font2, fonthdpi; + qmpVirtualPiano3D *p3d[16]; + smEntity3DBuffer *nebuf; + smParticleSystem *pss[16][128]; + smPSEmissionPositionGenerator *psepg; + float pos[3], rot[3], lastx, lasty; + uint32_t ctc, ctk, elb, lstk, cfr; + uint32_t cts, cks, ctp, cpbr[16], cpw[16]; + uint32_t rpnid[16], rpnval[16]; + std::chrono::steady_clock::time_point lst; + double etps; + bool shouldclose, playing, debug; + bool rendermode, hidewindow; + int herh, heh, hfrf; + int uihb, uihs, uihp, uihr, uihk; + void(*framecb)(void *, size_t, uint32_t, uint32_t); + DWORD *fbcont; + std::vector<std::pair<uint32_t, uint32_t>>tspool; + int traveld[16][128]; + bool notestatus[16][128], lastnotestatus[16][128]; + int spectra[16][128], spectrar[16][128]; + void drawCube(smvec3d a, smvec3d b, DWORD col, SMTEX tex, int faces = 63); + void showThread(); + void pushNoteOn(uint32_t tc, uint32_t ch, uint32_t key, uint32_t vel); + void pushNoteOff(uint32_t tc, uint32_t ch, uint32_t key); + void updateVisualization3D(); + void updateVisualization2D(); - static qmpVisualization* inst; - public: - qmpVisualization(qmpPluginAPI* _api); - ~qmpVisualization(); - void show(); - void close(); - bool update(); - void start(); - void stop(); - void pause(); - void reset(); - void switchToRenderMode(void(*frameCallback)(void*,size_t,uint32_t,uint32_t),bool _hidewindow); + static qmpVisualization *inst; +public: + qmpVisualization(qmpPluginAPI *_api); + ~qmpVisualization(); + void show(); + void close(); + bool update(); + void start(); + void stop(); + void pause(); + void reset(); + void switchToRenderMode(void(*frameCallback)(void *, size_t, uint32_t, uint32_t), bool _hidewindow); - void init(); - void deinit(); - const char* pluginGetName(); - const char* pluginGetVersion(); + void init(); + void deinit(); + const char *pluginGetName(); + const char *pluginGetVersion(); - static qmpVisualization* instance(); + static qmpVisualization *instance(); }; -class CMidiVisualHandler:public smHandler +class CMidiVisualHandler: public smHandler { - private: - qmpVisualization *p; - public: - CMidiVisualHandler(qmpVisualization* par){p=par;} - bool handlerFunc(){return p->update();} +private: + qmpVisualization *p; +public: + CMidiVisualHandler(qmpVisualization *par) + { + p = par; + } + bool handlerFunc() + { + return p->update(); + } }; -class CloseHandler:public smHandler +class CloseHandler: public smHandler { - private: - qmpVisualization *p; - public: - CloseHandler(qmpVisualization* par){p=par;} - public: - bool handlerFunc() - { - std::thread ([this]{ - p->api->setFuncState("Visualization",false); - p->close();}).detach(); - return false; - } +private: + qmpVisualization *p; +public: + CloseHandler(qmpVisualization *par) + { + p = par; + } +public: + bool handlerFunc() + { + std::thread([this] + { + p->api->setFuncState("Visualization", false); + p->close(); + }).detach(); + return false; + } }; -extern "C"{ - EXPORTSYM qmpPluginIntf* qmpPluginGetInterface(qmpPluginAPI* api) - {return new qmpVisualization(api);} - EXPORTSYM const char* qmpPluginGetAPIRev() - {return QMP_PLUGIN_API_REV;} - EXPORTSYM void switchToRenderMode(void(*frameCallback)(void*,size_t,uint32_t,uint32_t),bool hidewindow) - { - if(qmpVisualization::instance()) - qmpVisualization::instance()->switchToRenderMode(frameCallback,hidewindow); - } +extern "C" { + EXPORTSYM qmpPluginIntf *qmpPluginGetInterface(qmpPluginAPI *api) + { + return new qmpVisualization(api); + } + EXPORTSYM const char *qmpPluginGetAPIRev() + { + return QMP_PLUGIN_API_REV; + } + EXPORTSYM void switchToRenderMode(void(*frameCallback)(void *, size_t, uint32_t, uint32_t), bool hidewindow) + { + if (qmpVisualization::instance()) + qmpVisualization::instance()->switchToRenderMode(frameCallback, hidewindow); + } } #endif // QMPVISUALIZATION_H |