aboutsummaryrefslogtreecommitdiff
path: root/qmidiplayer-lite/qmpcorewrapper.hpp
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-lite/qmpcorewrapper.hpp
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-lite/qmpcorewrapper.hpp')
-rw-r--r--qmidiplayer-lite/qmpcorewrapper.hpp16
1 files changed, 9 insertions, 7 deletions
diff --git a/qmidiplayer-lite/qmpcorewrapper.hpp b/qmidiplayer-lite/qmpcorewrapper.hpp
index ed024df..090edc7 100644
--- a/qmidiplayer-lite/qmpcorewrapper.hpp
+++ b/qmidiplayer-lite/qmpcorewrapper.hpp
@@ -15,19 +15,20 @@ private:
public:
explicit CQMPCoreWrapper(QObject* parent=0):QObject(parent)
{
- mp=new CMidiPlayer(false);
+ mp=new CMidiPlayer();
}
~CQMPCoreWrapper(){delete mp;}
- Q_INVOKABLE void initFluidSynth()
+ Q_INVOKABLE void initFluidSynth(QUrl sfpath)
{
- fluid_settings_t *fsettings=mp->getFluidSettings();
- fluid_settings_setstr(fsettings,"audio.driver","pulseaudio");
- mp->fluidInitialize();
- mp->pushSoundFont("/media/Files/FluidR3_Ext.sf2");
+ mp->fluid()->setOptStr("audio.driver","pulseaudio");
+ mp->fluid()->deviceInit();
+ mp->fluid()->loadSFont(sfpath.toLocalFile().toStdString().c_str());
+ for(int i=0;i<16;++i)
+ mp->setChannelOutput(i,0);
}
Q_INVOKABLE void deinitFluidSynth()
{
- mp->fluidDeinitialize();
+ mp->fluid()->deviceDeinit();
}
Q_INVOKABLE void loadFile(QUrl file)
{
@@ -41,6 +42,7 @@ public:
Q_INVOKABLE void stop()
{
mp->playerDeinit();playerTh->join();delete playerTh;
+ mp->playerPanic();
}
Q_INVOKABLE int getProgress()
{