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

C# Audio.SoundEffectInstance类代码示例

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

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



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

示例1: Play

 public static void Play(SoundEffectInstance sound, float volume, float pan, float pitch)
 {
     sound.Play();
     sound.Volume = volume;
     sound.Pan = pan;
     sound.Pitch = pitch;
 }
开发者ID:billyboy429,项目名称:tctk,代码行数:7,代码来源:AudioManager.cs


示例2: RemoveSoundInstance

 public static void RemoveSoundInstance(SoundEffectInstance instance)
 {
     lock (Sync)
     {
         States.Remove(instance);
     }
 }
开发者ID:TravisEvashkevich,项目名称:bell,代码行数:7,代码来源:AudioManager.cs


示例3: AddSoundInstance

 public static void AddSoundInstance(SoundEffectInstance instance)
 {
     lock (Sync)
     {
         States.Add(instance, instance.State);
     }
 }
开发者ID:TravisEvashkevich,项目名称:bell,代码行数:7,代码来源:AudioManager.cs


示例4: PlayEffect

 public void PlayEffect(SoundEffectInstance effect, float duration)
 {
     SoundEffectDescriptor sd = new SoundEffectDescriptor();
     sd.Effect = effect;
     sd.RemainingDuration = duration;
     _effects.Add(sd);
 }
开发者ID:STPKITT,项目名称:OpenNFS1,代码行数:7,代码来源:SoundEngine2.cs


示例5: AddInstance

 public static int AddInstance(SoundEffectInstance instance)
 {
     _idCounter++;
     _soundEffects.Add(_idCounter, instance);
     _soundInstancesLoaded++;
     return _idCounter;
 }
开发者ID:trew,项目名称:PoorJetX,代码行数:7,代码来源:SoundFxManager.cs


示例6: RhythmMelodyMetadata

        public RhythmMelodyMetadata(SoundEffectInstance mainInstance, SoundEffectInstance backCopy)
        {
            _mainInstance = mainInstance;
            _backCopy = backCopy;

            Active = _backCopy;
        }
开发者ID:sergik,项目名称:Cardio,代码行数:7,代码来源:RhythmMelodyMetadata.cs


示例7: Motor

        public Motor(string name,ContentManager contentManager, string spriteName, int x, int y, Vector2 velocity,
            SoundEffect Sound, float soundVolume, float accSpeed, int mode)
            : base(contentManager, spriteName, x, y, velocity, Sound)
        {
            this.angle = 0;
              this.angleVelocity = 0;
              if(mode == 0)
              {
                  this.initialAccSpeed = accSpeed;
                  this.friction = 0.04F;
              }
              if(mode==1)
              {
                  this.initialAccSpeed = accSpeed;
                  this.friction = 0.065F;
              }

              this.accSpeed = this.initialAccSpeed;

              this.motorName = name;
              this.soundVolume = soundVolume;
              this.mode = mode;

              if (Sound != null)
              {
                  soundMotorInstance = this.Sound.CreateInstance();
                  soundMotorInstance.IsLooped = true;
                  soundMotorInstance.Volume = soundVolume - 0.2F;
                  this.soundMotorInstance.Play();
                  this.soundIsPlaying = true;
              }
        }
开发者ID:KrzyKuStudio,项目名称:Zuzuel,代码行数:32,代码来源:Motor.cs


示例8: Player

        public Player(string name, List<AnimatedTextureData> animationsList,
                    SpritePresentationInfo spritePresentationInfo,
                    SpritePositionInfo spritePositionInfo,
                    int frameRate)
            : base(name, animationsList,
                    spritePresentationInfo,
                    spritePositionInfo,
                    frameRate)
        {
            this.moveAmount = 0;
            this.velocity = Vector2.Zero;
            this.acceleration = 0.0015f;
            this.direction = Vector2.Zero;
            this.gravity = 0.0025f;
            this.jumpPower = 1.6f;
            this.springJumpPower = 2f;
            this.oldPos = new Vector2(spritePositionInfo.TRANSLATIONX, spritePositionInfo.TRANSLATIONY);
            this.hasKey = false;
            this.coins = 0;
            this.health = 3; // 3 health? 3 hearts?
            this.invulnerable = false;
            this.invulnerableTimer = 0;

            this.levelStartPos = spritePositionInfo.TRANSLATION;

            this.coinsTaken = new List<Block>();
            this.keysTaken = new List<Block>();

            this.jump = SpriteManager.GAME.SOUNDMANAGER.getEffectInstance("jump");
            this.pickup = SpriteManager.GAME.SOUNDMANAGER.getEffectInstance("pickup");
            this.hurt = SpriteManager.GAME.SOUNDMANAGER.getEffectInstance("hurt");
            this.endGame = SpriteManager.GAME.SOUNDMANAGER.getEffectInstance("endGame");
        }
开发者ID:Resinderate,项目名称:SensitiveWillum,代码行数:33,代码来源:Player.cs


示例9: SoundObject

 //Modular Constructor
 public SoundObject(SoundEffect target, Vector2 posn)
 {
     this.sound = target;
     this.position = posn;
     this.isModular = true;
     this.dynamic = sound.CreateInstance();
 }
开发者ID:pquinn,项目名称:time-sink,代码行数:8,代码来源:SoundObject.cs


示例10: Update

        /// <summary>
        /// Updates the position of the dog, and plays sounds.
        /// </summary>
        public override void Update(GameTime gameTime, AudioManager audioManager)
        {
            // Set the entity to a fixed position.
            Position = new Vector3(0, 0, -4000);
            Forward = Vector3.Forward;
            Up = Vector3.Up;
            Velocity = Vector3.Zero;

            // If the time delay has run out, start or stop the looping sound.
            // This would normally go on forever, but we stop it after a six
            // second delay, then start it up again after four more seconds.
            timeDelay -= gameTime.ElapsedGameTime;

            if (timeDelay < TimeSpan.Zero)
            {
                if (activeSound == null)
                {
                    // If no sound is currently playing, trigger one.
                    activeSound = audioManager.Play3DSound("DogSound", true, this);

                    timeDelay += TimeSpan.FromSeconds(6);
                }
                else
                {
                    // Otherwise stop the current sound.
                    activeSound.Stop(false);
                    activeSound = null;

                    timeDelay += TimeSpan.FromSeconds(4);
                }
            }
        }
开发者ID:Gevil,项目名称:Projects,代码行数:35,代码来源:Dog.cs


示例11: Initialize

        public static void Initialize(ContentManager content)
        {
            try
            {

                Start_Bgm = content.Load<SoundEffect>(@"Sounds\\Start");
                Start_Bgm_Instance = Start_Bgm.CreateInstance();
                Start_Bgm_Instance.IsLooped = true;

                Stage1_3_Bgm = content.Load<SoundEffect>(@"Sounds\\Stage1_3");
                Stage1_3_Bgm_Instance = Stage1_3_Bgm.CreateInstance();
                Stage1_3_Bgm_Instance.IsLooped = true;

                Stage4_6_Bgm = content.Load<SoundEffect>(@"Sounds\\Stage4_6");
                Stage4_6_Bgm_Instance = Stage4_6_Bgm.CreateInstance();
                Stage4_6_Bgm_Instance.IsLooped = true;

                playerShot = content.Load<SoundEffect>(@"Sounds\\Shot1");
                enemyShot = content.Load<SoundEffect>(@"Sounds\\Shot2");

                enemy3Shot = content.Load<SoundEffect>(@"Sounds\\Explosion1");
                Enemy6_pattern1 = content.Load<SoundEffect>(@"Sounds\\Enemy6_pattern1");
                Enemy6_pattern1_2 = content.Load<SoundEffect>(@"Sounds\\Enemy6_pattern1_2");
                for (int x = 1; x <= explosionCount; x++)
                {
                    explosions.Add(content.Load<SoundEffect>(@"sounds\Explosion" + x.ToString()));
                }
            }
            catch
            {
                Debug.Write("SoundManager Initialization Failed");
            }
        }
开发者ID:jeongdujin,项目名称:TimeRunRPG,代码行数:33,代码来源:SoundManager.cs


示例12: Initialize

        public static void Initialize(ContentManager content)
        {
            scream = content.Load<SoundEffect>("Assets/Sounds/deathScream");
            collectSound = content.Load<SoundEffect>("Assets/Sounds/itemCollect");
            checkpointHell = content.Load<SoundEffect>("Assets/Sounds/CheckpointHell");
            checkpointCrystal = content.Load<SoundEffect>("Assets/Sounds/CheckpointCristall");
            fireball = content.Load<SoundEffect>("Assets/Sounds/Fireball");
            freezingIce = content.Load<SoundEffect>("Assets/Sounds/freezingIce");
            whip = content.Load<SoundEffect>("Assets/Sounds/whip");
            laser = content.Load<SoundEffect>("Assets/Sounds/laser");
            SeraphinScream = content.Load<SoundEffect>("Assets/Sounds/SeraphinScream");
            thunder = content.Load<SoundEffect>("Assets/Sounds/thunder");
            spear = content.Load<SoundEffect>("Assets/Sounds/spear");
            claws = content.Load<SoundEffect>("Assets/Sounds/claws");
            mainMenu = content.Load<SoundEffect>("Assets/Sounds/mainMenu");
            menu = mainMenu.CreateInstance();
            menu.IsLooped = true;
            punch = content.Load<SoundEffect>("Assets/Sounds/punch");
            waterSound = content.Load<SoundEffect>("Assets/Sounds/water");
            water = waterSound.CreateInstance();
            spawn = content.Load<SoundEffect>("Assets/Sounds/spawn");
            minionsFraktus = content.Load<SoundEffect>("Assets/Sounds/minions");
            goldCave = content.Load<SoundEffect>("Assets/Sounds/GoldCave");
            cave = goldCave.CreateInstance();
            //cave.IsLooped = true;

            //background crystal
            crystalBackground = content.Load<SoundEffect>("Assets/Sounds/crystalBackground");
            crystalBG = crystalBackground.CreateInstance();
            crystalBG.Volume = 0.25f;
            crystalBG.IsLooped = true;
        }
开发者ID:KleinerMensch,项目名称:CR4VE,代码行数:32,代码来源:Sounds.cs


示例13: MenuScreen

        public MenuScreen()
        {
            isActive = false;
            isHidden = true;
            canLauchChallenge = false;

            menuSound = SoundEffectLibrary.Get("cursor").CreateInstance();

            m_sprite = new Sprite(Program.TheGame, TextureLibrary.GetSpriteSheet("menu_start_bg"), m_transform);
            m_sprite.Transform.Position = outPos;
            arrow = new Sprite(Program.TheGame, TextureLibrary.GetSpriteSheet("arrow"), new Transform(m_transform, true));

            moveTo = new MoveToStaticAction(Program.TheGame, m_transform, inPos, 1);
            moveTo.StartPosition = new Vector2(80, 200);
            moveTo.Interpolator = new PSmoothstepInterpolation();
            moveTo.Timer.Interval = 0.5f;

            moveOut = new MoveToStaticAction(Program.TheGame, m_transform, outPos, 1);
            moveOut.StartPosition = inPos;
            moveOut.Interpolator = new PSmoothstepInterpolation();
            moveOut.Timer.Interval = 0.5f;

            choice = MenuState.START;
            challengeChoice = ChallengeState.CHALL_1;
        }
开发者ID:TastyWithPasta,项目名称:GameboyJam2013,代码行数:25,代码来源:MenuScreen.cs


示例14: LoadContent

        public void LoadContent(SpriteBatch spriteBatch, ContentManager Content, Viewport viewport, 
            Camera camera, Texture2D enemyTexture, GraphicsDeviceManager graphics, 
            SoundEffect _backgroundMusic, GameController _gameController, 
            SoundEffect _fireballSound, SpriteFont _spritefont, Texture2D _bossTexture)
        {
            _enemyTexture = enemyTexture;
            this.camera = camera;
            _graphics = graphics;

            spritefont = _spritefont;

            bossTexture = _bossTexture;

            backgroundMusic = _backgroundMusic;
            fireballSound = _fireballSound;

            _content = Content;
            gameController = _gameController;
            character = Content.Load<Texture2D>("imp");
            Flame.SetTexture(Content.Load<Texture2D>("Flames"));
            
            soundEffectInstance = backgroundMusic.CreateInstance();

            onFirstLevel = false;
            onSecondLevel = false;
            onThirdLevel = false;
            onFourthLevel = false;

        }
开发者ID:KevinUd2014,项目名称:Release2KillerStory,代码行数:29,代码来源:GameController.cs


示例15: Initialize

        public override void Initialize(ContentManager content, Vector2 position, Loot theLoot, Wave theWave)
        {
            parachuteRip = (content.Load<SoundEffect>("Music\\Rip.wav")).CreateInstance();
            FlyingTexture = content.Load<Texture2D>("Graphics\\ParachuteEnemy");
            /*
            EnemyDeathTexture = content.Load<Texture2D>("Graphics\\Enemy1Dead");
            FiringTexture = content.Load<Texture2D>("Graphics\\Enemy1Firing");

            EnemyTextureMap = new AnimatedSprite(content.Load<Texture2D>("Graphics\\Enemy1Map"), numMapRows, numMapColumns, animationSpeed);
            speed = E1Speed;
            base.Initialize(content, position, theLoot, theWave);
             * */

            base.Initialize(content, position, theLoot, theWave);

            if (inSky)
            {
                if (position.X < 0)
                {
                    speed *= 2;
                    Position = new Vector2(100, -75);
                }
                else
                {
                    speed *= 2;
                    Position = new Vector2(650, -75);
                }
            }
        }
开发者ID:pel5xq,项目名称:InFoxholesGame,代码行数:29,代码来源:ParachuteEnemy.cs


示例16: Player

        /// <summary>
        /// The parameterized constructor for the player class
        /// </summary>
        /// <param name="pTexture">The texture that the player will use</param>
        /// <param name="g">The GraphicsDeviceManager that will be used</param>
        public Player(Texture2D pTexture, GraphicsDeviceManager gdm, World w, Texture2D fTexture)
        {
            //Load the texture and set the vectors
            graphic = gdm;
            screenWidth = gdm.PreferredBackBufferWidth;
            screenHeight = gdm.PreferredBackBufferHeight;
            position = new Vector2(150, 50);
            body = new Rectangle((int)position.X, (int)position.Y, 50, 50);
            //TODO: add content manager

            burning = w.game.Content.Load<SoundEffect>("Audio/WAVs/fire");
            burning2 = burning.CreateInstance();

            texture = pTexture;
            flameTexture = fTexture;
            velocity = new Vector2(0, 0);
            world = w;
            world.Player = this;
            //Set the player state
            hState = HorizontalState.standing;

            //Make an array of three torches
            torches = new Torch[999];
            for (int i = 0; i < torches.Length; i++)
            {
                torches[i] = new Torch(this, fTexture, w);
            }
        }
开发者ID:jewinemiller,项目名称:Leap,代码行数:33,代码来源:Player.cs


示例17: Box

        public Box(SpriteBatch batch, ContentManager manager, int type, Point position)
            : base(batch, manager, "sprites/box")
        {
            FrameAnimation anim = new FrameAnimation(3, 16, 16, 0, 0);
            anim.FramesPerSecond = 6;
            animations.Add("box1", anim);
            anim = new FrameAnimation(1, 16, 16, 48, 0);
            anim.FramesPerSecond = 1;
            animations.Add("box2", anim);

            CurrentAnimationName = "box1";
            this.position = position;

            this.batch = batch;
            this.manager = manager;

            SoundEffect tmp;
            if (type == 1)
            {
                tmp = manager.Load<SoundEffect>("sounds/coin");
            }
            else
            {
                tmp = manager.Load<SoundEffect>("sounds/powerupa");
            }
            this.type = type;
            if (type == 4)
                visable = false;

            sound1 = tmp.CreateInstance();
            tmp = manager.Load<SoundEffect>("sounds/bump");
            sound2 = tmp.CreateInstance();
        }
开发者ID:kinder112,项目名称:Yami,代码行数:33,代码来源:Box.cs


示例18: SmallMarioJumpEffect

 public SmallMarioJumpEffect()
 {
     backgroundSoundEffect = SoundEffect.FromStream(backgroundSoundFile);
     instance = backgroundSoundEffect.CreateInstance();
     instance.Volume = 0.25f;
     instance.IsLooped = false;
 }
开发者ID:Bartholomew-m134,项目名称:BuckeyeGameEngine,代码行数:7,代码来源:SmallMarioJumpEffect.cs


示例19: ParticleSystem

        public ParticleSystem(Game game, Player player, bool isSand = false)
            : base(game)
        {
            DrawOrder = 50;
            Player = player;
            Particles = new Dictionary<string, Particle>(1000);
            IsSand = isSand;
            _particleQueue = new HashSet<Particle>();
            _createParticleQueue = new HashSet<Particle>();

            if(IsSand)
            {
                _fireParticles = new ParticleSystem(Game, Player);

                Children.Add(_fireParticles);

                _burningSound = Storage.Sound("SandBurning").CreateInstance();
                _burningSound.Volume = 0.0f;
                _burningSound.IsLooped = true;
                _burningSound.Play();

                _updateRemoteSandTimer = new Animation { CompletedDelegate = UpdateRemoteSand };
                _updateRemoteSandTimerGroup = new AnimationGroup(_updateRemoteSandTimer, 60) { Loops = true };

                Storage.AnimationController.AddGroup(_updateRemoteSandTimerGroup);
            }
        }
开发者ID:hortont424,项目名称:sand,代码行数:27,代码来源:ParticleSystem.cs


示例20: AmbientToggle

        protected void AmbientToggle(KeyboardState currentKeyboardState, GamePadState currentGamePadState)
        {
            // toggle Ambient - Night/Day effect
            if (previousKeyboardState.IsKeyDown(Keys.E) &&
                currentKeyboardState.IsKeyUp(Keys.E) ||
                previousGamePadState.IsButtonDown(Buttons.RightShoulder) &&
                currentGamePadState.IsButtonUp(Buttons.RightShoulder))
            {
                ambient = !ambient;

                currentMusic.Stop();
                currentMusic.Dispose();

                // Ambient true sets to day time effect, false sets to night time effect
                if(ambient)
                {
                    skyColor = Color.DeepSkyBlue;
                    effect.Parameters["material"].StructureMembers["ambient"].SetValue(new Vector4(0.65f, 0.65f, 0.6f, 1.0f));
                    currentMusic = musicDay.CreateInstance();

                }
                else
                {
                    skyColor = Color.DarkSlateGray;
                    effect.Parameters["material"].StructureMembers["ambient"].SetValue(new Vector4(0.1f, 0.1f, 0.15f, 1.0f));
                    currentMusic = musicNight.CreateInstance();
                }
                enemy.Apply3DAudio(listener, enemy.Position, currentMusic);
                currentMusic.Play();

            }
        }
开发者ID:jsquare89,项目名称:MazeGame,代码行数:32,代码来源:MazeGame.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C# Audio.WaveBank类代码示例发布时间:2022-05-26
下一篇:
C# Audio.SoundEffect类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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