From: Bill Z. <wrz...@po...> - 2005-03-11 03:04:40
|
Joe Emenaker wrote: > I made a "DataModel" interface. The idea behind it is that it handles > all of the nuisance of stripping off leading bytes (ie, F0, manufID, > devID, etc) and trailing F0 and it handles any conversion to/from > 8-bit bytes or whatnot. > > Then, I made a new ParamModel which, when it needs data, asks the > DataModel for it. So, the ParamModel and addWidget never need to see > the actual Patch. So did I, good job. :) Two things to watch out for: * In Java, bytes are signed. So if the range is 0..255 before, casting it to a (Byte) will change that to -128..127. Thus, reading patch.sysex[index] may yield negative numbers. I had to compensate in my CZModel.getByte. * Java ints are only 4 bytes, so you can't grab any more than that at once. Ints are also signed, so if you grab 4 bytes, you'll get negative numbers again. Longs are 8 bytes. -Bill |