-
Notifications
You must be signed in to change notification settings - Fork 424
Exposed rodio API for skipping first part of a sample #1001
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
Conversation
I think this is a useful feature. Honestly, audio has been a bit of a thorn in my side for a while. I haven't actively used it in any projects yet, so I'm probably not the best judge, but it always seemed a bit too limited to me and now that you've published this PR I realize that the thing that annoyed me most was probably not being able to jump forward in sound. |
I'm wondering whether we should add a comment somewhere on how Since you added the call to
From that documentation it should be clear, that |
That seems reasonable! While I was there, I actually remembered another little undocumented gotcha: Pros of fade-in before skip:
Pros of skip before fade-in:
If we move skip before fade-in, I think there's also a good argument for moving it before What do you think? Should I adjust the order of operations while I'm documenting it? |
Ah, nice catch! Didn't think of that yet.
Yes, I think the second option is more intuitive and useful. Go ahead and move it in front of fade in and speed (though I think I read that the number of samples to skip is calculated by rodio taking the current speed into consideration anyway). The documentation of |
If we wanted to go wild we could also just make two functions and call the first option |
I do think that having two functions would probably be overkill right now, but now that you mention it, |
Hmm, |
set_start now operates after repeat_infinite but before other audio effects. The docs have been updated to elaborate on these interactions.
I changed the external name to |
Hi! I just happened to need this little bit of rodio API, and it seemed like the easiest way to get it was to patch ggez. I don't know if you'd consider it too cluttered to expose this in ggez's API, but since it's so tiny, I figured I might as well just submit the pull request and let you decide.
You can read about the rodio method being called here: https://docs.rs/rodio/0.14.0/rodio/source/trait.Source.html#method.skip_duration . Basically, it just skips the first part of a sound source. This can be useful, for example,
All the same, it's a bit niche, and these use cases might be better covered by just using rodio directly. Since calling
skip_duration
wraps the entire sound sample iterator in aSkipDuration
iterator, this might add a small overhead to any audio being played, but it's probably not a big deal, and it's consistent with how the ggez interface exposes other rodio features.