Skip to content
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

Port c++ bindings to Nan #7

Closed
andresgottlieb opened this issue Jul 27, 2015 · 10 comments
Closed

Port c++ bindings to Nan #7

andresgottlieb opened this issue Jul 27, 2015 · 10 comments

Comments

@andresgottlieb
Copy link

Found out that node-midi did this already (also, check the two following commits [https://github.com/justinlatimer/node-midi/commit/e53396be77e699dc72fa320f6a21ddbb32ac8fbe] and [https://github.com/justinlatimer/node-midi/commit/6048bb747b995161a6f2479d0dff6aba8e2c06c9]) so, since node-osx-audio bindings are based on that project's, it should be somehow straightforward to do this.

The only thing bothering me (for now) is the node::Buffer stuff. It's not based on node-midi, so I have no reference to port it.

@fardog, do you have any ideas/comments to this?

@andresgottlieb
Copy link
Author

Been searching and [https://github.com/mdlavin/node-zookeeper/commit/92181f924073a9b8348502ba6448dd3dcb9a67d4](this project) may be useful, since they also had to port usage of node::Buffer to Nan

@fardog
Copy link
Owner

fardog commented Jul 27, 2015

ah cool, that's great! so when I originally wrote osx-audio, I had planned on basing it on nan for the bindings, however I ran into a few problems; i'm just pulling this from memory as it's been a long while since I looked into it—pardon any inacccuracies.

the issue had to do with not the use of buffers, but the way that nan at the time handled a repeated call to a function; essentially nan assumed that you'd make one call to a function, and get one chunk of data back in a loop, which is not the way that osx-audio needed to work; it repeatedly emits messages in the form of buffers, and nan expected to only perform one allocation; once it received a message it expected to free memory and be done. it looks like a lot of work around that area has been changed though, so it's completely possible this is no longer an issue.

much of what I did came from looking at both what file i/o did in nodejs itself, and the example code that Apple has around audio, and node-midi for the bindings; what node-midi does is really similar to what osx-audio needs to do, so I think that's a great reference to continue looking at! porting this over to nan is absolutely the right move, and it'll make sure that future versions are much easier to release.

but: I don't own any Mac OS X computers any more (the one that I had was from my previous job) so this project is essentially abandonware; i have no way to test any changes, or make any builds myself. if you're able to get somewhere on this, I'd be happy to make you a maintainer on it; I'd love to see this project keep going!

@fardog
Copy link
Owner

fardog commented Jul 27, 2015

@andresgottlieb I should mention: my c++ is weak at best, so although this is my memory of the issue I ran into, it's totally possible that this was never a limitation of nan, and I just wasn't able to find any example code that led me in the right direction.

@andresgottlieb
Copy link
Author

@fardog Thank you for the explanation! My C++ is weaker for sure, but I remember the basics from school. I'll give it a try and let you know if I get somewhere. Thanks again!

@andresgottlieb
Copy link
Author

@fardog Hi, I'm just writing to let you know I finally took the shortest path and just included an extra node binary for soundcast to work, so I'm not going to be updating this. Thank you very much for your help!

Someone "e-interviewed" me about soundcast and wrote this tutorial where you're mentioned.

Also, Variety wrote this, and has brought a lot of traffic to the soundcast repo.

Thanks again!

@fardog
Copy link
Owner

fardog commented Sep 12, 2015

Great work, and thanks for the mention as well! No worries on not getting it updated, and thanks for taking a look; glad you were able to get something worked out with your app!

I'll leave this open and mark as "Help Wanted" just in case anyone stopping by wants to take a look.

@danjenkins
Copy link

I might try and tackle this sometime soon - which should enable us to use it with a node version greater than 0.10

@fardog
Copy link
Owner

fardog commented Jan 11, 2016

@danjenkins that would be incredibly awesome

@alexkuz
Copy link
Collaborator

alexkuz commented May 9, 2016

@fardog @andresgottlieb hi everyone, I think I made it :)
#10

@fardog
Copy link
Owner

fardog commented May 9, 2016

@alexkuz woooaaaaaah! this is the best! I don't have a mac to test it on at the moment, but I'm going to try and get a hold of one briefly, so i can get this tested and merged in the next few days. thanks so much for tackling this!

@fardog fardog closed this as completed in 81a5a93 May 14, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants