int data1, data2;
int length;
byte data[] = null;
ShortMessage shortMessage = null;
MetaMessage metaMessage = null;
SysexMessage sysexMessage = null;
// get the tick
// $$jb: this gets easier if we change all system-wide time to delta ticks
eventTick = event.getTick();
deltaTick = event.getTick() - currentTick;
currentTick = event.getTick();
// get the status byte
status = event.getMessage().getStatus();
eventtype = getType( status );
switch( eventtype ) {
case ONE_BYTE:
shortMessage = (ShortMessage) event.getMessage();
data1 = shortMessage.getData1();
bytesWritten += writeVarInt( deltaTick );
if(status!=runningStatus) {
runningStatus=status;
tddos.writeByte(status); bytesWritten += 1;
}
tddos.writeByte(data1); bytesWritten += 1;
break;
case TWO_BYTE:
shortMessage = (ShortMessage) event.getMessage();
data1 = shortMessage.getData1();
data2 = shortMessage.getData2();
bytesWritten += writeVarInt( deltaTick );
if(status!=runningStatus) {
runningStatus=status;
tddos.writeByte(status); bytesWritten += 1;
}
tddos.writeByte(data1); bytesWritten += 1;
tddos.writeByte(data2); bytesWritten += 1;
break;
case SYSEX:
sysexMessage = (SysexMessage) event.getMessage();
length = sysexMessage.getLength();
data = sysexMessage.getMessage();
bytesWritten += writeVarInt( deltaTick );
// $$jb: 04.08.99: always write status for sysex
runningStatus=status;
tddos.writeByte( data[0] ); bytesWritten += 1;