private void b_play_Click(object sender, EventArgs e) { if (lb_sample.SelectedItem == null) { return; } string key = lb_sample.SelectedItem.ToString(); if (key == "None") { return; } if (lastPlaySample != null) { lastPlaySample.Stop(); lastPlaySample = null; } int addr = AudioEngine.LoadBeatmapSample(key, false); //ignore slider and tick, just for preview //HitObject.ProcessSampleFile reset sample to proper loop config. if (addr != -1) { lastPlaySample = AudioEngine.PlaySample(addr, (int)nud_vol.Value); } }
protected override void Dispose(bool disposing) { if (ApplauseChannel != null) { ApplauseChannel.Stop(); } AudioEngine.StopAllSampleEvents(); if (scrollableArea != null) { scrollableArea.Dispose(); } KeyboardHandler.OnKeyPressed -= GameBase_OnKeyPressed; if (BeatmapManager.Current != null) { BeatmapManager.Current.Scores.Clear(); } if (rankingDialog != null) { rankingDialog.Close(); rankingDialog.Dispose(); } if (score != null) { if (score.HpGraph != null) { score.DisposeHpGraph(); } if (LoadingReplay) { score.GotReplayData -= score_GotReplayData; } if (!InputManager.ReplayMode) { score.ClearReplayData(); } } switch (GameBase.QueuedMode) { case OsuModes.Rank: case OsuModes.RankingTagCoop: case OsuModes.RankingTeam: case OsuModes.RankingVs: break; default: Player.currentScore = null; break; } GameBase.spriteManager.Remove(s_white); if (spriteManagerWideScrolling != null) { spriteManagerWideScrolling.Dispose(); } if (spriteManagerWideAbove != null) { spriteManagerWideAbove.Dispose(); } if (spriteManagerWideBelow != null) { spriteManagerWideBelow.Dispose(); } base.Dispose(disposing); }