aboutsummaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
Diffstat (limited to 'core')
-rw-r--r--core/qmpmidimapperrtmidi.cpp5
-rw-r--r--core/qmpmidimappers.hpp1
-rw-r--r--core/qmpmidiplay.cpp10
-rw-r--r--core/qmpmidiplay.hpp1
4 files changed, 16 insertions, 1 deletions
diff --git a/core/qmpmidimapperrtmidi.cpp b/core/qmpmidimapperrtmidi.cpp
index f28bb9d..845f24b 100644
--- a/core/qmpmidimapperrtmidi.cpp
+++ b/core/qmpmidimapperrtmidi.cpp
@@ -91,3 +91,8 @@ void qmpMidiMapperRtMidi::panic(int iid,int ch)
ctrlChange(iid,ch,120,0);
//ctrlChange(iid,ch,123,0);
}
+void qmpMidiMapperRtMidi::reset(int iid,int ch)
+{
+ ctrlChange(iid,ch,120,0);
+ ctrlChange(iid,ch,121,0);
+}
diff --git a/core/qmpmidimappers.hpp b/core/qmpmidimappers.hpp
index 334a2d2..ae4fa3f 100644
--- a/core/qmpmidimappers.hpp
+++ b/core/qmpmidimappers.hpp
@@ -18,6 +18,7 @@ public:
void pitchBend(int iid,int ch,int val);
void sysEx(int iid,int length,const char* data);
void panic(int iid,int ch);
+ void reset(int iid,int ch);
int enumDevices();
std::string deviceName(int id);
};
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;}
diff --git a/core/qmpmidiplay.hpp b/core/qmpmidiplay.hpp
index 15fcd89..b0fb387 100644
--- a/core/qmpmidiplay.hpp
+++ b/core/qmpmidiplay.hpp
@@ -86,6 +86,7 @@ class CMidiPlayer
void setBit(uint16_t &n,uint16_t bn,uint16_t b);
void processEvent(const SEvent *e);
void processEventStub(const SEvent *e);
+ void prePlayInit();
void playEvents();
void fileTimer1Pass();
void fileTimer2Pass();