tesselode / kira

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

Have a single sound file and play chunks from them #39

Closed cBournhonesque closed 1 year ago

cBournhonesque commented 1 year ago

Hi,

I've read through the book but it's not clear to me how I would have a single file for all my sounds, and just play specific portions of them.

Would I create a single StaticSoundData to load the whole sound, and then somehow ask the manager to play subportions of it? It looks like manager cannot play a sub-section of a sound?

Or would i create separate individual StaticSoundData from my file, each using StaticSoundSettings to define the beginning end of the chunk? It looks like StaticSoundSettings supports start_position but not end_position.

tesselode commented 1 year ago

@cBournhonesque I didn't know that was a use case anyone had. What's the benefit of having all sounds in one file?

Vickerinox commented 1 year ago

while maybe not the same usecase of having all my sounds in one file, i am also looking for functionality to be able to split a song into "chunks" and be able to play them back out of the order. while i could of course implement my own system that can split up the audio file into relevant chunks and make it appear as seperate sounds it would be easier and probably more resource efficient to simply tell the manager to play from start position to end position instead of having to store every chunk + other data i might need to construct/transition/combine or any other way handle my split up audio file.

tesselode commented 1 year ago

Kira v0.8.0 can play arbitrary chunks of audio using the playback_region setting.