alure icon indicating copy to clipboard operation
alure copied to clipboard

Golang port/interface?

Open ethindp opened this issue 5 years ago • 6 comments

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?

ethindp avatar Apr 07 '19 03:04 ethindp

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)

Cazadorro avatar Apr 08 '19 17:04 Cazadorro

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++.

kcat avatar Apr 10 '19 00:04 kcat

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 [email protected] 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

ethindp avatar Apr 10 '19 04:04 ethindp

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

LAGonauta avatar Jul 01 '19 11:07 LAGonauta

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:).

McSinyx avatar Apr 01 '20 08:04 McSinyx

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.

SeanTolstoyevski avatar Oct 22 '20 15:10 SeanTolstoyevski