gen2brain / raylib-go

Go bindings for raylib, a simple and easy-to-use library to enjoy videogames programming.
zlib License
1.6k stars 164 forks source link

Missing function AttachAudioStreamProcessor and DetachAudioStreamProcessor. #425

Open Hultan opened 6 days ago

Hultan commented 6 days ago

I can't complete the examples/audio/stream_effects, the last example that is missing in the audio section at raylib.com, because the functions AttachAudioStreamProcessor and DetachAudioStreamProcessor are missing. If anyone could add them, I could (probably) finish off the examples/audio section.

JupiterRider commented 5 days ago

Right. They are missing in the CGO Version. They have to be added in raylib/raudio.go

JupiterRider commented 5 days ago

We also should review DetachAudioStreamProcessor and DetachAudioMixedProcessor in the purego version, which can't work, because it always detaches a new callback.

JupiterRider commented 5 days ago

@gen2brain @agrigoryan What do you think about using purego.NewCallback in the cgo version as well? With that, the code would be much cleaner, because we don't need wrapper functions anymore.

Otherwise the code will be much more muddled: https://github.com/gen2brain/raylib-go/commit/c2c8150de9c2eb880a9f04c9c0021b110279a76a

But purego would break Support for OpenBSD and 32-bit Platforms. So maybe it is not a good idea.

gen2brain commented 4 days ago

@JupiterRider If possible that would be nice. I remember I had an issue though, there is a limit of callbacks one can have if you fire NewCallback every time, I had to do something like this https://github.com/gen2brain/webp/blob/main/webp_dynamic.go#L220 and https://github.com/gen2brain/webp/blob/main/webp_dynamic.go#L278.

Though, I don't like breaking support for 32-bit platforms. Luckily there are not many callbacks in raylib.