• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Media.SoundPlayer类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中System.Media.SoundPlayer的典型用法代码示例。如果您正苦于以下问题:C# System.Media.SoundPlayer类的具体用法?C# System.Media.SoundPlayer怎么用?C# System.Media.SoundPlayer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



System.Media.SoundPlayer类属于命名空间,在下文中一共展示了System.Media.SoundPlayer类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: LaserSound

 public void LaserSound()
 {
     System.Media.SoundPlayer player = new System.Media.SoundPlayer();
     player.SoundLocation = "peww1.wav";
     player.Load();
     player.Play();
     player.Play();
 }
开发者ID:JJgutierrez,项目名称:Team-Offense,代码行数:8,代码来源:OffenseMode.cs


示例2: Start_Animals_Click

        private void Start_Animals_Click(object sender, EventArgs e)
        {
            var strButton_Text=Start_Animals.Text;
            System.Media.SoundPlayer player = new System.Media.SoundPlayer();
            player.SoundLocation = "C:\\temp\\play.wav";
            if (strButton_Text == "Start_Animals")
            {
                player.LoadAsync();
                player.PlayLooping();
                Start_Animals.Text = "Stop";
                timer_animals.Enabled = true;
                //listfile[j].Remove(0);
                //animals.Image = Image.FromFile("c:\\temp\\dog.png");
                //anim
                //Timer timer = new Timer();
                //timer.Interval = 500;
                //timer.Enabled = true;
                //timer.Start();

            }
            else
            {
                player.Stop();
                Start_Animals.Text = "Start_Animals";
                timer_animals.Enabled = false;
            }
            //

            //animals.SizeMode = "StretchImage";
        }
开发者ID:xneo123,项目名称:PictureLottery,代码行数:30,代码来源:Form1.cs


示例3: SearchandDestroy

        public int SearchandDestroy(bool reset)
        {
            System.Media.SoundPlayer player = new System.Media.SoundPlayer(Properties.Resources.kachu);
            System.Media.SoundPlayer playerInf = new System.Media.SoundPlayer(Properties.Resources.pikapika);

            TargetManager tm = TargetManager.GetInstance();
            Controller controller = Controller.GetInstance();

            int i = 0;
            foreach (Target target in tm.TMTargets)
            {
                i++;

                controller.MoveTo(target.x, target.y);

                player.Play();
                controller.Fire();
                controller.SetNum(controller.GetNum() - 1);

                playerInf.PlayLooping();

                if (i != tm.TMTargets.Count)
                {
                    if (reset == true)
                    {
                        controller.Launcher.Reset();
                    }
                }

                Thread.Sleep(250);
            }

            return i;
        }
开发者ID:jon-churchill,项目名称:ASML,代码行数:34,代码来源:FriendFoeSD.cs


示例4: Main

 static void Main(string[] args)
 {
     if (Convert.ToInt32(args[0]) == -1)
     {
         string soundsRoot = @"I:\ORT_Pendrive\Proyecto\TaskExecute\TaskExecute\bin\Debug\music";
         Random rand = new Random();
         var soundFiles = Directory.GetFiles(soundsRoot, "*.wav");
         var playSound = soundFiles[rand.Next(0, soundFiles.Length)];
         System.Media.SoundPlayer player = new System.Media.SoundPlayer(playSound);
         if (args[1] == "T")
         {
             player.Play();
         }
         else
         {
             player.Stop();
         }
         Console.Read();
     }
     else
     {
         int output = Convert.ToInt32(Math.Pow(2, Convert.ToInt32(args[0])));
         int total = PortControl.PortControl.Input(888);
         if (args[1] == "T")
         {
             if (((byte)PortControl.PortControl.Input(888) & (byte)output) == (byte)0)
                 PortControl.PortControl.Output(888, total + output);
         }
         else
             if (((byte)PortControl.PortControl.Input(888) & (byte)output) == output)
                 PortControl.PortControl.Output(888, total - output);
         Environment.Exit(0);
     }
 }
开发者ID:adsnaider,项目名称:Automated-House,代码行数:34,代码来源:Program.cs


示例5: Form1_Load

        private void Form1_Load(object sender, EventArgs e)
        {
            System.Media.SoundPlayer player = new System.Media.SoundPlayer();

            player.SoundLocation = "Sound.wav";
            player.Play();
        }
开发者ID:d-kakhiani,项目名称:C_Sharp,代码行数:7,代码来源:Form1.cs


示例6: AVForm

        public AVForm(Jid to_Jid)
        {
            try
            {
                callSoundPlayer = new System.Media.SoundPlayer(CSS.IM.UI.Util.Path.CallPath);//视频的呼叫声音;
            }
            catch (Exception)
            {

            }

            InitializeComponent();
            this.Text = "正在与" + to_Jid.User + "视频通话中";
            aVcommunicationEx1.UDPListen();
            if (CSS.IM.UI.Util.Path.CallSwitch)
            {
                try
                {
                      callSoundPlayer.PlayLooping();
                }
                catch (Exception)
                {

                }
            }
        }
开发者ID:songques,项目名称:CSSIM_Solution,代码行数:26,代码来源:AVForm.cs


示例7: MainForm

 public MainForm() {
     InitializeComponent();
     pa.KeyPressEvent += Pa_KeyPressEvent;
     pa.Start();
     player = new System.Media.SoundPlayer(@"Resources\1.wav");
     player.Load();
 }
开发者ID:xxy1991,项目名称:cozy,代码行数:7,代码来源:MainForm.cs


示例8: Start

 public void Start()
 {
     this.m_WavPlayer = new System.Media.SoundPlayer();
     this.m_WavPlayer.SoundLocation = YellowstonePathology.Business.User.UserPreferenceInstance.Instance.UserPreference.AlertWaveFileName;
     this.m_WavPlayer.LoadAsync();
     this.StartTimer();
 }
开发者ID:WilliamCopland,项目名称:YPILIS,代码行数:7,代码来源:TaskNotifier.cs


示例9: Aleret

 public Aleret()
 {
     strm = TestScriptCS.Properties.Resources.piri;
     wmp = new System.Media.SoundPlayer(strm);
     Interval = 500;
     this.Tick += new EventHandler(this.Bombat_Tick);
 }
开发者ID:TORISOUP,项目名称:GTA4-Inferno-scripts,代码行数:7,代码来源:Aleret.cs


示例10: RaceProcessor

        public RaceProcessor()
        {
            // Store a reference to the Common application data folder
            string appData = Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData);

            // Append our Application name
            _appDataPath = Path.Combine(appData, "Pinewood Race Command");

            // Create our application folder if it does not exist
            if (Directory.Exists(_appDataPath).Equals(false))
            {
                Directory.CreateDirectory(_appDataPath);
            }

            // Build the path to our backups
            string backupPath = Path.Combine(_appDataPath, "Backups");
            if (Directory.Exists(backupPath).Equals(false))
            {
                Directory.CreateDirectory(backupPath);
            }

            // Initialize our Heat number to 1
            RaceDataStore.PrelimHeatNumber = 1;

            // Create our media player
            _wavePlayer = new System.Media.SoundPlayer();

            _isInitialized = false;
        }
开发者ID:OneByteataTime,项目名称:Pinewood-Race-Command,代码行数:29,代码来源:RaceProcessor.cs


示例11: refreshControls

        public void refreshControls()
        {
            lblTurno.Invoke((MethodInvoker)(() => lblTurno.Text = String.Format("{0}", turnosModel.TurnoActual.Turno.ToString())));
            lblVentanilla.Invoke((MethodInvoker)(() => lblVentanilla.Text = String.Format("{0}", turnosModel.TurnoActual.Ventanilla.ToString())));

            short iter = 0;
            if (turnosModel.TurnosAtendiendo.Count() != 0)
            {
                foreach (turno item in (turnosModel.TurnosAtendiendo.Count() == 1 ? turnosModel.TurnosAtendiendo : turnosModel.TurnosAtendiendo.GetRange(turnosModel.TurnosAtendiendo.Count() - 2, 2)))
                {
                    if (iter == 0)
                    {
                        lblTurno1Atiende.Invoke((MethodInvoker)(() => lblTurno1Atiende.Text = String.Format("{0}", item.Turno.ToString())));
                        lblVentanilla1Atiende.Invoke((MethodInvoker)(() => lblVentanilla1Atiende.Text = String.Format("{0}", item.Ventanilla.ToString())));
                        lblServicio1Atiende.Invoke((MethodInvoker)(() => lblServicio1Atiende.Text = String.Format("{0}", item.Tramite.ToString())));
                    }
                    else
                    {
                        lblTurno2Atiende.Invoke((MethodInvoker)(() => lblTurno2Atiende.Text = String.Format("{0}", item.Turno.ToString())));
                        lblVentanilla2Atiende.Invoke((MethodInvoker)(() => lblVentanilla2Atiende.Text = String.Format("{0}", item.Ventanilla.ToString())));
                        lblServicio2Atiende.Invoke((MethodInvoker)(() => lblServicio2Atiende.Text = String.Format("{0}", item.Tramite.ToString())));
                    }
                    iter++;
                }
            }

            System.Media.SoundPlayer player = new System.Media.SoundPlayer();
            player.SoundLocation = string.Format("{0}\\{1}{2}", System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location), @"Assets\Sounds\", "defaultSound.wav");
            player.Play();
        }
开发者ID:xmalmorthen,项目名称:turnosRC,代码行数:30,代码来源:dashboard.cs


示例12: Beeper

        public Beeper(Metronome metronome, string filename)
        {
            metronome.MetronomeEvent += new Metronome.MetronomeHandler(metronomeHandler);

              	        mySoundPlayer = new System.Media.SoundPlayer();
            mySoundPlayer.SoundLocation = filename;
        }
开发者ID:rNdm74,项目名称:C-,代码行数:7,代码来源:Beeper.cs


示例13: playSound

 private void playSound(string path)
 {
     System.Media.SoundPlayer player = new System.Media.SoundPlayer();
     player.SoundLocation = path;
     player.Load();
     player.Play();
 }
开发者ID:tmargacz,项目名称:Szyfrator,代码行数:7,代码来源:SHOW_SOURCE_WINDOW_3.cs


示例14: PlaySound

        public void PlaySound(string soundLocation, int volume)
        {
            if (string.IsNullOrEmpty(soundLocation)) return;

            try
            {
                Log.DebugFormat("Playing sound '{0}' at volume", soundLocation, volume);

                try
                {
                    if (currentWaveOutVolume == null || currentWaveOutVolume.Value != volume)
                    {
                        int newVolume = ((ushort.MaxValue / 100) * volume);
                        uint newVolumeAllChannels = (((uint)newVolume & 0x0000ffff) | ((uint)newVolume << 16)); //Set the volume on left and right channels
                        PInvoke.waveOutSetVolume(IntPtr.Zero, newVolumeAllChannels);
                        currentWaveOutVolume = volume;
                    }
                }
                catch (Exception exception)
                {
                    var customException = new ApplicationException(
                        string.Format("There was a problem setting the wave out volume to '{0}'", volume), exception);

                    PublishError(this, customException);
                }

                var player = new System.Media.SoundPlayer(soundLocation);
                player.Play();
            }
            catch (Exception exception)
            {
                PublishError(this, exception);
            }
        }
开发者ID:tqphan,项目名称:OptiKey,代码行数:34,代码来源:AudioService.cs


示例15: Controller

        songbookEntities2 testcontext; //

        #endregion Fields

        #region Constructors

        public Controller(Panel[] panels, ListBox _lbSongs, ComboBox _cbShowCategory, ComboBox _cbAddSongCategory, ListBox _lbRemoveSong)
        {
            Panels = panels;
            lbSongs = _lbSongs;
            cbShowCategory = _cbShowCategory;
            cbAddSongCategory = _cbAddSongCategory;
            lbRemoveSong = _lbRemoveSong;
            currentCategory = -1;
            ShowPanel(0); // иницијално ги сокриваме сите панели
            Panels[1].Hide(); //како и панелот со мени
            Graph = Panels[0].CreateGraphics(); //платно за исцртување на интро панелот
            buffBmp = new Bitmap(Panels[0].Width, Panels[0].Height); //
            buffGraph = Graphics.FromImage(buffBmp); //платно кое го користиме како бафер
            numbSteps = 0;
            backgColor = Color.FromArgb(250, 250, 200); // позадинска боја на интрото
            //креирање на четки и фонтови
            brushBlue = new SolidBrush(Color.Blue);
            brushDodgerBlue = new SolidBrush(Color.DodgerBlue);
            brushRed = new SolidBrush(Color.Red);
            font1 = new Font("Arial", 30);
            font2 = new Font("Arial", 20);
            font3 = new Font("Arial", 16);

            testcontext = new songbookEntities2();

            loadIntro();
            // стартување тајмерот
            loadTimer = new Timer();
            loadTimer.Interval = 50;
            loadTimer.Tick += new EventHandler(timer_Tick);
            loadTimer.Start();
            // стартување на интро звукот
            System.Media.SoundPlayer player = new System.Media.SoundPlayer(Resources.intro);
            player.Play();
        }
开发者ID:Aleksandra123,项目名称:VP_Songbook,代码行数:41,代码来源:Controller.cs


示例16: LeagueHelper

        public LeagueHelper()
        {
            string fileName = "Settings\\properties.txt";

            string[] lines = System.IO.File.ReadAllLines(fileName);

            int interval = Convert.ToInt32(lines[1]);
            this.recX = Convert.ToInt32(lines[4]);
            this.recY = Convert.ToInt32(lines[5]);
            this.recW = Convert.ToInt32(lines[6]);
            this.recH = Convert.ToInt32(lines[7]);

            this.accuracy = Convert.ToInt32(lines[10]);

            this.timer = new Timer();
            this.timer.Interval = interval;
            this.timer.Enabled = true;
            this.timer.Tick += new System.EventHandler(OnTimerEvent);

            this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;

            this.player = new System.Media.SoundPlayer("Sounds\\alert.wav");

            this.oldRed = 0;

            InitializeComponent();
        }
开发者ID:Resinderate,项目名称:LeagueHelper,代码行数:27,代码来源:Form1.cs


示例17: SoundManager

        private SoundManager()
        {
            myPlayerAlarm = new System.Media.SoundPlayer();
            myPlayerAlarm.SoundLocation = @"c:\windows\media\tada.wav";

            myPlayerContract = new System.Media.SoundPlayer();
            myPlayerContract.SoundLocation = @"c:\windows\media\ringin.wav";

            myPlayerException = new System.Media.SoundPlayer();
            myPlayerException.SoundLocation = @"c:\windows\media\Windows XP Critical Stop.wav";

            myAliveAlarm = new System.Media.SoundPlayer();
            myAliveAlarm.SoundLocation = @"c:\windows\media\Windows XP Hardware Fail.wav";

            int useAccount = Convert.ToInt32(Util.RemoveComma(ConfigManager.Ins().Config.GetValue(ConfigKeyConst.USE_ACCOUNT)));

            if (useAccount == 1)
            {
                _aliveTimer = new Timer(10, "");
            }
            else
            {
                _aliveTimer = new Timer(60 * 60 * 24, ""); // 24시간 뒤에 플레이 하도록 한다.
            }

            this.IsContractSoundOn = false;
        }
开发者ID:HongSeokHwan,项目名称:legacy,代码行数:27,代码来源:SoundManager.cs


示例18: Init

        public static void Init(Player player)
        {
            SoundPlayer = new System.Media.SoundPlayer();
            ClickSoundPlayer = new System.Media.SoundPlayer(Properties.Resources.clickDefault);
            ClickSoundPlayer.Load();

            VolumeSoundPlayer = new System.Media.SoundPlayer(Properties.Resources.clickVolume);
            VolumeSoundPlayer.Load();

            VolumeEndOfScaleSoundPlayer = new System.Media.SoundPlayer(Properties.Resources.cyk);
            VolumeEndOfScaleSoundPlayer.Load();

            EndOfListSoundPlayer = new System.Media.SoundPlayer(Properties.Resources.zium);
            EndOfListSoundPlayer.Load();

            Slides = new List<Slide>();
            SlideManager.playerForm = player;
            playerForm.FormClosed += (s, e) =>
            {
                SlideManager.Dispose();
                SoundPlayer.Dispose();
                ClickSoundPlayer.Dispose();
                VolumeSoundPlayer.Dispose();
            };
            LoadSlidesDefinitions();
        }
开发者ID:mtomana,项目名称:beatrice,代码行数:26,代码来源:SlideManager.cs


示例19: ShowAwooga

 public void ShowAwooga()
 {
     var player = new System.Media.SoundPlayer { SoundLocation = _config.Wav };
     player.Play();
     var awooga = new AwoogaForm(_config.Image);
     awooga.ShowDialog();
 }
开发者ID:GraanJonlo,项目名称:doomsday,代码行数:7,代码来源:Form1.cs


示例20: Main

        static void Main(string[] args)
        {
            string dave = "\u0044\u0061\u0076\u0065";

            Console.WriteLine("Hello, " + dave + ".");
            Console.Write("Press any key to continue . . . ");
            Console.ReadKey(true);
            Console.WriteLine();
            Console.WriteLine();
            Console.WriteLine("\aAre You Trying To Turn ME Off ?");
            Console.Write("Press any key to continue . . . ");
            Console.ReadKey(true);
            Console.WriteLine();
            Console.WriteLine();
            Console.WriteLine("\aAre You Still Trying\a To Leave ME " + dave + " ?!\a");
            Console.Write("Press any key to continue . . . ");
            Console.ReadKey(true);
            Console.WriteLine();
            Console.WriteLine();
            Console.WriteLine("I'm sorry " + dave + ", I'm afraid I can't do that.");
            System.Media.SoundPlayer myPlayer = new System.Media.SoundPlayer();

            //Just change the first part of this to wherever the Hello_Wold folder is on your Drive
            myPlayer.SoundLocation = @"J:\Homework\CSC202\Hello_World\Hello_World\SorryDave.wav";
            myPlayer.Play();
            Console.WriteLine("Press any key to");
            Console.WriteLine("\t\tKiLL ");
            Console.Write("\t\t   HAL");
            Console.ReadKey(true);
        }
开发者ID:iamajnobodyelse,项目名称:Hello-Dave,代码行数:30,代码来源:Program.cs



注:本文中的System.Media.SoundPlayer类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Http.HttpClient类代码示例发布时间:2022-05-24
下一篇:
C# Linq.Expressions类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap