void MusicLoop() { if (!_settings_client.music.playing && _song_is_active) { StopMusic(); } else if (_settings_client.music.playing && !_song_is_active) { PlayPlaylistSong(); } if (!_song_is_active) return; if (!MusicDriver::GetInstance()->IsSongPlaying()) { if (_game_mode != GM_MENU) { StopMusic(); SkipToNextSong(); PlayPlaylistSong(); } else { ResetMusic(); } } }
void MusicLoop() { if (!_msf.playing && _song_is_active) { StopMusic(); } else if (_msf.playing && !_song_is_active) { PlayPlaylistSong(); } if (!_song_is_active) return; if (!_music_driver->IsSongPlaying()) { if (_game_mode != GM_MENU) { StopMusic(); SkipToNextSong(); PlayPlaylistSong(); } else { ResetMusic(); } } }
virtual void OnClick(Point pt, int widget, int click_count) { switch (widget) { case WID_M_PREV: // skip to prev if (!_song_is_active) return; SkipToPrevSong(); this->SetDirty(); break; case WID_M_NEXT: // skip to next if (!_song_is_active) return; SkipToNextSong(); this->SetDirty(); break; case WID_M_STOP: // stop playing _settings_client.music.playing = false; break; case WID_M_PLAY: // start playing _settings_client.music.playing = true; break; case WID_M_MUSIC_VOL: case WID_M_EFFECT_VOL: { // volume sliders int x = pt.x - this->GetWidget<NWidgetBase>(widget)->pos_x; byte *vol = (widget == WID_M_MUSIC_VOL) ? &_settings_client.music.music_vol : &_settings_client.music.effect_vol; byte new_vol = x * 127 / this->GetWidget<NWidgetBase>(widget)->current_x; if (_current_text_dir == TD_RTL) new_vol = 127 - new_vol; if (new_vol != *vol) { *vol = new_vol; if (widget == WID_M_MUSIC_VOL) MusicVolumeChanged((new_vol * new_vol) / 127); // Kinda logarithmic scale this->SetDirty(); } _left_button_clicked = false; break; } case WID_M_SHUFFLE: // toggle shuffle _settings_client.music.shuffle ^= 1; this->SetWidgetLoweredState(WID_M_SHUFFLE, _settings_client.music.shuffle); this->SetWidgetDirty(WID_M_SHUFFLE); StopMusic(); SelectSongToPlay(); this->SetDirty(); break; case WID_M_PROGRAMME: // show track selection ShowMusicTrackSelection(); break; case WID_M_ALL: case WID_M_OLD: case WID_M_NEW: case WID_M_EZY: case WID_M_CUSTOM1: case WID_M_CUSTOM2: // playlist SelectPlaylist(widget - WID_M_ALL); StopMusic(); SelectSongToPlay(); break; } }