tesselode / kira

Library for expressive game audio.
https://crates.io/crates/kira
Apache License 2.0
866 stars 45 forks source link

Expose duration related methods #103

Closed Roms1383 closed 2 months ago

Roms1383 commented 3 months ago

This PR does not address #102, but at least it exposes methods required to allow downstream users to calculate duration, including for Region, on their own.

Roms1383 commented 3 months ago

Commit b728f9c refactors the logic onto Region to turn it into samples. The method is not publicly exposed, to avoid confusion with slice representation, both being (usize, usize).

Roms1383 commented 3 months ago

Commit 140c1e6 is purely to avoid having to .slice(None) the StreamingSoundData<T> (which requires self rightfully) to get the underlying decoder.num_frames().

It's particularly useful to get the total duration of a streaming sound data without having to load it twice (because each method consumes it).

tesselode commented 3 months ago

I don't understand the purpose of most of these changes. What use case do these changes help with?