kshoji / javax.sound.midi-for-Android

Package javax.sound.midi porting for Android
Apache License 2.0
75 stars 34 forks source link

new MetaMessage() throws NegativeArraySizeException #5

Closed pion3er closed 8 years ago

pion3er commented 8 years ago

A call to MetaMessage() results in a NegativeArraySizeException. The reason is that the defaultMessage Array in MetaMessage has got only a length of 2. So it always throws a java.lang.NegativeArraySizeException (Invalid meta event. data: [-1, 0] );

A solution is to change the default message initialisation to private static final byte[] defaultMessage = { (byte) META, (byte)0, (byte)1, (byte)0 }; as it is done in the reference implementation of javax.sound.midi.MetaMessage( http://developer.classpath.org/doc/javax/sound/midi/MetaMessage-source.html )

kshoji commented 8 years ago

This seems the same problem as #3. The fix has merged to the develop branch. Please try with it. https://github.com/kshoji/javax.sound.midi-for-Android/tree/develop