1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 02:37:36 +00:00

Piano: Add track controls to the player widget

Adds the ability to add a track and cycle through the
tracks from player widget. Also displays the current track
being played or edited in a dropdown that allows
for quick track selection.
This commit is contained in:
Jose Flores 2021-12-04 22:42:35 -06:00 committed by Andreas Kling
parent 2b47e1233b
commit 65df30d00c
7 changed files with 78 additions and 9 deletions

View file

@ -90,8 +90,11 @@ void TrackManager::add_track()
m_tracks.append(make<Track>(m_time));
}
void TrackManager::next_track()
int TrackManager::next_track_index()
{
if (++m_current_track >= m_tracks.size())
m_current_track = 0;
auto next_track_index = m_current_track + 1;
if (next_track_index >= m_tracks.size())
return 0;
else
return next_track_index;
}