static long seq_myflush() { struct timeval st, et; static long ret; static long t1, t2; gettimeofday(&st, NULL); seqbuf_dump(); gettimeofday(&et, NULL); t1 = et.tv_usec - st.tv_usec; t2 = et.tv_sec - st.tv_sec; while (t1 < 0) { t2--; t1 += 1000000; } ret = t2 * 1000000 + t1 + extratime; extratime = 0; return ret; }
int do_track_event(unsigned char *data, int *pos) { char channel; unsigned char buf[5]; buf[0]=data[*pos]; *pos +=1; channel = buf[0] & 0xf; #ifdef WANT_MPU401 if (card_info.synth_type==SYNTH_TYPE_MIDI) { switch((buf[0]&0xf0)) { case 0x80: case 0x90: case 0xa0: case 0xb0: case 0xe0: buf[1]=data[*pos]; *pos+=1; buf[2]=data[*pos]; *pos+=1; MIDI_MESSAGE3(buf[0],buf[1],buf[2]); break; case 0xc0: case 0xd0: buf[1]=data[*pos]; *pos+=1; MIDI_MESSAGE3(buf[0],0,buf[1]); break; case 0xf0: return 1; default: return 3; } seqbuf_dump(); return 0; } #endif switch((buf[0] & 0xf0)) { case 0x80: buf[1]=data[*pos]; *pos +=1; buf[2]=data[*pos]; *pos +=1; stop_note((int) channel, (int) buf[1], (int) buf[2]); break; case 0x90: buf[1]=data[*pos]; *pos +=1; buf[2]=data[*pos]; *pos +=1; if(buf[2] == 0) { stop_note((int) channel, (int) buf[1], (int) buf[2]); } else { start_note((int) channel, (int) buf[1], (int) buf[2]); } break; case 0xa0: buf[1]=data[*pos]; *pos +=1; buf[2]=data[*pos]; *pos +=1; set_key_pressure((int) channel, (int) buf[1], (int) buf[2]); break; case 0xb0: buf[1]=data[*pos]; *pos +=1; buf[2]=data[*pos]; *pos +=1; set_control((int) channel, (int) buf[1], (int) buf[2]); break; case 0xe0: buf[1]=data[*pos]; *pos +=1; buf[2]=data[*pos]; *pos +=1; set_pitchbend((int) channel, (int) ((buf[2] << 7) + buf[1]); break; case 0xc0: buf[1]=data[*pos]; *pos +=1; set_program((int) channel, (int) buf[1] ); break; case 0xd0: buf[1]=data[*pos]; *pos +=1; set_chn_pressure((int) channel, (int) buf[1]); break; case 0xf0: return 1; default: return 3; } seqbuf_dump(); return 0; }