mackron / miniaudio

Audio playback and capture library written in C, in a single source file.
https://miniaud.io
Other
4.07k stars 361 forks source link

ma_node_attach_output_bus() to accept ma_node_base* instead of ma_node* #554

Closed mincequi closed 2 years ago

mincequi commented 2 years ago

Hey there, i am using miniaudio pretty heavily in my project and i came up with a question regarding your API design. _ma_node_attach_outputbus() accepts _manode* (which is an alias for void). This can easily be misused since you cannot prohibit an implicit conversion to void. Unfortunately, this caused a lot of headache for me while finding a bug (on my side).

So, my suggestion: if ma_node_attach_output_bus() would accept a _ma_nodebase* instead, misusage could be avoided. And i see, that within _ma_node_attach_outputbus() _manode* is casted to _ma_nodebase* anyways.

Had there been any specific reason, why ma_node is an alias for void?

Thanks.

BR Manuel

mackron commented 2 years ago

It's typed as void to avoid the need for a cast when passing in different types of nodes. I have no intention on changing this sorry.

Moving to discussion section.