diff options
author | Chris Xiong <chirs241097@gmail.com> | 2019-04-22 00:16:50 +0800 |
---|---|---|
committer | Chris Xiong <chirs241097@gmail.com> | 2019-04-22 00:16:50 +0800 |
commit | eba45fdf11a98113b439db0510b55f14845db8fb (patch) | |
tree | 1d73816893ccb36fa3a5f1f5c63a629bac7f0787 /simple-visualization/qmpkeyboardwindow.cpp | |
parent | d2b00a80c237c1c3d8bc9551966cf781292525e6 (diff) | |
download | QMidiPlayer-eba45fdf11a98113b439db0510b55f14845db8fb.tar.xz |
New development cycle!
Partially reintroduce High DPI handling.
Pressing enter when a preset is focused now opens the preset selection
dialog.
Close all functionality windows before shutting down.
Temporary fix for switching all channels of an external synth to mono
mode unintentionally.
And the most important one of them all: simple visualization!
I'm ditching the 0.8.6 cycle because there was no clear goal for that
release now (as the OPL3 emulation is now delayed indefinitely).
In contrast, the 0.8.7 release has a pretty good-looking feature set
mainly focused on improving support for external synthesizers:
- Per-device initialization profile.
- Instrument mapping files.
- And a simple visualization ~~for showing off your external synthesizers~~.
As always no ETA is set, nor will I promise the implementaion of all
the features listed above.
Diffstat (limited to 'simple-visualization/qmpkeyboardwindow.cpp')
-rw-r--r-- | simple-visualization/qmpkeyboardwindow.cpp | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/simple-visualization/qmpkeyboardwindow.cpp b/simple-visualization/qmpkeyboardwindow.cpp new file mode 100644 index 0000000..a42a2e0 --- /dev/null +++ b/simple-visualization/qmpkeyboardwindow.cpp @@ -0,0 +1,36 @@ +#include <QVBoxLayout> +#include <QCloseEvent> +#include "qmpkeyboardwindow.hpp" + +qmpKeyboardWindow::qmpKeyboardWindow(qmpPluginAPI *_api,QWidget *parent): + QWidget(parent,Qt::Dialog),api(_api) +{ + setLayout(new QVBoxLayout()); + for(int ch=0;ch<16;++ch) + layout()->addWidget(pw[ch]=new qmpPianoWidget(this)); + hide(); + api->registerEventHandlerIntf(ec=new EventCallback(),this); + connect(ec,&EventCallback::keystateupdated,this,&qmpKeyboardWindow::onkeystatesupdate); +} +qmpKeyboardWindow::~qmpKeyboardWindow() +{ +} +void qmpKeyboardWindow::closeEvent(QCloseEvent *event) +{ + api->setFuncState("Keyboard",false); + event->accept(); +} +void qmpKeyboardWindow::onkeystatesupdate(int ch,int key,bool state) +{pw[ch]->setKeyState(key,state);} +void qmpKeyboardWindow::resetAll() +{for(int ch=0;ch<16;++ch)pw[ch]->reset();} + +void EventCallback::callBack(void* callerdata,void* userdata) +{ + qmpKeyboardWindow *w=(qmpKeyboardWindow*)userdata; + SEventCallBackData *cbd=(SEventCallBackData*)callerdata; + if((cbd->type&0xF0)==0x80) + emit keystateupdated(cbd->type&0xF,cbd->p1,false); + if((cbd->type&0xF0)==0x90) + emit keystateupdated(cbd->type&0xF,cbd->p1,cbd->p2>0); +} |