aboutsummaryrefslogtreecommitdiff
path: root/qmidiplayer-desktop
diff options
context:
space:
mode:
authorGravatar Chris Xiong <chirs241097@gmail.com> 2016-05-11 23:38:21 +0800
committerGravatar Chris Xiong <chirs241097@gmail.com> 2016-05-11 23:38:21 +0800
commit59304aa1b2c6d278e76f72509183fee96bbb8cae (patch)
treead50b86aaf71497588372de7089ff71b05b00a7b /qmidiplayer-desktop
parentd4c66cbcfb1411312b2c2f3c83e76a4882b8577a (diff)
downloadQMidiPlayer-59304aa1b2c6d278e76f72509183fee96bbb8cae.tar.xz
Fixed a crash caused by the visualization plugin.
Fixed a bug when piano is hidden but the option "arrange channels on a stair" is enabled. Add channel label display. However it's still buggy so it's currently disabled.
Diffstat (limited to 'qmidiplayer-desktop')
-rw-r--r--qmidiplayer-desktop/qmpchanneleditor.cpp4
-rw-r--r--qmidiplayer-desktop/qmpchannelswindow.cpp10
-rw-r--r--qmidiplayer-desktop/qmpplugin.cpp10
-rw-r--r--qmidiplayer-desktop/qmppresetselect.cpp6
4 files changed, 20 insertions, 10 deletions
diff --git a/qmidiplayer-desktop/qmpchanneleditor.cpp b/qmidiplayer-desktop/qmpchanneleditor.cpp
index 9b61e64..206a2fa 100644
--- a/qmidiplayer-desktop/qmpchanneleditor.cpp
+++ b/qmidiplayer-desktop/qmpchanneleditor.cpp
@@ -28,8 +28,8 @@ void qmpChannelEditor::setupWindow(int chid)
int b,p;
player->getChannelPreset(ch,&b,&p,str);
ui->lbPresetName->setText(str);
- sprintf(str,"BK: %d",b);ui->lbBank->setText(str);
- sprintf(str,"PC: %d",p);ui->lbPreset->setText(str);
+ sprintf(str,"BK: %03d",b);ui->lbBank->setText(str);
+ sprintf(str,"PC: %03d",p);ui->lbPreset->setText(str);
ui->lbChannelNumber->setText(QString::number(ch+1));
#define setupControl(ccid,lb,d,ccname)\
b=player->getCC(ch,ccid);\
diff --git a/qmidiplayer-desktop/qmpchannelswindow.cpp b/qmidiplayer-desktop/qmpchannelswindow.cpp
index 7def34d..e0a1522 100644
--- a/qmidiplayer-desktop/qmpchannelswindow.cpp
+++ b/qmidiplayer-desktop/qmpchannelswindow.cpp
@@ -66,10 +66,10 @@ qmpChannelsWindow::qmpChannelsWindow(QWidget *parent) :
connect(ui->twChannels->cellWidget(i,5),SIGNAL(onClick(int)),this,SLOT(showChannelEditorWindow(int)));
}
ui->twChannels->setColumnWidth(0,24);
- ui->twChannels->setColumnWidth(1,32);
- ui->twChannels->setColumnWidth(2,32);
+ ui->twChannels->setColumnWidth(1,24);
+ ui->twChannels->setColumnWidth(2,24);
ui->twChannels->setColumnWidth(3,192);
- ui->twChannels->setColumnWidth(4,192);
+ ui->twChannels->setColumnWidth(4,208);
ui->twChannels->setColumnWidth(5,32);
}
@@ -136,10 +136,10 @@ void qmpChannelsWindow::channelWindowsUpdate()
}
for(int i=0;i<16;++i)
{
- char data[128],nm[24];
+ char data[128],nm[25];
int b,p;
qmpMainWindow::getInstance()->getPlayer()->getChannelPreset(i,&b,&p,nm);
- sprintf(data,"%d:%d %s",b,p,nm);
+ sprintf(data,"%03d:%03d %s",b,p,nm);
if(fused)
{
if(strcmp(((QLabel*)ui->twChannels->cellWidget(i,4))->
diff --git a/qmidiplayer-desktop/qmpplugin.cpp b/qmidiplayer-desktop/qmpplugin.cpp
index b05ca0c..d67e08a 100644
--- a/qmidiplayer-desktop/qmpplugin.cpp
+++ b/qmidiplayer-desktop/qmpplugin.cpp
@@ -113,6 +113,16 @@ bool qmpPluginAPI::getChannelMask(int ch)
{return qmw&&qmw->getPlayer()?qmw->getPlayer()->getChannelMask(ch):false;}
std::string qmpPluginAPI::getTitle()
{return qmw?qmw->getTitle():"";}
+std::string qmpPluginAPI::getChannelPresetString(int ch)
+{
+ int b,p;char nm[25],ret[33];ret[0]=0;
+ if(qmw&&qmw->getPlayer())
+ {
+ qmw->getPlayer()->getChannelPreset(ch,&b,&p,nm);
+ sprintf(ret,"%03d:%03d %s",b,p,nm);
+ }
+ return std::string(ret);
+}
int qmpPluginAPI::registerEventHandlerIntf(IMidiCallBack *cb,void *userdata)
{return qmw->getPlayer()->setEventHandlerCB(cb,userdata);}
diff --git a/qmidiplayer-desktop/qmppresetselect.cpp b/qmidiplayer-desktop/qmppresetselect.cpp
index ef67d70..2edb522 100644
--- a/qmidiplayer-desktop/qmppresetselect.cpp
+++ b/qmidiplayer-desktop/qmppresetselect.cpp
@@ -49,7 +49,7 @@ void qmpPresetSelector::setupWindow(int chid)
plyr->getChannelPreset(chid,&b,&p,name);
for(int i=0;i<ui->lwBankSelect->count();++i)
{
- sscanf(ui->lwBankSelect->item(i)->text().toStdString().c_str(),"%d",&r);
+ sscanf(ui->lwBankSelect->item(i)->text().toStdString().c_str(),"%3d",&r);
if(r==b){ui->lwBankSelect->setCurrentRow(i);break;}
}
r=0;
@@ -57,7 +57,7 @@ void qmpPresetSelector::setupWindow(int chid)
for(int i=0,cr=0;i<128;++i)
if(strlen(presets[b][i]))
{
- sprintf(name,"%d %s",i,presets[b][i]);
+ sprintf(name,"%03d %s",i,presets[b][i]);
if(i==p)r=cr;
ui->lwPresetSelect->addItem(name);
cr++;
@@ -94,7 +94,7 @@ void qmpPresetSelector::on_lwBankSelect_currentRowChanged()
for(int i=0;i<128;++i)
if(strlen(presets[b][i]))
{
- sprintf(name,"%d %s",i,presets[b][i]);
+ sprintf(name,"%03d %s",i,presets[b][i]);
ui->lwPresetSelect->addItem(name);
}
}