Expose AudioSink::empty() (#8145)

# Objective

Exposes `empty()` method for `AudioSink`.
Based on `0.10.0`, should be a non-breaking change.

---

## Changelog

- Expose `empty()` method for `AudioSink`
- Add `AudioSink::empty()` example

---------

Co-authored-by: hank <hank@hank.co.in>
Co-authored-by: Carter Anderson <mcanders1@gmail.com>
This commit is contained in:
Hank Jordan 2023-04-05 17:54:14 -04:00 committed by GitHub
parent 6e67d3e534
commit 28046d5142
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -60,6 +60,9 @@ pub trait AudioSinkPlayback {
///
/// It won't be possible to restart it afterwards.
fn stop(&self);
/// Returns true if this sink has no more sounds to play.
fn empty(&self) -> bool;
}
/// Asset controlling the playback of a sound
@ -130,6 +133,10 @@ impl AudioSinkPlayback for AudioSink {
fn stop(&self) {
self.sink.as_ref().unwrap().stop();
}
fn empty(&self) -> bool {
self.sink.as_ref().unwrap().empty()
}
}
/// Asset controlling the playback of a sound, or the locations of its listener and emitter.
@ -197,6 +204,10 @@ impl AudioSinkPlayback for SpatialAudioSink {
fn stop(&self) {
self.sink.as_ref().unwrap().stop();
}
fn empty(&self) -> bool {
self.sink.as_ref().unwrap().empty()
}
}
impl SpatialAudioSink {