* Save a custom playlist to settings after modification. * @param pl Playlist to store back */
| 426 | * @param pl Playlist to store back |
| 427 | */ |
| 428 | void MusicSystem::SaveCustomPlaylist(PlaylistChoices pl) |
| 429 | { |
| 430 | uint8_t *settings_pl; |
| 431 | if (pl == PLCH_CUSTOM1) { |
| 432 | settings_pl = _settings_client.music.custom_1; |
| 433 | } else if (pl == PLCH_CUSTOM2) { |
| 434 | settings_pl = _settings_client.music.custom_2; |
| 435 | } else { |
| 436 | return; |
| 437 | } |
| 438 | |
| 439 | size_t num = 0; |
| 440 | std::fill_n(settings_pl, NUM_SONGS_PLAYLIST, 0); |
| 441 | |
| 442 | for (const auto &song : this->standard_playlists[pl]) { |
| 443 | /* Music set indices in the settings playlist are 1-based, 0 means unused slot */ |
| 444 | settings_pl[num++] = (uint8_t)song.set_index + 1; |
| 445 | } |
| 446 | } |
| 447 | |
| 448 | |
| 449 | /** |
no test coverage detected