From 8cec568a5b586316448b9140f1ba2ab960356593 Mon Sep 17 00:00:00 2001 From: Gwilym Inzani Date: Wed, 28 Aug 2024 15:48:43 +0100 Subject: [PATCH 1/2] Add a method to stop the tracker --- tracker/agb-tracker/src/lib.rs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/tracker/agb-tracker/src/lib.rs b/tracker/agb-tracker/src/lib.rs index b55a5a6f..9edd20fa 100644 --- a/tracker/agb-tracker/src/lib.rs +++ b/tracker/agb-tracker/src/lib.rs @@ -286,6 +286,21 @@ impl<'track, TChannelId> TrackerInner<'track, TChannelId> { self.realise(mixer); } + /// Stops all channels. + /// + /// It is expected that you don't call step after this. But doing so will continue from + /// where you left off. However, notes which were playing won't resume. + pub fn stop>(&mut self, mixer: &mut M) { + for channel_id in &mut self.mixer_channels { + if let Some(channel) = channel_id + .take() + .and_then(|channel_id| mixer.channel(&channel_id)) + { + channel.stop(); + } + } + } + fn realise>(&mut self, mixer: &mut M) { for (i, (mixer_channel, tracker_channel)) in self .mixer_channels From 040d3d560430db452d2f0a59226ba174c139a0d0 Mon Sep 17 00:00:00 2001 From: Gwilym Inzani Date: Wed, 28 Aug 2024 15:49:38 +0100 Subject: [PATCH 2/2] Changelog entry about stopping the tracker --- CHANGELOG.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index d032a2f9..7a6699e0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added - Added support for vibrato in `agb-tracker`'s XM format +- Method to stop the tracker ### Changed @@ -17,9 +18,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 unless you've been using `default-features = false` in which case we recommend removing that from your `Cargo.toml`. ### Fixed + - There are no longer gaps between tiles in affine graphics modes. ### Added + - Added option to export imported background graphics from `include_background_gfx` as pub. ## [0.20.5] - 2024/06/18