-
Notifications
You must be signed in to change notification settings - Fork 49
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add total duration #109
Add total duration #109
Conversation
Any objection to this small addition @tesselode? |
I have the same objections we discussed here. |
The issue is that my plugin simply cannot operate without it, forcing me to sit on a fork (not too bad, but still). The main issue coming from my plugin being agnostic over both static and streaming sounds and, since The difference with traditional usage where a game developer makes its own audio engine and has control over everything is that my audio plugin is used by multiple mod creators independently of each other, and I have no control over what they will do at runtime. Consider this concrete use case:
You can see that, as soon as it validates it cannot play it anymore (since validation took ownership). In this case, num_frames cannot give me the original (unsliced) duration either, forcing me to rely on slice which, in StreamingSoundData, consumes It's especially mandatory in my case because if gamers start having bugs, or modders do not get the expected auditive outcome, usually the blame is gonna fall back on the native plugin while it could actually just come from a setting incorrectly specified. |
Now I understand that my use case is niche and might not necessarily fits common usage.
|
Thanks for elaborating on your use case. I can see how you're in a bind with the current API. I have a couple takeaways from this: 1. Maybe the slicing mental model isn't that great My goal with this mental model was to make it clear that loop regions and seek positions are relative to the start of the slice, but now I'm wondering if it would just be better to make a 2. It would be nice if This should be doable, but it would require a breaking change. As you can probably tell by Kira's history, though, I'm not averse to breaking changes. |
Please do not make complicated changes for my niche use case, especially not breaking changes. Your mental model is great, and streaming sound do not need to be Clone. I was just looking for simple additional methods, but they can sit on my fork it's fine too. |
I thought about it a little more after posting that reply, and the How do you feel about the name |
Ok I changed Regarding Likewise I don't understand the change mentioned for |
|
any other change(s) missing ? |
nope, this looks good! |
thank you! |
Hi, this is a simple QoL PR to add
total_duration
method to bothStaticSoundData
andStreamingSoundData<Error>
.Motivation
To retrieve a
StreamingSoundData
's total duration whose slice has already been set currently requires to reset its slice toNone
, which requires ownership and is further complicated by the fact thatStreamingSoundData
does not implementClone
.With this change, the total duration can be retrieved from both data, simply requiring shared reference.