Exemplo n.º 1
0
        void PlaySound(IAudioOutput output, float volume)
        {
            try {
                output.SetVolume(volume);
                output.SetFormat(format);
                output.PlayData(0, chunk);
            } catch (InvalidOperationException ex) {
                ErrorHandler.LogError("AudioPlayer.PlayCurrentSound()", ex);
                if (ex.Message == "No audio devices found")
                {
                    game.Chat.Add("&cNo audio devices found, disabling sounds.");
                }
                else
                {
                    game.Chat.Add("&cAn error occured when trying to play sounds, disabling sounds.");
                }

                SetSounds(0);
                game.SoundsVolume = 0;
            }
        }