commit 2860524c3db9f6c8cc978903c5fe68825d50245d
parent 776086af41fe7229fdfa1f41845fdf95c2d2bd0a
Author: paulnasca <paulnasca>
Date: Wed, 26 May 2004 20:05:33 +0000
*** empty log message ***
Diffstat:
4 files changed, 20 insertions(+), 3 deletions(-)
diff --git a/src/Seq/MIDIEvents.h b/src/Seq/MIDIEvents.h
@@ -37,7 +37,7 @@ class MIDIEvents{
struct event{
int deltatime;
int channel;//on what midi channel is
- int type,par1,par2;//type=1 for note, type=2 for controller
+ int type,par1,par2;//type=1 for note, type=2 for controller, type=255 for time messages
} tmpevent;
struct listpos{
event ev;
diff --git a/src/Seq/MIDIFile.C b/src/Seq/MIDIFile.C
@@ -133,7 +133,7 @@ int MIDIFile::parsetrack(int ntrack){
/// printf("MSGDELTATIME = %d\n",msgdeltatime);
- dt+=msgdeltatime;
+// dt+=msgdeltatime;
int msg=peekbyte();
/// printf("raw msg=0x%x ",msg);
@@ -144,6 +144,9 @@ int MIDIFile::parsetrack(int ntrack){
getbyte();
};
/// printf("msg=0x%x\n",msg);
+
+// dt+=msgdeltatime;
+ add_dt(ntrack, msgdeltatime);
unsigned int mtype,mlength;
@@ -193,6 +196,8 @@ int MIDIFile::parsetrack(int ntrack){
return(-1);
break;
};
+
+
if (midieof) return(-1);
@@ -292,6 +297,16 @@ void MIDIFile::parsemetaevent(unsigned char mtype,unsigned char mlength){
};
+void MIDIFile::add_dt(char ntrack, unsigned int dt){
+ me->tmpevent.deltatime=convertdt(dt);
+ me->tmpevent.type=255;
+ me->tmpevent.par1=0;
+ me->tmpevent.par2=0;
+ me->tmpevent.channel=0;
+ me->writeevent(&me->miditrack[ntrack].record,&me->tmpevent);
+};
+
+
unsigned int MIDIFile::convertdt(unsigned int dt){
double result=dt;
printf("DT=%d\n",dt);
diff --git a/src/Seq/MIDIFile.h b/src/Seq/MIDIFile.h
@@ -52,6 +52,8 @@ class MIDIFile{
void parsecontrolchange(char ntrack,char chan,unsigned int dt);
void parsepitchwheel(char ntrack,char chan, unsigned int dt);
void parsemetaevent(unsigned char mtype,unsigned char mlength);
+
+ void add_dt(char ntrack, unsigned int dt);
void clearmidifile();
diff --git a/src/Seq/Sequencer.C b/src/Seq/Sequencer.C
@@ -110,7 +110,7 @@ int Sequencer::getevent(char ntrack,int *midich, int *type,int *par1, int *par2)
// printf("********************************\n");
-/// if (ntrack==1) printf("_ %f %.2f\n",nextevent[ntrack].time,playtime[ntrack].abs);
+ if (ntrack==1) printf("_ %f %.2f (%d)\n",nextevent[ntrack].time,playtime[ntrack].abs,nextevent[ntrack].ev.par2);
*type=nextevent[ntrack].ev.type;
*par1=nextevent[ntrack].ev.par1;