cellMusic: don't send status callback if we just keep playing automatically

This commit is contained in:
Megamouse 2026-05-31 10:52:15 +02:00
parent 059e70069d
commit 7b540cdb20
5 changed files with 11 additions and 11 deletions

View File

@ -102,7 +102,7 @@ struct music_state
// Let's just play the next song for now
if (current_selection_context.content_type == CELL_SEARCH_CONTENTTYPE_MUSICLIST && handler->get_state() == CELL_MUSIC_PB_STATUS_PLAY)
{
if (const error_code error = set_playback_command(CELL_MUSIC_PB_CMD_NEXT))
if (const error_code error = set_playback_command(CELL_MUSIC_PB_CMD_NEXT, true))
{
cellMusic.error("Failed to play next track. error=0x%x", +error);
}
@ -135,7 +135,7 @@ struct music_state
}
// NOTE: This function only uses CELL_MUSIC enums. CELL_MUSIC2 enums are identical.
error_code set_playback_command(s32 command)
error_code set_playback_command(s32 command, bool automatic = false)
{
switch (command)
{
@ -196,7 +196,7 @@ struct music_state
handler->fast_reverse(path);
break;
default:
handler->play(path);
handler->play(path, automatic);
break;
}

View File

@ -9,7 +9,7 @@ public:
void stop() override { set_state(0); } // CELL_MUSIC_PB_STATUS_STOP
void pause() override { set_state(2); } // CELL_MUSIC_PB_STATUS_PAUSE
void play(const std::string& /*path*/) override { set_state(1); } // CELL_MUSIC_PB_STATUS_PLAY
void play(const std::string& /*path*/, bool automatic = false) override { set_state(1, automatic); } // CELL_MUSIC_PB_STATUS_PLAY
void fast_forward(const std::string& /*path*/) override { set_state(3); } // CELL_MUSIC_PB_STATUS_FASTFORWARD
void fast_reverse(const std::string& /*path*/) override { set_state(4); } // CELL_MUSIC_PB_STATUS_FASTREVERSE
void set_volume(f32 volume) override { m_volume = volume; }

View File

@ -15,17 +15,17 @@ public:
virtual void stop() = 0;
virtual void pause() = 0;
virtual void play(const std::string& path) = 0;
virtual void play(const std::string& path, bool automatic = false) = 0;
virtual void fast_forward(const std::string& path) = 0;
virtual void fast_reverse(const std::string& path) = 0;
virtual void set_volume(f32 volume) = 0;
virtual f32 get_volume() const = 0;
void set_state(u32 state)
void set_state(u32 state, bool automatic = false)
{
m_state = state;
const bool changed = m_state.exchange(state) != state;
if (m_event_status_callback)
if (m_event_status_callback && (changed || !automatic))
{
m_event_status_callback(state);
}

View File

@ -113,7 +113,7 @@ void qt_music_handler::pause()
set_state(CELL_MUSIC_PB_STATUS_PAUSE);
}
void qt_music_handler::play(const std::string& path)
void qt_music_handler::play(const std::string& path, bool automatic)
{
std::lock_guard lock(m_mutex);
@ -135,7 +135,7 @@ void qt_music_handler::play(const std::string& path)
m_media_player->play();
});
set_state(CELL_MUSIC_PB_STATUS_PLAY);
set_state(CELL_MUSIC_PB_STATUS_PLAY, automatic);
}
void qt_music_handler::fast_forward(const std::string& path)

View File

@ -16,7 +16,7 @@ public:
void stop() override;
void pause() override;
void play(const std::string& path) override;
void play(const std::string& path, bool automatic = false) override;
void fast_forward(const std::string& path) override;
void fast_reverse(const std::string& path) override;
void set_volume(f32 volume) override;