mirror of
https://github.com/arabianq/pipewire-soundpad.git
synced 2026-04-28 06:21:23 +00:00
feat: sort tracks by their id in AudioPlayer on get_tracks
This commit is contained in:
@@ -315,7 +315,8 @@ impl AudioPlayer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn get_tracks(&self) -> Vec<TrackInfo> {
|
pub fn get_tracks(&self) -> Vec<TrackInfo> {
|
||||||
self.tracks
|
let mut tracks: Vec<_> = self
|
||||||
|
.tracks
|
||||||
.values()
|
.values()
|
||||||
.map(|sound| TrackInfo {
|
.map(|sound| TrackInfo {
|
||||||
id: sound.id,
|
id: sound.id,
|
||||||
@@ -326,7 +327,9 @@ impl AudioPlayer {
|
|||||||
looped: sound.looped,
|
looped: sound.looped,
|
||||||
paused: sound.sink.is_paused(),
|
paused: sound.sink.is_paused(),
|
||||||
})
|
})
|
||||||
.collect()
|
.collect();
|
||||||
|
tracks.sort_by_key(|t| t.id);
|
||||||
|
tracks
|
||||||
}
|
}
|
||||||
|
|
||||||
pub async fn update(&mut self) {
|
pub async fn update(&mut self) {
|
||||||
|
|||||||
Reference in New Issue
Block a user