cellMusicDecode: Fix track selection on prev/next track

This commit is contained in:
Megamouse 2026-06-01 01:27:21 +02:00
parent 883a6889e0
commit fa1aa9dcf3
3 changed files with 9 additions and 6 deletions

View File

@ -74,6 +74,7 @@ struct music_decode
cellMusicDecode.notice("set_decode_command(START): context: %s", current_selection_context.to_string());
music_selection_context context = current_selection_context;
context.current_track = context.first_track;
for (usz i = 0; i < context.playlist.size(); i++)
{

View File

@ -465,7 +465,7 @@ namespace utils
stop();
}
void audio_decoder::set_context(music_selection_context context)
void audio_decoder::set_context(music_selection_context&& context)
{
m_context = std::move(context);
}
@ -714,8 +714,6 @@ namespace utils
return;
}
m_context.current_track = m_context.first_track;
if (m_context.context_option == CELL_SEARCH_CONTEXTOPTION_SHUFFLE && m_context.playlist.size() > 1)
{
// Shuffle once if necessary
@ -740,8 +738,12 @@ namespace utils
// Let's only decode one track at a time. Wait for the consumer to finish reading the track.
media_log.notice("audio_decoder: waiting until track is consumed...");
thread_ctrl::wait_on(track_fully_consumed, 0);
track_fully_consumed = false;
while (thread_ctrl::state() != thread_state::aborting && !track_fully_consumed)
{
thread_ctrl::wait_on(track_fully_consumed, 0);
}
track_fully_consumed = 0;
}
media_log.notice("audio_decoder: finished playlist");

View File

@ -63,7 +63,7 @@ namespace utils
audio_decoder();
~audio_decoder();
void set_context(music_selection_context context);
void set_context(music_selection_context&& context);
void set_swap_endianness(bool swapped);
void clear();
void stop();