Start/restart playback at current song */
| 237 | |
| 238 | /** Start/restart playback at current song */ |
| 239 | void MusicSystem::Play() |
| 240 | { |
| 241 | /* Always set the playing flag, even if there is no music */ |
| 242 | _settings_client.music.playing = true; |
| 243 | MusicDriver::GetInstance()->StopSong(); |
| 244 | /* Make sure playlist_position is a valid index, if playlist has changed etc. */ |
| 245 | this->ChangePlaylistPosition(0); |
| 246 | |
| 247 | /* If there is no music, don't try to play it */ |
| 248 | if (this->active_playlist.empty()) return; |
| 249 | |
| 250 | MusicSongInfo song = this->active_playlist[this->playlist_position]; |
| 251 | if (_game_mode == GM_MENU && this->selected_playlist == PLCH_THEMEONLY) song.loop = true; |
| 252 | MusicDriver::GetInstance()->PlaySong(song); |
| 253 | |
| 254 | InvalidateWindowData(WC_MUSIC_WINDOW, 0); |
| 255 | } |
| 256 | |
| 257 | /** Stop playback and set flag that we don't intend to play music */ |
| 258 | void MusicSystem::Stop() |
no test coverage detected