-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Feature Request] - C extension for Ruby #28
Comments
On 03-18, Xavier Riley wrote:
I've got some scraps sitting around for mruby-osc, but I got stuck when
Assuming you want to use rtosc for just message serialization and
There's no var-args there (though the unions might be fun if you try
|
I just wanted to say - thanks so much for this detailed response. Up until now I had been thinking FFI was the only game in town for this kind of thing as I'd never written any C before, but your response inspired me to have a go at writing a C extension. After some fiddling around with the Ruby C API for strings, I've made a start on a gem here https://github.com/xavriley/fast_osc It takes a Ruby string, runs it through |
just as a heads up it looks like you have a typo in some of your test data
or (spaces and removed escapes for readability only)
should actually be
the comma is somewhat redundant, but the OSC spec requires it, so rtosc may parse arguments a little strangely if it is omitted. |
Just wanted to say thanks for the heads up - I was silly to type those test messages from memory in retrospect. With that error corrected it now returns the right number of args as expected. Given that this is a scaffold I can build on I'll keep chipping away at it. Thanks again for the help. |
Another update here. I did some more hacking on this over the weekend and I now have basic functionality in place.
The converse I went down the route of vendoring One small point - I couldn't see a way to extract the address/path from a message - does that method exist in the |
I'm glad to see that you're getting the performance boost that you were looking for. Per the licensing that seems to be perfectly fine. Including the rtosc.{c,h} files into another project similar to how you have done so is how the library is designed to be used. Extracting the path of an OSC message is pretty easy, so I didn't add any code for that task specifically.
Or in other words the path is the first null terminated string that makes up the message. |
Hi,
I realise this is a dumb thing to put in a Github issue but I couldn't see a way of contacting you specifically about this project, so I apologise in advance...
I'm working on a Ruby/music project called Sonic Pi which is pre-installed on the Raspberry Pi and is widely used in schools to teach music and coding to kids. Because we support the earlier B+ RPi (800MHz chip) we have to be sensitive about performance and one of the main bottlenecks for us is encoding/decoding OSC messages in Ruby to send from a Ruby server, both to/from SuperCollider and to/from the Qt GUI.
We use a lot of OSC messages and whilst we've optimised and benchmarked the pure Ruby version as much as possible (https://github.com/samaaron/sonic-pi/blob/master/app/server/sonicpi/lib/sonicpi/osc/oscencode.rb) it's still a bottleneck on the older RPis.
I had thought about trying to write an OSC library in mRuby and then use that via FFI which led me to your repos (
mruby-osc
). Given your experience with OSC and Ruby I thought it was worth a shot to see whether you thought that having a Ruby wrapper for this library (rtosc
) wasa) possible?
b) desirable?
Even if you don't think it's a good idea I'd be interested to find out why and so on. In the past I've struggled to see how I could handle varargs from Ruby -> C and I was wondering if this library might have a solution for that.
Thanks for your time and your code.
The text was updated successfully, but these errors were encountered: