diff options
Diffstat (limited to 'qmidiplayer-desktop')
-rw-r--r-- | qmidiplayer-desktop/qmpchanneleditor.cpp | 6 | ||||
-rw-r--r-- | qmidiplayer-desktop/qmpchannelswindow.cpp | 9 | ||||
-rw-r--r-- | qmidiplayer-desktop/qmpplugin.cpp | 13 | ||||
-rw-r--r-- | qmidiplayer-desktop/qmppresetselect.cpp | 52 |
4 files changed, 39 insertions, 41 deletions
diff --git a/qmidiplayer-desktop/qmpchanneleditor.cpp b/qmidiplayer-desktop/qmpchanneleditor.cpp index 206a2fa..71dd455 100644 --- a/qmidiplayer-desktop/qmpchanneleditor.cpp +++ b/qmidiplayer-desktop/qmpchanneleditor.cpp @@ -25,9 +25,9 @@ void qmpChannelEditor::setupWindow(int chid) char str[256];if(~chid)ch=chid; setWindowTitle(tr("Channel Parameter Editor - Channel #%1").arg(ch+1)); CMidiPlayer* player=qmpMainWindow::getInstance()->getPlayer(); - int b,p; - player->getChannelPreset(ch,&b,&p,str); - ui->lbPresetName->setText(str); + uint16_t b;uint8_t p;std::string pstn; + player->getChannelOutputDevice(ch)->getChannelPreset(ch,&b,&p,pstn); + ui->lbPresetName->setText(pstn.c_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)); diff --git a/qmidiplayer-desktop/qmpchannelswindow.cpp b/qmidiplayer-desktop/qmpchannelswindow.cpp index 8968bed..5a6a2de 100644 --- a/qmidiplayer-desktop/qmpchannelswindow.cpp +++ b/qmidiplayer-desktop/qmpchannelswindow.cpp @@ -153,10 +153,11 @@ void qmpChannelsWindow::channelWindowsUpdate() } for(int i=0;i<16;++i) { - char data[128],nm[256]; - int b,p; - qmpMainWindow::getInstance()->getPlayer()->getChannelPreset(i,&b,&p,nm); - sprintf(data,"%03d:%03d %s",b,p,nm); + char data[128]; + std::string nm; + uint16_t b;uint8_t p; + qmpMainWindow::getInstance()->getPlayer()->getChannelOutputDevice(i)->getChannelPreset(i,&b,&p,nm); + sprintf(data,"%03d:%03d %s",b,p,nm.c_str()); if(fused) { if(strcmp((ui->twChannels->item(i,4))-> diff --git a/qmidiplayer-desktop/qmpplugin.cpp b/qmidiplayer-desktop/qmpplugin.cpp index 8655dff..2339625 100644 --- a/qmidiplayer-desktop/qmpplugin.cpp +++ b/qmidiplayer-desktop/qmpplugin.cpp @@ -153,11 +153,11 @@ int qmpPluginAPI::getChannelCC(int ch,int cc) {return qmw&&qmw->getPlayer()?qmw->getPlayer()->getCC(ch,cc):0;} int qmpPluginAPI::getChannelPreset(int ch) { - int b,p;char nm[256]; + uint16_t b;uint8_t p;std::string nm; if(qmw&&qmw->getPlayer()) { - qmw->getPlayer()->getChannelPreset(ch,&b,&p,nm); - return p; + if(qmw->getPlayer()->getChannelOutputDevice(ch)->getChannelPreset(ch,&b,&p,nm))return p; + return qmw->getPlayer()->getCC(ch,128); } return 0; } @@ -173,11 +173,12 @@ std::wstring qmpPluginAPI::getWTitle() {return qmw?qmw->getWTitle():L"";} std::string qmpPluginAPI::getChannelPresetString(int ch) { - int b,p;char nm[256],ret[320];ret[0]=0; + uint16_t b;uint8_t p;char ret[320];ret[0]=0; + std::string nm; if(qmw&&qmw->getPlayer()) { - qmw->getPlayer()->getChannelPreset(ch,&b,&p,nm); - snprintf(ret,320,"%03d:%03d %s",b,p,nm); + qmw->getPlayer()->getChannelOutputDevice(ch)->getChannelPreset(ch,&b,&p,nm); + snprintf(ret,320,"%03d:%03d %s",b,p,nm.c_str()); } return std::string(ret); } diff --git a/qmidiplayer-desktop/qmppresetselect.cpp b/qmidiplayer-desktop/qmppresetselect.cpp index 8afea2b..a32aa99 100644 --- a/qmidiplayer-desktop/qmppresetselect.cpp +++ b/qmidiplayer-desktop/qmppresetselect.cpp @@ -20,29 +20,25 @@ void qmpPresetSelector::showEvent(QShowEvent *e) memset(presets,0,sizeof(presets)); CMidiPlayer *plyr=qmpMainWindow::getInstance()->getPlayer(); if(!plyr->fluid()->getSFCount())return e->ignore(); - std::vector<std::pair<std::pair<int,int>,std::string>> - presetlist=plyr->fluid()->listPresets(); - for(auto &i:presetlist) - strcpy(presets[i.first.first][i.first.second],i.second.c_str()); ui->lwBankSelect->clear(); ui->lwPresetSelect->clear(); - for(int i=0;i<=128;++i) - { - int b=0; - for(int j=0;j<128;++j)if(strlen(presets[i][j])){b=1;break;} - if(b)ui->lwBankSelect->addItem(QString::number(i)); - } e->accept(); } void qmpPresetSelector::setupWindow(int chid) { CMidiPlayer *plyr=qmpMainWindow::getInstance()->getPlayer(); if(!plyr->fluid()->getSFCount())return; - ch=chid;int b=0,p=0,r;char name[256]; + ch=chid;int r;char name[256]; + uint16_t b;uint8_t p; + std::string pstname; sprintf(name,"Preset Selection - Channel #%d",ch+1); setWindowTitle(name); - plyr->getChannelPreset(chid,&b,&p,name); - if(plyr->getChannelOutput(chid)){ + r=plyr->getChannelOutputDevice(ch)->getChannelPreset(ch,&b,&p,pstname); + ui->lwBankSelect->blockSignals(true); + ui->lwBankSelect->clear(); + ui->lwPresetSelect->clear(); + ui->lwBankSelect->blockSignals(false); + if(plyr->getChannelOutputDevice(ch)->getBankList().empty()){ ui->lwPresetSelect->setEnabled(false); ui->lwBankSelect->setEnabled(false); ui->spCustomLSB->setEnabled(true); @@ -58,21 +54,20 @@ void qmpPresetSelector::setupWindow(int chid) ui->spCustomLSB->setEnabled(false); ui->spCustomMSB->setEnabled(false); ui->spCustomPC->setEnabled(false); - for(int i=0;i<ui->lwBankSelect->count();++i){ - sscanf(ui->lwBankSelect->item(i)->text().toStdString().c_str(),"%3d",&r); - if(r==b){ui->lwBankSelect->setCurrentRow(i);break;} + ui->lwBankSelect->blockSignals(true); + for(auto&i:plyr->getChannelOutputDevice(ch)->getBankList()) + { + snprintf(name,256,"%03d %s",i.first,i.second.c_str()); + ui->lwBankSelect->addItem(name); + if(i.first==b)ui->lwBankSelect->setCurrentRow(ui->lwBankSelect->count()-1); } - r=0; - ui->lwPresetSelect->clear(); - for(int i=0,cr=0;i<128;++i) - if(strlen(presets[b][i])) + ui->lwBankSelect->blockSignals(false); + for(auto&i:plyr->getChannelOutputDevice(ch)->getPresets(b)) { - sprintf(name,"%03d %s",i,presets[b][i]); - if(i==p)r=cr; + snprintf(name,256,"%03d %s",i.first,i.second.c_str()); ui->lwPresetSelect->addItem(name); - cr++; + if(i.first==p)ui->lwPresetSelect->setCurrentRow(ui->lwPresetSelect->count()-1); } - ui->lwPresetSelect->setCurrentRow(r); } } @@ -109,14 +104,15 @@ void qmpPresetSelector::on_lwPresetSelect_itemDoubleClicked() void qmpPresetSelector::on_lwBankSelect_currentRowChanged() { + fprintf(stderr,"bs cr changed\n"); ui->lwPresetSelect->clear(); if(!ui->lwBankSelect->currentItem())return; - char name[30];int b; + char name[256];int b; sscanf(ui->lwBankSelect->currentItem()->text().toStdString().c_str(),"%d",&b); - for(int i=0;i<128;++i) - if(strlen(presets[b][i])) + CMidiPlayer *plyr=qmpMainWindow::getInstance()->getPlayer(); + for(auto&i:plyr->getChannelOutputDevice(ch)->getPresets(b)) { - sprintf(name,"%03d %s",i,presets[b][i]); + snprintf(name,256,"%03d %s",i.first,i.second.c_str()); ui->lwPresetSelect->addItem(name); } } |