aboutsummaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
Diffstat (limited to 'core')
-rw-r--r--core/qmpmidimapperrtmidi.cpp1
-rw-r--r--core/qmpmidiplay.cpp4
-rw-r--r--core/qmpmidiplay.hpp2
-rw-r--r--core/qmpmidiread.cpp15
4 files changed, 19 insertions, 3 deletions
diff --git a/core/qmpmidimapperrtmidi.cpp b/core/qmpmidimapperrtmidi.cpp
index 845f24b..059ca77 100644
--- a/core/qmpmidimapperrtmidi.cpp
+++ b/core/qmpmidimapperrtmidi.cpp
@@ -88,6 +88,7 @@ void qmpMidiMapperRtMidi::sysEx(int iid,int length,const char *data)
void qmpMidiMapperRtMidi::panic(int iid,int ch)
{
//maybe all notes off is more close to panic?
+ pitchBend(iid,ch,8192);
ctrlChange(iid,ch,120,0);
//ctrlChange(iid,ch,123,0);
}
diff --git a/core/qmpmidiplay.cpp b/core/qmpmidiplay.cpp
index 43ae17e..ab312f7 100644
--- a/core/qmpmidiplay.cpp
+++ b/core/qmpmidiplay.cpp
@@ -291,12 +291,14 @@ void CMidiPlayer::playerPanic(bool reset)
{
if(reset)
{
- fluid_synth_pitch_bend(synth,i,8192);
+ fluid_synth_cc(synth,i,0,0);
fluid_synth_cc(synth,i,7,100);
fluid_synth_cc(synth,i,10,64);
fluid_synth_cc(synth,i,11,127);
+ fluid_synth_cc(synth,i,32,0);
}
fluid_synth_cc(synth,i,64,0);
+ fluid_synth_pitch_bend(synth,i,8192);
//all sounds off causes the minus polyphone bug...
fluid_synth_all_notes_off(synth,i);
if(deviceusage[i])for(int j=0;j<16;++j)
diff --git a/core/qmpmidiplay.hpp b/core/qmpmidiplay.hpp
index f2d7a4a..9bb6323 100644
--- a/core/qmpmidiplay.hpp
+++ b/core/qmpmidiplay.hpp
@@ -13,6 +13,7 @@ struct SEvent
uint8_t type;
char *str;
SEvent(){time=p1=p2=0;type=0;str=NULL;}
+ ~SEvent(){if(str){delete[] str;str=NULL;}}
SEvent(uint32_t _iid,uint32_t _t,char _tp,uint32_t _p1,uint32_t _p2,const char* s=NULL)
{
iid=_iid;time=_t;type=_tp;
@@ -46,6 +47,7 @@ class CMidiFile
void trackChunkReader();
void headerChunkReader();
int chunkReader(int hdrXp);
+ void dumpEvents();
public:
CMidiFile(const char* fn);
~CMidiFile();
diff --git a/core/qmpmidiread.cpp b/core/qmpmidiread.cpp
index 115b7b3..762ce5d 100644
--- a/core/qmpmidiread.cpp
+++ b/core/qmpmidiread.cpp
@@ -51,7 +51,7 @@ int CMidiFile::eventReader()//returns 0 if End of Track encountered
uint32_t delta=readVL();curt+=delta;
char type=fgetc(f);++byteread;uint32_t p1,p2;
static char lasttype;
-retry:
+ if(!(type&0x80)){fseek(f,-1,SEEK_CUR);--byteread;type=lasttype;}
switch(type&0xF0)
{
case 0x80://Note Off
@@ -164,11 +164,12 @@ retry:
if(!strcmp(str,GM2SysX))std=2;
if(!strcmp(str,GSSysEx))std=3;
if(!strcmp(str,XGSysEx))std=4;
+ delete[] str;
}
else error(0,"W: Unknown event type %#x",type);
break;
default:
- fseek(f,-1,SEEK_CUR);--byteread;type=lasttype;goto retry;
+ error(0,"W: Unknown event type %#x",type);
}
lasttype=type;++curid;
return 1;
@@ -211,6 +212,16 @@ int CMidiFile::chunkReader(int hdrXp)
}
else return trackChunkReader(),1;
}
+void CMidiFile::dumpEvents()
+{
+ for(uint32_t i=0;i<eventList.size();++i)
+ if(eventList[i]->str)
+ printf("type %x #%d @%d p1 %d p2 %d str %s\n",eventList[i]->type,
+ eventList[i]->iid,eventList[i]->time,eventList[i]->p1,eventList[i]->p2,eventList[i]->str);
+ else
+ printf("type %x #%d @%d p1 %d p2 %d\n",eventList[i]->type,
+ eventList[i]->iid,eventList[i]->time,eventList[i]->p1,eventList[i]->p2);
+}
CMidiFile::CMidiFile(const char* fn)
{
title=copyright=NULL;notes=0;std=0;valid=1;