mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2025-04-22 04:24:44 +00:00
address comments
This commit is contained in:
parent
664541f399
commit
e2a5a0a71e
5 changed files with 4 additions and 11 deletions
|
@ -9,17 +9,12 @@ BackgroundMusicPlayer::BackgroundMusicPlayer(QObject* parent) : QObject(parent)
|
|||
m_mediaPlayer->setAudioOutput(m_audioOutput);
|
||||
}
|
||||
|
||||
BackgroundMusicPlayer::~BackgroundMusicPlayer() {
|
||||
delete m_mediaPlayer;
|
||||
delete m_audioOutput;
|
||||
}
|
||||
|
||||
void BackgroundMusicPlayer::playMusic(const QString& snd0path) {
|
||||
if (snd0path.isEmpty()) {
|
||||
stopMusic();
|
||||
return;
|
||||
}
|
||||
QUrl newMusic = QUrl::fromLocalFile(snd0path);
|
||||
const auto newMusic = QUrl::fromLocalFile(snd0path);
|
||||
if (m_mediaPlayer->playbackState() == QMediaPlayer::PlayingState &&
|
||||
m_currentMusic == newMusic) {
|
||||
// already playing the correct music
|
||||
|
|
|
@ -21,7 +21,6 @@ public:
|
|||
|
||||
private:
|
||||
BackgroundMusicPlayer(QObject* parent = nullptr);
|
||||
~BackgroundMusicPlayer();
|
||||
|
||||
QMediaPlayer* m_mediaPlayer;
|
||||
QAudioOutput* m_audioOutput;
|
||||
|
|
|
@ -44,7 +44,7 @@ void GameGridFrame::PlayBackgroundMusic(QTableWidgetItem* item) {
|
|||
BackgroundMusicPlayer::getInstance().stopMusic();
|
||||
return;
|
||||
}
|
||||
QString snd0path = QString::fromStdString(m_game_info->m_games[item->row()].snd0_path);
|
||||
const auto snd0path = QString::fromStdString(m_game_info->m_games[item->row()].snd0_path);
|
||||
BackgroundMusicPlayer::getInstance().playMusic(snd0path);
|
||||
}
|
||||
|
||||
|
|
|
@ -73,7 +73,7 @@ void GameListFrame::PlayBackgroundMusic(QTableWidgetItem* item) {
|
|||
BackgroundMusicPlayer::getInstance().stopMusic();
|
||||
return;
|
||||
}
|
||||
QString snd0path = QString::fromStdString(m_game_info->m_games[item->row()].snd0_path);
|
||||
const auto snd0path = QString::fromStdString(m_game_info->m_games[item->row()].snd0_path);
|
||||
BackgroundMusicPlayer::getInstance().playMusic(snd0path);
|
||||
}
|
||||
|
||||
|
|
|
@ -513,12 +513,11 @@ void MainWindow::PlayBackgroundMusic() {
|
|||
BackgroundMusicPlayer::getInstance().stopMusic();
|
||||
return;
|
||||
}
|
||||
QString snd0path = "";
|
||||
int itemID = isTableList ? m_game_list_frame->currentItem()->row()
|
||||
: m_game_grid_frame->crtRow * m_game_grid_frame->columnCnt +
|
||||
m_game_grid_frame->crtColumn;
|
||||
|
||||
snd0path = QString::fromStdString(m_game_info->m_games[itemID].snd0_path);
|
||||
const auto snd0path = QString::fromStdString(m_game_info->m_games[itemID].snd0_path);
|
||||
BackgroundMusicPlayer::getInstance().playMusic(snd0path);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue