RFC/Suggestion to add a more native Zig API#18
RFC/Suggestion to add a more native Zig API#18GrayHatter wants to merge 21 commits intoallyourcodebase:mainfrom
Conversation
The previous buffer was panicking on a bad alignment, but only sometimes.
|
(Whoops, sorry for letting this sit--I had notifications off by mistake.) I think this is a great idea. I'm not a fan of the C API, and regardless, it's nice to have integration with Zig's error handling and such. The right way to do this IMO is to keep this repo unopinionated--have it continue to just expose the C API as is--but then have a separate repo imports this one, and wraps it with the Zig bindings. (This is also the approach suggested by AYC). If you're still interested in this project and are down to split it into a separate repo, I can add a link from the README to point people to it! |
|
(btw thanks for the updates for latest Zig!) |
|
That sounds good to me. I'll create a 2nd repo, and remove all the commits from this PR into that leaving just the changes needed to get 0.16 working on this one. Do you have any preference as to what to do about the changes to |
|
It looks like @Cornspies already pulled out the 0.16 related commits from your branch in #20–wanna move this convo there? |
|
Sounds good! I believe their implementation was based off of yours even if it doesn't have the actual commits in history. Feel free to ping me if/when you get the bindings set up and want me to link to them! |
This PR is no where near complete; But wanted to open this PR to offer a suggestion and/or get feedback. I would rebase and create a stack of clean commits if there's any interest.
Context; I'm in the process of making a FFT waterfall toy thing, but I'm not a fan of the raw C api, so after upgrading it to work with zig master I started working on a more zig friendly API. It's currently far from complete, but I'd be happy to expand it to as much of the pipewire API as I'm able.
an example of it in use contrast
before: https://srctree.gr.ht/repo/vizz/ref/2888db992d339b5455358a7ea8c26b4b9bda2253/blob/src/pipewire.zig#L54
after https://srctree.gr.ht/repo/vizz/ref/5e34965905d485d4cc1ea73de7d4acfb3454e78c/blob/src/pipewire.zig#L33 The zig native API requires fewer lines, and includes error handling.
I'd apprecate any comments, suggestions, or insults. Or please close this if a zig API is out of scope.
Cheers