You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
way to get i16 input even when it is not supported? #662
There is code to convert from f32 to i16, but I don't see how to write code that needs to work with i16 in a portable way, that uses straight i16 input where available, and otherwise performs a conversion. Perhaps this already exists?
I would argue that this is beyond cpal's scope, as it is not something that needs to be abstracted across different backends, but rather something you would build on top of cpal
I'm not sure which "code to convert from f32 to i16" you mean?
I used to agree with @LastExceed from the perspective of "cpal abstracts over system APIs". From the perspective of "cpal" as cross-platform abstraction however, this was discussed not so long ago over at Discord:
I guess we could add a build_output_stream_converting::<T, D, E>() that takes a T of the caller's choosing, and have cpal use default_*_config() internally to determine the device's default sample format and convert to that.
dasp_sample makes it easy so it wouldn't be hard to add or maintain, just a question of responsibility.
Activity
LastExceed commentedon Aug 16, 2026
I would argue that this is beyond cpal's scope, as it is not something that needs to be abstracted across different backends, but rather something you would build on top of cpal
roderickvd commentedon Aug 16, 2026
I'm not sure which "code to convert from
f32toi16" you mean?I used to agree with @LastExceed from the perspective of "cpal abstracts over system APIs". From the perspective of "cpal" as cross-platform abstraction however, this was discussed not so long ago over at Discord:
dasp_samplemakes it easy so it wouldn't be hard to add or maintain, just a question of responsibility.LastExceed commentedon Aug 16, 2026
Probably the
FromSample/ToSampletrait impls