mirror of
https://github.com/arabianq/pipewire-soundpad.git
synced 2026-04-28 06:21:23 +00:00
feat: first attemp to support playing multiple tracks in parallel
This commit is contained in:
+2
-16
@@ -1,8 +1,5 @@
|
||||
use pwsp::{
|
||||
types::{
|
||||
audio_player::PlayerState,
|
||||
socket::{Request, Response},
|
||||
},
|
||||
types::socket::{Request, Response},
|
||||
utils::{
|
||||
commands::parse_command,
|
||||
daemon::{
|
||||
@@ -122,18 +119,7 @@ async fn player_loop() {
|
||||
loop {
|
||||
let mut audio_player = get_audio_player().await.lock().await;
|
||||
|
||||
// Start playback again if loop is enabled
|
||||
let should_play = audio_player.get_state() == PlayerState::Stopped
|
||||
&& audio_player.current_file_path.is_some()
|
||||
&& audio_player.looped;
|
||||
|
||||
if should_play {
|
||||
let file_path = audio_player.current_file_path.clone().unwrap();
|
||||
audio_player
|
||||
.play(&file_path)
|
||||
.await
|
||||
.expect("Something went wrong while trying to play the file");
|
||||
}
|
||||
audio_player.update().await;
|
||||
|
||||
sleep(Duration::from_millis(100)).await;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user