First, thanks so much for creating JNAJack and making it available! It works very well and provides almost everything I need.
For my purposes, the only thing missing was JACK Transport support, so I forked the repo and added the necessary code. The work is pretty much done and seems pretty solid, although it still needs a little more testing. If you're interested in rolling it into the official repo, I'll submit a pull request when I'm done.
Hi Matthew,On Mon, Aug 7, 2017 at 11:20 AM Matthew MacLeod <mgmac...@gmail.com> wrote:First, thanks so much for creating JNAJack and making it available! It works very well and provides almost everything I need.Thanks for the kind words - glad it's working well for you. Out of interest, what are you using it for?
For my purposes, the only thing missing was JACK Transport support, so I forked the repo and added the necessary code. The work is pretty much done and seems pretty solid, although it still needs a little more testing. If you're interested in rolling it into the official repo, I'll submit a pull request when I'm done.Definitely! Please do. JNAJack hasn't seen much work until recently, when I pushed a release to Maven Central [*]. It would be great to get a pull request to get this into the next release there - I've been meaning to look at transport for a long time and not got around to it.
I'm working on a performance front-end for SuperCollider focusing on control via MIDI devices and I want to have the ability to sync with other JACK apps (hence transport). My motivation is partly to see if I can get *exactly* the features I want (demanding bastard that I am) and partly as a personal coding challenge to stretch my (and if I can contribute back to other free software projects in the process, so much the better).
Excellent. Will do. I just realized that I missed a few things, so I'll fix that up today (hopefully). I'm also a little confused about the handling of the native jack_nframes_t type; sometimes it's just mapped to a Java int, and other times it's converted to a Java long. My understanding is that it should always be converted to a long, although the int mapping seems to work. Thoughts?
Sounds interesting! Not really played around with SuperCollider (I'm more of a Java audio coder) but I look forward to hopefully seeing this.
Welcome to the joy of JNA coding! ;-) You need to consider the difference between size (32-bit vs 64-bit) and range. On the JACK side it's an unsigned 32-bit int, therefore in low-level JNA mappings it should always be mapped as a 32-bit Java int - the bit size is important. Of course, because Java's int is signed, in certain cases larger values (above Integer.MAX_VALUE) will go out of range and become negative. In those cases the public-facing API should convert the signed 32bit value to an unsigned one, which can only be stored in a 64-bit Java long - this is what the NativeToJavaTypeConverter code does. It only makes sense to do that where the values might actually go out of range. Buffer sizes, sample rates, etc. should never be anywhere near Integer.MAX_VALUE! If you see a case where a value that could conceivably wrap isn't converted, file an issue.