private void butPlay_Click(object sender, EventArgs e) { if (_soundId == -1) { return; } var soundInfo = _soundInfos.FirstOrDefault(soundInfo_ => soundInfo_.Id == _soundId); if (soundInfo == null) { DarkMessageBox.Show(this, "This sound is missing.", "Unable to play sound.", MessageBoxIcon.Information); return; } try { WadSoundPlayer.PlaySoundInfo(_editor.Level, soundInfo); } catch (Exception exc) { logger.Warn(exc, "Unable to play sample"); DarkMessageBox.Show(this, "Playing sound failed. " + exc, "Unable to play sound.", MessageBoxIcon.Information); } }
private void butPlaySound_Click(object sender, EventArgs e) { if (_editor.Tool.ReferenceLevel == null || _editor.Tool.ReferenceLevel.Settings.GlobalSoundMap.Count == 0) { return; } var soundInfo = _editor.Tool.ReferenceLevel.Settings.GlobalSoundMap.FirstOrDefault(soundInfo_ => soundInfo_.Id == (int)nudSoundId.Value); if (soundInfo != null) { try { WadSoundPlayer.PlaySoundInfo(_editor.Tool.ReferenceLevel, soundInfo); } catch (Exception exc) { } // FIXME: do something! } }
public void PlayCurrentSoundInfo() => WadSoundPlayer.PlaySoundInfo(ReferenceLevel, SoundInfo);