diff --git a/pipewire.cpp b/pipewire.cpp index 8fbd4b9..5e7935e 100644 --- a/pipewire.cpp +++ b/pipewire.cpp @@ -128,10 +128,23 @@ Player::~Player() stop_all(); } -void Player::play_file(const QString& file_path, const QString& target_node/* = "auto" */) +void Player::play_file(const QString& file_path, + const QString& target_sink/* = "auto" */, float speed/* = 1.0f */) { + QString target = target_sink; + if (target_sink != "auto") { + target = "pipewire/" + target_sink; + } + + QStringList args; + args << "--vo=null" << "--no-video" + << "--audio-pitch-correction=no" + << "--audio-device=" + target + << "--speed=" + QString::number(speed, 'f', 1) + << file_path; + auto process = std::make_unique(); - process->start("pw-play", { "--target", target_node, file_path }); + process->start("mpv", args); m_playing_processes.push_back(std::move(process)); } diff --git a/pipewire.hpp b/pipewire.hpp index 2dde690..fff2fb9 100644 --- a/pipewire.hpp +++ b/pipewire.hpp @@ -57,7 +57,8 @@ class Player public: ~Player(); - void play_file(const QString& file_path, const QString& target_node = "auto"); + void play_file(const QString& file_path, + const QString& target_sink = "auto", float speed = 1.0f); void stop_all(); private: