MeadowlarkDAW / creek

Realtime disk streaming IO for audio
Other
112 stars 12 forks source link

Remove unsafe #47

Closed BillyDM closed 9 months ago

BillyDM commented 9 months ago

I've been meaning to do this for a while, but I'm finally getting around to it.

I removed all uses of unsafe Rust, and there is no meaningful impact on performance. While the unsafe stuff was probably sound, I would much prefer to not have any unsafe if we can.

The main reason I used unsafe before was to avoid needing to zero out buffers before sending them to the decoder to fill. But I figured out I can get around this by just clearing the Vecs and using extend_from_slice() inside the decoder instead.

Although of course removing the unsafe is a breaking change, but I don't think there's anyone that was creating their own custom decoders and encoders anyway (if I'm wrong, please correct me). I think it's okay to just bump the version of creek to 1.2.0.


I also bumped the dependency versions since that was simple to do.


I also updated the demos to use the latest version of egui. I would have done this in a separate PR, but I wasn't able to get the old demos to run, and I wanted to use them to test if my changes still worked as expected.

BillyDM commented 9 months ago

Cool. I'll go ahead a merge this then.