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


C# Sound.Play方法代码示例

本文整理汇总了C#中Sound.Play方法的典型用法代码示例。如果您正苦于以下问题:C# Sound.Play方法的具体用法?C# Sound.Play怎么用?C# Sound.Play使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Sound的用法示例。


在下文中一共展示了Sound.Play方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: PlaySound

 /// <summary>
 /// Plays a sound by name.
 /// </summary>
 /// <param name="soundName">The sound to play</param>
 public void PlaySound(Sound sound, bool isSoundOff, bool isPauseMusicZune)
 {
     if (isSoundOff || !isPauseMusicZune)
         return;
     // If the sound exists, start it
     sound.Play();
 }
开发者ID:doanhtdpl,项目名称:plants-vs-zombies-gameonmobile-uit-term7,代码行数:11,代码来源:AudioManager.cs

示例2: PlaySound

        private void PlaySound(string soundFile)
        {
            // sanitize path
            string path = soundFile;
            if (!Path.IsPathRooted(path))
            {
                path = System.Environment.CurrentDirectory + Path.DirectorySeparatorChar + path;
            }

            // play sound
            Sound sound = new Sound();
            sound.Play(path);
        }
开发者ID:binaryage,项目名称:xrefresh,代码行数:13,代码来源:Worker.cs

示例3: Level2

 public Level2(TimeGuardianGame game, int lives)
     : base(game)
 {
     Game = game;
     BackgroundCreator();
     _tileMap = FileReader.levelMaker(_levelNr, UtilStrings.TilesX, UtilStrings.TilesY);
     Player = new Player(lives, this, Game);
     _enemy = new EnemyOwl(this);
     CreateLevel();
     AddChild(Player);
     AddChild(_enemy);
     Music = new Sound(UtilStrings.SoundsBackground + "music_level_2.mp3", true, true);
     MusicChannel = Music.Play();
     AddChild(Pause);
 }
开发者ID:mtesseracttech,项目名称:ArcadeGame,代码行数:15,代码来源:Level2.cs

示例4: MainMenu

        public MainMenu(TimeGuardianGame game)
        {
            _game = game;
            SetBackground();
            SetHeader();
            _buttons = new []
            {
            new Button(UtilStrings.SpritesMenu + "button_newgame.png", 2, game.width/2, 350, "Level1"),
            new Button(UtilStrings.SpritesMenu + "button_highscore.png", 2, game.width/2, 450, "HighScores"),
            new Button(UtilStrings.SpritesMenu + "button_credits.png", 2, game.width/2, 550, "Credits"),
            new Button(UtilStrings.SpritesMenu + "button_exit.png", 2, game.width/2, 650, "Exit")
            };

            foreach (Button button in _buttons)
            {
                AddChild(button);
            }

            _selectedSound = new Sound(UtilStrings.SoundsMenu + "sound_selected.wav");
            _music = new Sound(UtilStrings.SoundsMenu + "music_menu.mp3", true, true);
            _musicChannel = _music.Play();

            _buttons[0].Selected();
        }
开发者ID:mtesseracttech,项目名称:ArcadeGame,代码行数:24,代码来源:MainMenu.cs

示例5: lnkPlay_Click

 private void lnkPlay_Click(object sender, EventArgs e)
 {
     SoundInfo selectedSound = (SoundInfo)cmbSound.SelectedItem;
     
     s = new Sound(selectedSound.Path);
     s.Play();
 }
开发者ID:JakeStevenson,项目名称:PockeTwit,代码行数:7,代码来源:NotificationSettings.cs

示例6: PlaySound

 /** <summary> Plays the specified sound effect. </summary> */
 public static SoundInstance PlaySound(Sound sound, bool looped, float volume = 1.0f, float pitch = 0.0f, float pan = 0.0f, bool muted = false)
 {
     return sound.Play(looped, volume, pitch, pan, muted);
 }
开发者ID:dreamsxin,项目名称:ZeldaOracle,代码行数:5,代码来源:AudioSystem.cs

示例7: NewItems

        //This gets called every time a fetch finds new items.
        public void NewItems()
        {
            foreach (var infoClass in _notifications.Values)
            {
                if(TimeLines.LastSelectedItems.GetUnreadItems(infoClass.ListName)>0)
                {
                    string constraints ="";
                    if (infoClass.Group != null) { constraints = infoClass.Group.GetConstraints(); }
                    if (infoClass.LastSeenID != LocalStorage.DataBaseUtility.GetNewestItem(infoClass.Type, constraints))
                    {
                        if ((infoClass.Options & Options.Vibrate) == Options.Vibrate && SoundProfileCheck.VibrateOn())
                        {
                            VibrateStart();
                            try
                            {
                                if ((infoClass.Options & Options.Sound) == Options.Sound)
                                {
                                    var s = new Sound(infoClass.Sound);
                                    s.Play();
                                }
                                else
                                {
                                    System.Threading.Thread.Sleep(1000);
                                }
                            }
                            finally
                            {
                                // always turn it off
                                // I've woken up to find the blasted phone buzzing
                                VibrateStop();
                            }
                        }
                        else if ((infoClass.Options & Options.Sound) == Options.Sound && SoundProfileCheck.VolumeOn())
                        {
                            var s = new Sound(infoClass.Sound);
                            s.Play();
                        }

                        if ((infoClass.Options & Options.Message) == Options.Message)
                        {
                            ShowNotifications();
                        }
                        infoClass.LastSeenID = LocalStorage.DataBaseUtility.GetNewestItem(infoClass.Type, constraints);
                    }
                }
            }
        }
开发者ID:enersia,项目名称:pocketwit,代码行数:48,代码来源:NotificationHandler.cs

示例8: loopMusic

    private void loopMusic()
    {
        if (_loopStarted) return;

        if (soundChannel.IsPlaying == false)
        {
            soundChannel.Volume = 0.001f;
            Sound backgroundloop = new Sound("backgroundloop.mp3", true, true);
            backgroundloop.Play(false, 1);
            _loopStarted = true;
        }
    }
开发者ID:mbos14,项目名称:GTFO,代码行数:12,代码来源:HeraGUN.cs

示例9: playSound

 //воспроизвести выбранную музыку
 int playSound(string nameSound)
 {
     //            Sound soundMusic = new Sound(nameSound + ".wav");
     Sound soundMusic = new Sound(nameSound + ".wav");
     soundMusic.Play();
     return 0;
 }
开发者ID:PostHttp,项目名称:WhatPicture,代码行数:8,代码来源:MainForm.cs


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