Fixed Player::skip_one not updating player's length immediately.#842
Fixed Player::skip_one not updating player's length immediately.#842yara-blue merged 1 commit intoRustAudio:masterfrom
Conversation
|
Something very bad seems to be happening with the Player, adding a simple
|
|
I've hopefully fixed that. Also saw a queue issue where it wouldn't play the first audio appended in my own app with the version from the PR, but that is working correctly after my latest commit. |
|
Hii, Thanks for working on this! Sorry I could only get to this review now (was sick for a bit but all is well now). I'm a little hesitant, I'm not sure An idea: pub struct Done<I, F: FnMut()> {
input: I,
callback: F,
signal_sent: bool,
}
pub fn new(input: I, callback: F) -> Done<I, F> {
Done {
input,
callback,
signal_sent: false,
}
}Then users could get the current behavior by calling: let mut signal_sent = false;
Done::new(source, ||
if !signal_sent {
signal.fetch_sub(1, Ordering::Relaxed);
signal_sent = true;
}
)To stress: this is just an idea I'm not sure if this is a better solution but I'd love to have your thoughts. So what do you think:
|
Achieve by adding `Skippable::skipped`, and updating `Done` to call a callback instead of decreasing an `Arc<AtomicUsize>`.
|
I removed |
|
skipped seems pretty useful yeah! :) |
|
thanks for the great PR (great to have an upgrade guide entry too!) |
Fixes #497.
Needed to add
Done::should_decrementto achieve this fix.Instead of updating
sound_countin the periodic access source, I made it update directly in theskip_onefunction (clearaffected too).When
controls.to_clear > 0in periodic access, it will useDone::should_decrementto temporarily disable decrementingsound_count.