From 00f6763228b912a0e38374fc6ee4f6f62d5dccd2 Mon Sep 17 00:00:00 2001 From: Megamouse Date: Sun, 6 Mar 2022 12:09:04 +0100 Subject: [PATCH] cellMusic: fix qt music handler resume --- rpcs3/rpcs3qt/qt_music_handler.cpp | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/rpcs3/rpcs3qt/qt_music_handler.cpp b/rpcs3/rpcs3qt/qt_music_handler.cpp index eae2ca57c6..8de961f9cc 100644 --- a/rpcs3/rpcs3qt/qt_music_handler.cpp +++ b/rpcs3/rpcs3qt/qt_music_handler.cpp @@ -11,7 +11,10 @@ LOG_CHANNEL(music_log, "Music"); qt_music_handler::qt_music_handler() { music_log.notice("Constructing Qt music handler..."); + m_media_player = std::make_shared(); + m_media_player->setAudioRole(QAudio::Role::MusicRole); + m_error_handler = std::make_unique(m_media_player); } @@ -40,10 +43,17 @@ void qt_music_handler::play(const std::string& path) Emu.CallFromMainThread([&wake_up, &path, this]() { - music_log.notice("Playing music: %s", path); - m_media_player->setAudioRole(QAudio::Role::MusicRole); - m_media_player->setPlaybackRate(1.0); - m_media_player->setMedia(QUrl(QString::fromStdString(path))); + if (m_state == CELL_MUSIC_PB_STATUS_PAUSE) + { + music_log.notice("Resuming music: %s", path); + } + else + { + music_log.notice("Playing music: %s", path); + m_media_player->setPlaybackRate(1.0); + m_media_player->setMedia(QUrl(QString::fromStdString(path))); + } + m_media_player->play(); wake_up = true; wake_up.notify_one();