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

Missing function AttachAudioStreamProcessor and DetachAudioStreamProcessor. #425

Open
Hultan opened this issue Oct 17, 2024 · 10 comments
Open

Comments

@Hultan
Copy link
Contributor

Hultan commented Oct 17, 2024

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
Copy link
Contributor

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

@JupiterRider
Copy link
Contributor

JupiterRider commented Oct 18, 2024

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

@JupiterRider
Copy link
Contributor

JupiterRider commented Oct 18, 2024

@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: c2c8150

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

@gen2brain
Copy link
Owner

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

@JupiterRider
Copy link
Contributor

@gen2brain Do you think SetAudioStreamCallback even works? (added by you in #279)
I ask because you can only set one global callback and not one callback per AudioStream.

@gen2brain
Copy link
Owner

@JupiterRider I don't think I ever tested it.

@Rockenstien
Copy link

How can I use AttachAudioStreamProcessor ?

@JupiterRider
Copy link
Contributor

@Rockenstien for now manually (by writing your functions in C) or you use the purego version.

@gen2brain do you have any Ideas, how to solve this issue?

@gen2brain
Copy link
Owner

@JupiterRider Sorry, I have no idea and currently have no time to work on that.

@gen2brain
Copy link
Owner

@JupiterRider It is probably something like one C-exported Go function that would always be called; that function can call all Go-added functions to some map.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants