kcat / alure

Alure is a utility library for OpenAL, providing a C++ API and managing common tasks that include file loading, caching, and streaming
zlib License
70 stars 20 forks source link

Golang port/interface? #30

Open ethindp opened 5 years ago

ethindp commented 5 years ago

Would it be possible to make a golang port or interface for Alure? It would be incredibly nice since golang has once again interested me and I can't, for the life of me, find any good, high-quality audio libraries that provide 3D, HRTF, and so on, and I don't want to manually interface with a library like FMOD or BASS. (That would just be painful.) Though golang makes interfaing with libraries relatively painless, or as painless as you can make callouts to other libraries not writen in Go, it still would be painful. So are their any plans in the works for such a port or interface?

Cazadorro commented 5 years ago

I don't necessarily want to speak for kcat, but the short answer is probably no. There's currently one major maintainer on this project, kcat, they also happen to manage most of the work being done on OpenAL soft, of which Alure is essentially a wrapper for. Feel free to implement your own wrapper however. Kcat is pretty responsive to pull requests, so if you created an interface for go with this, I'm sure they'd be willing to hold a link to it in the readme. I believe pretty much everything you'll need to wrap over for basic functionality is just in https://github.com/kcat/alure/blob/master/include/AL/alure2.h, but if I understand the code correctly it is not using C linkage, so you'll either need to create C interface, just use openal soft api, or use some other tool like SWIG (ex found here https://stackoverflow.com/questions/1713214/how-to-use-c-in-go)

kcat commented 5 years ago

Unless there's a way for Golang to work with C++, it's unlikely that an interface wrapper is easily possible. While you could probably make C (and thus Golang or whatever else) wrappers for the calls themselves, Alure uses the STL (or something STL-compatible) for things like vector, string, unique_ptr, shared_ptr, and shared_future. It might be possible, but I don't imagine it'll be easy for someone not familiar with both Golang and C++.

ethindp commented 5 years ago

Mmm... Go has a native string type, and for vectors you could probably either switch them out with arrays or with slices. Not sure about shared futures and shared pointers, though it would be something to look into. (Go does allow you to pass pointers around; its relatively painless. Whether its safe, though...)

On 4/9/19, kcat notifications@github.com wrote:

Unless there's a way for Golang to work with C++, it's unlikely that an interface wrapper is easily possible. While you could probably make C (and thus Golang or whatever else) wrappers for the calls themselves, Alure uses the STL (or something STL-compatible) for things like vector, string, unique_ptr, shared_ptr, and shared_future. It might be possible, but I don't imagine it'll be easy for someone not familiar with both Golang and C++.

-- You are receiving this because you authored the thread. Reply to this email directly or view it on GitHub: https://github.com/kcat/alure/issues/30#issuecomment-481483883

-- Signed, Ethin D. Probst

LAGonauta commented 5 years ago

Not sure if it is going to help, however I am in the process in making a C interface for use with C#: https://github.com/LAGonauta/Alure-C-Interface

As Go can pass pointers around it can probably be used without any problem. It is still rough, however, and probably lots of things could be better. One can already use it with C#, though: (no futures support yet, not sure if they will ever be possible) https://github.com/LAGonauta/Alure-CSharp-Wrapper

McSinyx commented 4 years ago

Not entirely related, but our Python interface has just got its first official release! I don't know where I should announce such information but thank you @kcat for your help during the implementation process of the wrapper. Palace is not yet stable, but functionality-wise it covers almost all what alure can do (but slower :smile:).

SeanTolstoyevski commented 3 years ago

Currently the best OpenAL wrapper for Golang is g3n. https://github.com/g3n/engine/tree/master/audio/al

We can improve this. I don't think there's anything we can do for Alure2.