bevy/crates/bevy_audio/src
Lena Milizé 599ca782e3 Add a way to toggle AudioSink (#6321)
# Objective

Currently toggling an `AudioSink` (for example from a game menu) requires writing

```rs
if sink.is_paused() {
    sink.play();
} else {
    sink.pause();
}
```

It would be nicer if we could reduce this down to a single line

```rs
sink.toggle();
```

## Solution

Add an `AudioSink::toggle` method which does exactly that.

---

## Changelog

- Added `AudioSink::toggle` which can be used to toggle state of a sink.
2022-10-31 15:57:51 +00:00
..
audio_output.rs Add a way to toggle AudioSink (#6321) 2022-10-31 15:57:51 +00:00
audio_source.rs Remove Sync requirement in Decodable::Decoder (#5819) 2022-08-29 23:02:12 +00:00
audio.rs Make Resource trait opt-in, requiring #[derive(Resource)] V2 (#5577) 2022-08-08 21:36:35 +00:00
lib.rs Expose rodio's Source and Sample traits in bevy_audio (#6374) 2022-10-27 12:34:38 +00:00