public void fillInfoPanelWith ( Sequence currentSequence , String songName ) { getMidiDuration ( ) . setText ( Helpers . getTimeStringFromMilliseconds ( currentSequence . getMicrosecondLength ( ) / 1000L ) ) ; getMidiName ( ) . setText ( songName ) ; Track [ ] tracks = currentSequence . getTracks ( ) ; StringBuilder fullText = new StringBuilder ( ) ; for ( int t = 0 ; t < tracks . length ; t ++ ) { int size = tracks [ t ] . size ( ) ; for ( int ticks = 0 ; ticks < size ; ticks ++ ) { MidiEvent event = tracks [ t ] . get ( ticks ) ; MidiMessage message = event . getMessage ( ) ; if ( message instanceof MetaMessage ) { int type = ( ( MetaMessage ) message ) . getType ( ) ; if ( type <= 0x04 ) { fullText . append ( new String ( ( ( MetaMessage ) message ) . getData ( ) ) ) . append ( ' ' ) ; } } } } getMidiInfo ( ) . setText ( fullText . toString ( ) ) ; getMidiInfo ( ) . select ( 0 , 0 ) ; }
private static final int INSTRUMENTNAME = 0x04 ;