|
|
|
|
|
by nyanpasu64
2077 days ago
|
|
> These scenarios are so hypothetical that it’s pointless to give an answer. Every audio library I've seen so far operates on (*i16/f32, size_t) or &[i16/f32]. An audio library which supports dimensioned values is hypothetical. And most dimensioning libraries don't have a unit of "sample" (in time) or "audio amplitude" or "channel", so the audio library won't even know what unit system to pick. > It’s also extremely possible to fork such a library, change a few lines to use the dimensionally correct type, and be done with the issue. And suddenly the audio library is tied to your specific unit system, and you still need transmutes or whatnot when talking to the OS sound library. > If all of your heavy lifting is being done by this external library anyways, and that library just uses raw floats... why bother with the ceremony of using a dimensionally safe float in your own code if the performance cost of mapping between types is too high? Most of the time I end up just using a named type alias, instead of a strong newtype. |
|