当前位置: 首页>>代码示例>>C#>>正文


C# Media.SoundPlayer类代码示例

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


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


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