aboutsummaryrefslogtreecommitdiff
path: root/core/qmpmidiplay.cpp
diff options
context:
space:
mode:
authorGravatar Chris Xiong <chirs241097@gmail.com> 2016-04-14 23:28:30 +0800
committerGravatar Chris Xiong <chirs241097@gmail.com> 2016-04-14 23:28:30 +0800
commiteee7a6e13ec8cfcb70e3777d83a3a11b3cd30ac6 (patch)
tree7b0820543a3d1d97090434f173bd7d9df0bd4b13 /core/qmpmidiplay.cpp
parent2888a8349d11a3e959c300256ce36e824337e636 (diff)
downloadQMidiPlayer-eee7a6e13ec8cfcb70e3777d83a3a11b3cd30ac6.tar.xz
History of the Moon.
Diffstat (limited to 'core/qmpmidiplay.cpp')
-rw-r--r--core/qmpmidiplay.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/core/qmpmidiplay.cpp b/core/qmpmidiplay.cpp
index 6af7722..780b8f7 100644
--- a/core/qmpmidiplay.cpp
+++ b/core/qmpmidiplay.cpp
@@ -181,6 +181,12 @@ void w32usleep(uint64_t t)
timeEndPeriod(1);
}
#endif
+void CMidiPlayer::prePlayInit()
+{
+ playerPanic(true);
+ for(int i=0;i<16;++i)if(deviceusage[i])
+ for(int j=0;j<16;++j)mapper->reset(i,j);
+}
void CMidiPlayer::playEvents()
{
for(uint32_t ct=midiFile->getEvent(0)->time;tceptr<midiFile->getEventCount();)
@@ -287,6 +293,7 @@ void CMidiPlayer::playerPanic(bool reset)
fluid_synth_cc(synth,i,7,100);
fluid_synth_cc(synth,i,10,64);
fluid_synth_cc(synth,i,11,127);
+ if(deviceusage[i])for(int j=0;j<16;++j)mapper->reset(i,j);
}
//all sounds off causes the minus polyphone bug...
for(int i=0;i<16;++i)fluid_synth_all_notes_off(synth,i);
@@ -320,6 +327,7 @@ void CMidiPlayer::playerDeinit()
}
void CMidiPlayer::playerThread()
{
+ prePlayInit();
playEvents();
}
@@ -376,7 +384,7 @@ uint32_t CMidiPlayer::getFileNoteCount(){return midiFile?midiFile->getNoteCount(
uint32_t CMidiPlayer::getFileStandard(){return midiFile?midiFile->getStandard():0;}
const char* CMidiPlayer::getTitle(){return midiFile?midiFile->getTitle():"";}
const char* CMidiPlayer::getCopyright(){return midiFile?midiFile->getCopyright():"";}
-double CMidiPlayer::getTempo(){return 60./(ctempo/1e6)/**ctsd/4.*/;}
+double CMidiPlayer::getTempo(){return 60./(ctempo/1e6);}
uint32_t CMidiPlayer::getTCpaused(){return tcpaused;}
void CMidiPlayer::setTCpaused(uint32_t ps){tcpaused=ps;}
uint32_t CMidiPlayer::isFinished(){return finished;}