tesselode / kira

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

Bevy asset loader for StaticSoundData #28

Closed NiklasEi closed 2 years ago

NiklasEi commented 2 years ago

I am trying to update bevy_kira_audio to Kira 0.6

One part of this is to migrate the asset loaders. The only viable option I currently see to load StaticSoundData is via from_cursor. The problem is, that I cannot satisfy the static lifetime bound for the byte slice.

One option would be to expose from_media_source. Then I can clone the bytes and pass Box::new(Cursor::new(owned_bytes)) as media source. This is the solution I am currently working with from my fork. Do you see any better approach?

tesselode commented 2 years ago

Is there a reason you can't just pass Cursor::new(owned_bytes) into from_cursor? Why do you have to make a box?

NiklasEi commented 2 years ago

You are absolutely right. I apparently had not understood AsRef.