aboutsummaryrefslogtreecommitdiff
path: root/qmidiplayer-desktop/qmppresetselect.cpp
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 /qmidiplayer-desktop/qmppresetselect.cpp
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 'qmidiplayer-desktop/qmppresetselect.cpp')
-rw-r--r--qmidiplayer-desktop/qmppresetselect.cpp17
1 files changed, 6 insertions, 11 deletions
diff --git a/qmidiplayer-desktop/qmppresetselect.cpp b/qmidiplayer-desktop/qmppresetselect.cpp
index c5132b3..57dbe7f 100644
--- a/qmidiplayer-desktop/qmppresetselect.cpp
+++ b/qmidiplayer-desktop/qmppresetselect.cpp
@@ -21,16 +21,11 @@ void qmpPresetSelector::showEvent(QShowEvent *e)
{
memset(presets,0,sizeof(presets));
CMidiPlayer *plyr=qmpMainWindow::getInstance()->getPlayer();
- if(!plyr->getSFCount())return e->ignore();
- int sfc=plyr->getSFCount();
- for(int i=sfc-1;i>=0;--i)
- {
- fluid_sfont_t* psf=plyr->getSFPtr(i);
- fluid_preset_t preset;
- psf->iteration_start(psf);
- while(psf->iteration_next(psf,&preset))
- strcpy(presets[preset.get_banknum(&preset)][preset.get_num(&preset)],preset.get_name(&preset));
- }
+ 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)
@@ -44,7 +39,7 @@ void qmpPresetSelector::showEvent(QShowEvent *e)
void qmpPresetSelector::setupWindow(int chid)
{
CMidiPlayer *plyr=qmpMainWindow::getInstance()->getPlayer();
- if(!plyr->getSFCount())return;
+ if(!plyr->fluid()->getSFCount())return;
ch=chid;int b=0,p=0,r;char name[64];
sprintf(name,"Preset Selection - Channel #%d",ch+1);
setWindowTitle(name);