Steven Schmidt wrote:
> > * 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.
>
> This is what I want. How can I get this behavior in a model class?
>
>
>
You get it all for free. Bytes are already signed, so if your numbers
are in the range -128..127, things will just work. You can read and
write patch.sysex[index], and you'll get what you expect. If instead
your values are 128..255, then things will half work -- you can write to
patch.sysex[index] just fine, but when you read it back, it will be in
the range -128..127.
Note that this goofiness is on top of the fact that your synth has
probably scrambled the bytes a little to get around the restrictions of
the sysex message. So you need to deal with that, on top of dealing
with signed bytes.
The easiest way to learn is to just do it, see where it breaks, then get
help with that. Don't be afraid, it's only code!
-Bill
|