aboutsummaryrefslogtreecommitdiff
path: root/core/qmpmidioutrtmidi.cpp
diff options
context:
space:
mode:
authorGravatar Chris Xiong <chirs241097@gmail.com> 2019-07-01 22:33:53 +0800
committerGravatar Chris Xiong <chirs241097@gmail.com> 2019-07-01 22:33:53 +0800
commitcd8432e47e1e9b332f2d5682ce4c796a94a29de8 (patch)
tree9091d98efe995bcd11439115200f02d3083c07be /core/qmpmidioutrtmidi.cpp
parenteb82292b5d8818a5ef1a0c92e35390bd4e22674e (diff)
downloadQMidiPlayer-cd8432e47e1e9b332f2d5682ce4c796a94a29de8.tar.xz
Actually send initialization sequence to external devices.
Replace hardcoded initial CC values with values from device property API.
Diffstat (limited to 'core/qmpmidioutrtmidi.cpp')
-rw-r--r--core/qmpmidioutrtmidi.cpp23
1 files changed, 21 insertions, 2 deletions
diff --git a/core/qmpmidioutrtmidi.cpp b/core/qmpmidioutrtmidi.cpp
index 2cc9d5b..1a18e46 100644
--- a/core/qmpmidioutrtmidi.cpp
+++ b/core/qmpmidioutrtmidi.cpp
@@ -229,8 +229,26 @@ void qmpMidiOutRtMidi::panic(uint8_t ch)
}
void qmpMidiOutRtMidi::reset(uint8_t ch)
{
- basicMessage(0xB0|ch,121,0);
- basicMessage(0xB0|ch,123,0);
+ if(ch==0xFF)
+ {
+ if(devinit)
+ {
+ for(auto&msg:devinit->initseq.eventList)
+ {
+ if((msg.type&0xF0)==0xF0)
+ extendedMessage(msg.str.length(),msg.str.data());
+ else
+ {
+ basicMessage(msg.type,msg.p1,msg.p2);
+ }
+ }
+ }
+ }
+ else
+ {
+ basicMessage(0xB0|ch,121,0);
+ basicMessage(0xB0|ch,123,0);
+ }
}
void qmpMidiOutRtMidi::onMapped(uint8_t,int)
{
@@ -286,6 +304,7 @@ bool qmpMidiOutRtMidi::getChannelPreset(int ch,uint16_t *bank,uint8_t *preset,st
uint8_t qmpMidiOutRtMidi::getInitialCCValue(uint8_t cc)
{
if(!devinit)return 0;//Nope!
+ return devinit->initv[cc];
}
void qmpMidiOutRtMidi::setInitializerFile(const char* path)
{