driver, queue: return track handle when adding an Input to the queue (#116)

This commit is contained in:
Jan
2022-03-08 00:58:21 +01:00
committed by Kyle Simpson
parent ac20764157
commit bacf681465
2 changed files with 10 additions and 7 deletions

View File

@@ -165,9 +165,11 @@ impl TrackQueue {
}
/// Adds an audio source to the queue, to be played in the channel managed by `handler`.
pub fn add_source(&self, source: Input, handler: &mut Driver) {
let (audio, _) = tracks::create_player(source);
self.add(audio, handler);
pub fn add_source(&self, source: Input, handler: &mut Driver) -> TrackHandle {
let (track, handle) = tracks::create_player(source);
self.add(track, handler);
handle
}
/// Adds a [`Track`] object to the queue, to be played in the channel managed by `handler`.