Represents a loaded sound resource.

A SoundEffect represents the buffer used to hold audio data and metadata. SoundEffectInstances are used to play from SoundEffects. Multiple SoundEffectinstance objects can be created and played from the same SoundEffect object.

The only limit on the number of loaded SoundEffects is restricted by available memory. When a SoundEffect is disposed, all SoundEffectInstances created from it will become invalid.

SoundEffect.Play() can be used for 'fire and forget' sounds. If advanced playback controls like volume or pitch is required, use SoundEffect.CreateInstance().

Inheritance: IDisposable
Exemplo n.º 1
0
        private const int MOVESPEED = 5; // The movement speed of the character

        #endregion Fields

        #region Constructors

        public Player(Texture2D texture, Rectangle form, SoundEffect sound, int health)
        {
            this.texture = texture;
            this.form = form;
            this.sound = sound;
            this.health = health;
        }
Exemplo n.º 2
0
        protected override void LoadContent()
        {
            this.font = content.Load<SpriteFont>("ConsoleFont");

            this.placeHolder = content.Load<Texture2D>("Instructions");
            this.spriteTexture = content.Load<Texture2D>("SpriteMarker");
            this.roundMusic = content.Load<Song>("music_game");
            this.waitMusic = content.Load<Song>("music_waiting_loop");

            NewHigh = content.Load<SoundEffect>("new_highscore");
            EndRound = content.Load<SoundEffect>("game_end");

            timeInstructionsStayAround = 10;

            MediaPlayer.Play(roundMusic);
            MediaPlayer.Volume = .3f;
            MediaPlayer.IsRepeating = true;          

            this.FirstRoundStartHasStarted = this.firstRoundOver = false;
            this.HasStartedRound = false;

            this.highScore = 0;

            if (!Lanko_And_Glub.utility.ShowInstructions)
                this.instructionsColor = new Color(0, 0, 0, 0);
            else
                this.instructionsColor = Color.White;

            this.scale = 0;

            this.fontScale = 1f;
            this.fontColor = timerColor = Color.White;

            base.LoadContent();
        }
Exemplo n.º 3
0
 public Sound(string _name, SoundEffect _soundEffect, bool _focus)
 {
     soundEffect = _soundEffect;
     focus = _focus;
     name = _name;
     soundInstance = null;
 }
Exemplo n.º 4
0
		/// <summary>
		/// LoadContent will be called once per game and is the place to load
		/// all of your content.
		/// </summary>
		protected override void LoadContent ()
		{
			// Create a new SpriteBatch, which can be used to draw textures.
			spriteBatch = new SpriteBatch (GraphicsDevice);

			//TODO: use this.Content to load your game content here
			monkey = Content.Load<Texture2D> ("monkey");
			background = Content.Load <Texture2D> ("background");
			logo = Content.Load<Texture2D> ("logo");
			font = Content.Load<SpriteFont> ("font");
			hit = Content.Load<SoundEffect> ("hit");
			title = Content.Load<Song> ("title");
			Microsoft.Xna.Framework.Media.MediaPlayer.IsRepeating = true;
			Microsoft.Xna.Framework.Media.MediaPlayer.Play (title);

			var viewport = graphics.GraphicsDevice.Viewport;
			var padding = (viewport.Width / 100);
			var gridWidth = (viewport.Width - (padding * 5)) / 4;
			var gridHeight = gridWidth;

			for (int y = padding; y < gridHeight*5; y+=gridHeight+padding) {
				for (int x = padding; x < viewport.Width-gridWidth; x+=gridWidth+padding) {
					grid.Add (new GridCell () {
						DisplayRectangle = new Rectangle (x, y, gridWidth, gridHeight)
					});
				}
			}
		}
 public SmallMarioJumpEffect()
 {
     backgroundSoundEffect = SoundEffect.FromStream(backgroundSoundFile);
     instance = backgroundSoundEffect.CreateInstance();
     instance.Volume = 0.25f;
     instance.IsLooped = false;
 }
Exemplo n.º 6
0
        /// <summary>
        /// Creates a new instance of a LavaFighter enemy ship
        /// </summary>
        /// <param name="content">A ContentManager to load resources with</param>
        /// <param name="position">The position of the Dart ship in the game world</param>
        public LavaFighter(uint id, ContentManager content, Vector2 position)
            : base(id)
        {
            this.position = position;
            this.Score = 18;

            spritesheet = content.Load<Texture2D>("Spritesheets/newshe.shp.000000");
            bulletFired = content.Load<SoundEffect>("SFX/gamalaser");

            spriteBounds[(int)LavaFighterSteeringState.Left].X = 76;
            spriteBounds[(int)LavaFighterSteeringState.Left].Y = 197;
            spriteBounds[(int)LavaFighterSteeringState.Left].Width = 20;
            spriteBounds[(int)LavaFighterSteeringState.Left].Height = 28;

            spriteBounds[(int)LavaFighterSteeringState.Straight].X = 51;
            spriteBounds[(int)LavaFighterSteeringState.Straight].Y = 197;
            spriteBounds[(int)LavaFighterSteeringState.Straight].Width = 20;
            spriteBounds[(int)LavaFighterSteeringState.Straight].Height = 28;

            spriteBounds[(int)LavaFighterSteeringState.Right].X = 28;
            spriteBounds[(int)LavaFighterSteeringState.Right].Y = 197;
            spriteBounds[(int)LavaFighterSteeringState.Right].Width = 20;
            spriteBounds[(int)LavaFighterSteeringState.Right].Height = 28;

            steeringState = LavaFighterSteeringState.Straight;
        }
        /// <summary>
        /// Constructor.
        /// </summary>
        public StateMainMenuCredits() 
            : base()
        {
            mFxMenuSelect = GameObjectManager.pInstance.pContentManager.Load<SoundEffect>("Audio\\FX\\MenuSelect");

            mSetStateMsg = new FiniteStateMachine.SetStateMessage();
        }
Exemplo n.º 8
0
        public CapturePoint()
        {
            Immovable = true;
            this.AddCollisionGroup("capturePoint");
            this.Collidable = true;
            LoadTexture(Controller.Content.Load<Texture2D>("images/CapturePoint"), 128, 96);
            AddAnimation("uncaptured", new int[2] { 0 ,0 }, 0);
            AddAnimation("captured", new int[2] { 1, 1 }, 0);

            this.BloodParticles = new ParticleEngine(Controller.Content.Load<ParticleEffect>("bloodParticle"));
            state.AddChild(this.BloodParticles);
            this.BloodParticles.Position = this.Position;
            this.BloodParticles.Start();

            this.GlowTexture = Controller.Content.Load<Texture2D>("glow");
            CreateTakingOverRectangle();
            AddAnimation("p1uncaptured", new int[1] { 0 }, 0);
            AddAnimation("p1captured", new int[3] { 1, 2, 3 },0.5f);
            AddAnimation("p2uncaptured", new int[1] { 0 }, 0);
            AddAnimation("p2captured", new int[3] { 4, 5, 6 }, 0.5f);
            AddAnimation("p3uncaptured", new int[1] { 0 }, 0);
            AddAnimation("p3captured", new int[3] { 7, 8, 9 }, 0.5f);
            AddAnimation("p4uncaptured", new int[1] { 0 }, 0);
            AddAnimation("p4captured", new int[3] { 10, 11, 12 }, 0.5f);

            soundTakeOver = Controller.Content.Load<SoundEffect>("sounds/takeOver");
            soundTaken = Controller.Content.Load<SoundEffect>("sounds/winCapture");
        }
Exemplo n.º 9
0
        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;
        }
Exemplo n.º 10
0
        public cChampBtn(Texture2D newTexture, SoundEffect newSound, GraphicsDevice graphics)
        {
            texture = newTexture;
            sound = newSound;


       }
        public View(GraphicsDeviceManager a_manager, ContentManager a_contentLoader)
        {
            //this is needed to draw sprites
            m_spriteBatch = new SpriteBatch(a_manager.GraphicsDevice);

            //Load content
            m_tileTexture = a_contentLoader.Load<Texture2D>("FinalTiles5");
            m_playerTexture = a_contentLoader.Load<Texture2D>("WalkingSquare");
            m_playerTextureLeft = a_contentLoader.Load<Texture2D>("player2left");
            m_enemyTexture = a_contentLoader.Load<Texture2D>("Enemy2");

            m_smokeTexture = a_contentLoader.Load<Texture2D>("smoke1");
            m_backgroundTexture = a_contentLoader.Load<Texture2D>("LimboFinal");

            m_jumpSound = a_contentLoader.Load<SoundEffect>("14");
            m_pointSound = a_contentLoader.Load<SoundEffect>("7");
               m_deathSound = a_contentLoader.Load<SoundEffect>("8");

            m_textfont = a_contentLoader.Load<SpriteFont>("Font");

            Moonchild =a_contentLoader.Load<Song>("3");

            MediaPlayer.IsRepeating = true;
            MediaPlayer.Volume = 0.3f;
            SoundEffect.MasterVolume = 0.6f;

            if (!songstart)
            {
                MediaPlayer.Play(Moonchild);

                songstart = true;

            }
        }
Exemplo n.º 12
0
        public Gun(Texture2D[] inputTexture, SoundEffect inputZap)
        {
            // Gun's textures.
            textureHolding = inputTexture;
            gunTexture = inputTexture[0];
            borderTexture = inputTexture[2];
            // Munitions-in-flight.
            BULLETS = new List<Bullet>();
            // Offset for animation rotation.
            rotationOffset = new Vector2(17.5F, 9);
            // Width and height of the gun's sprite.
            frameWidth = 35;
            frameHeight = 18;
            // Color, rotation, and effects.
            color = Color.White;
            rotation = 0;
            effects = SpriteEffects.None;
            // Where do you want the gun placed relative to the vector it is attached too?
            placementXOffset = 15;
            placementYOffset = 35;
            // Zap sound effect.
            zap = inputZap;
            animationFrame = new Rectangle(0, 0, frameWidth, frameHeight);

            mineSpawn = new Stopwatch();
        }
Exemplo n.º 13
0
        //Constructor
        public Fireball(ContentManager content, Vector2 position, int direction, MouseState ms)
        {
            this.texture = content.Load<Texture2D>(@"pictures\Fireball");
            sound = content.Load<SoundEffect>(@"music\shotgun");
            Fireball.Sound.Play(0.5f, 0.0f, 0.0f);

            if (direction == 1)
            {
                this.position = position + new Vector2(80f, 60f);
                Vector2 speed = this.CalculateSpeed(this.position, ms);
                this.speed = new Vector2(this.maxSpeed * speed.X,
                                         this.maxSpeed * speed.Y);
                this.effect = SpriteEffects.None;
            }
            else
            {
                this.position = position + new Vector2(0f, 60f);
                Vector2 speed = this.CalculateSpeed(this.position, ms);
                this.speed = new Vector2(-this.maxSpeed * speed.X,
                                         -this.maxSpeed * speed.Y);
                this.effect = SpriteEffects.FlipHorizontally;
            }
            this.destinationRect = new Rectangle((int)this.position.X, (int)this.position.Y, 25, 24);
            this.sourceRect = new Rectangle(0, 0, 50, 48);
        }
Exemplo n.º 14
0
        public GameManager(Game game, int level)
        {
            mGame = game;

            mPlayer1 = new Character(game, new Pointf(400, 200), new Size(32, 32), new Velocity(), PlayerIndex.One);
            mPlayer2 = new Character(game, new Pointf(350, 200), new Size(32, 32), new Velocity(), PlayerIndex.Two);
            mBoss = null;
            mLevel = level;
            switch (level)
            {
                case 1:
                    mMap = MapBuilder.BuildLevel1(mGame, new Size(game.Window.ClientBounds.Width, game.Window.ClientBounds.Height - Hud.HUD_HEIGHT), ref mPlayer1);
                    mPlayer1.mPosition = new Pointf(MapHelper.GetPointForColumnAndLevel(0.5f, 1));
                    mPlayer2.mPosition = new Pointf(MapHelper.GetPointForColumnAndLevel(0.5f, 1));
                    mBackgroundSong = mGame.Content.Load<Song>("music/Electrolyte - New Mission");
                    break;
                case 2:
                    mMap = MapBuilder.BuildSolo(mGame, new Size(game.Window.ClientBounds.Width, game.Window.ClientBounds.Height - Hud.HUD_HEIGHT), ref mPlayer1);
                    mPlayer1.mPosition = new Pointf(MapHelper.GetPointForColumnAndLevel(0.5f, 1));
                    mPlayer2.mPosition = new Pointf(MapHelper.GetPointForColumnAndLevel(MapHelper.GetLastColumn()-1.5f, 1));
                    mBackgroundSong = mGame.Content.Load<Song>("music/Electrolyte - Plus vs Minus");
                    break;
                case 3:
                    mMap = MapBuilder.BuildBossLevel(mGame, new Size(game.Window.ClientBounds.Width, game.Window.ClientBounds.Height - Hud.HUD_HEIGHT), ref mPlayer1);
                    mBoss = new Character(game, new Pointf(350, MapHelper.GetPlatformYAtLevel(1.5f)), new Size(64, 64), new Velocity(), PlayerIndex.Three);
                    mBackgroundSong = mGame.Content.Load<Song>("music/Electrolyte - Volt");
                    break;
            }

            mHud = new Hud(new Pointf(0, game.Window.ClientBounds.Height - Hud.HUD_HEIGHT), mGame, level);

            mIsPlayingSound = false;
            mGangnamSound = game.Content.Load<SoundEffect>("newgangnam");
            mGangnamInstance = mGangnamSound.CreateInstance();
        }
Exemplo n.º 15
0
        public Moto(ContentManager Content, GameWindow Window)
            : base(Content.Load<Texture2D>("moto"))
        {
            this.Window = Window;

            textura = Content.Load<Texture2D>("moto");

            posicao = new Vector2(200, 300);

            ronco = Content.Load<SoundEffect>("Sounds/SoundEffects/sound_effect");

            andando = new animacao();
            andando.quadro_X = 67;
            andando.quadro_Y = 47;
            andando.qtd_quadros = 3;
            andando.quadros_seg = 3;
            andando.Y = 0;

            correndo = new animacao();
            correndo.quadro_X = 67;
            correndo.quadro_Y = 47;
            correndo.qtd_quadros = 3;
            correndo.quadros_seg = 9;
            correndo.Y = 47;

            animacao_atual = correndo;
        }
Exemplo n.º 16
0
        public PinchAddNewInteraction(TapEditInteraction editInteraction, PullDownItem pullDownItem)
        {
            _editInteraction = editInteraction;
            _pullDownItem = pullDownItem;

            _popSound = SoundEffect.FromStream(Microsoft.Xna.Framework.TitleContainer.OpenStream("Sounds/pop.wav"));
        }
Exemplo n.º 17
0
        // Load Content
        public void LoadContent(ContentManager Content)
        {
            //Attacks
            attackSound = Content.Load<SoundEffect>(@"audio\attack");
            smashAttackSound = Content.Load<SoundEffect>(@"audio\smashattack");
            smashHitSound = Content.Load<SoundEffect>(@"audio\smashhit");
            shockSound = Content.Load<SoundEffect>(@"audio\shock");
            shockHitSound = Content.Load<SoundEffect>(@"audio\shockhit");
            shockSmashHitSound = Content.Load<SoundEffect>(@"audio\shocksmashhit");
            bulletSound = Content.Load<SoundEffect>(@"audio\bulletplus");
            smashBulletSound = Content.Load<SoundEffect>(@"audio\smashbullet");

            //Other
            jumpSound = Content.Load<SoundEffect>(@"audio\jump");
            doubleJumpSound = Content.Load<SoundEffect>(@"audio\doublejump");
            shieldSound = Content.Load<SoundEffect>(@"audio\shield");
            shieldBreakSound = Content.Load<SoundEffect>(@"audio\shieldbreak");
            pikaBreakSound = Content.Load<SoundEffect>(@"audio\pikabreak");
            selectSound = Content.Load <SoundEffect>(@"audio\select");
            backSelectSound = Content.Load<SoundEffect>(@"audio\menuback");
            respawnSound = Content.Load<SoundEffect>(@"audio\ballopen");
            deathCrySound = Content.Load<SoundEffect>(@"audio\deathCry");
            deathExplosionSound = Content.Load<SoundEffect>(@"audio\homerun");
            menuMusic = Content.Load<Song>(@"audio\menumusic");
            battleMusic = Content.Load<Song>(@"audio\battleMusic");
            themeMusic = Content.Load<Song>(@"audio\theme");
            danceMusic = Content.Load<Song>(@"audio\Gangnam Style");
        }
Exemplo n.º 18
0
 public XNASound(SoundEffect Sound)
 {
     sound = Sound;
     Volume = 1f;
     Pitch = 0f;
     Pan = 0f;
 }
Exemplo n.º 19
0
        public static void LoadContent(ContentManager aContent)
        {
            s_AngrySounds = new SoundEffect[] {
                aContent.Load<SoundEffect>("sound/Grumble_01"),
                aContent.Load<SoundEffect>("sound/Grumble_02"),
                aContent.Load<SoundEffect>("sound/Grumble_03"),
                aContent.Load<SoundEffect>("sound/Grumble_04"),
                aContent.Load<SoundEffect>("sound/Grumble_05"),
                aContent.Load<SoundEffect>("sound/Grumble_06"),
                aContent.Load<SoundEffect>("sound/Grumble_07"),
                aContent.Load<SoundEffect>("sound/Grumble_08"),
            };

            s_ExplodeSounds = new SoundEffect[] {
                aContent.Load<SoundEffect>("sound/Burst_01"),
                aContent.Load<SoundEffect>("sound/Burst_02")
            };

            s_NomSounds = new SoundEffect[] {
                aContent.Load<SoundEffect>("sound/Eat_01"),
                aContent.Load<SoundEffect>("sound/Eat_02"),
                aContent.Load<SoundEffect>("sound/Eat_03"),
                aContent.Load<SoundEffect>("sound/Eat_04"),
                aContent.Load<SoundEffect>("sound/Eat_05"),
                aContent.Load<SoundEffect>("sound/Eat_06")
            };

            s_PickUpSound = aContent.Load<SoundEffect>("sound/Pickup");
        }
Exemplo n.º 20
0
 public ProjectiveWeapon(Texture2D[] textureImages, Vector2 position, Point[] frameSizes,
     int collisionOffset, Point currentFrame, Point[] sheetSizes, Vector2 speed,
     SoundEffect collisionSound, float scale, int score)
     : base(textureImages, position, frameSizes, collisionOffset, currentFrame,
     sheetSizes, speed, collisionSound, scale, score)
 {
 }
        /// <summary>
        /// Initializes all the audio content.
        /// </summary>
        /// <param name="Content">The ContentManager to use</param>
        public static void Initialize(ContentManager Content)
        {
            try
            {
                // Songs
                GameplayMusic = Content.Load<Song>("audio/GameplayMusic");
                GameplayMusic2 = Content.Load<Song>("audio/GameplayMusic2");
                GameplayMusic3 = Content.Load<Song>("audio/GameplayMusic3");
                TitleMusic = Content.Load<Song>("audio/TitleMusic");
                VictoryMusic = Content.Load<Song>("audio/VictoryMusic");

                // Sound Effects
                Soldier_Attack = Content.Load<SoundEffect>("audio/Soldier_Attack");
                Soldier_Dying = Content.Load<SoundEffect>("audio/Soldier_Dying");
                Worker_Dying = Content.Load<SoundEffect>("audio/Worker_Dying");
                Worker_Attack = Content.Load<SoundEffect>("audio/Worker_Attack");
                Zombie_Dying = Content.Load<SoundEffect>("audio/Zombie_Dying");
                Zombie_Attack = Content.Load<SoundEffect>("audio/Zombie_Attack");
            }
            catch (Exception e)
            {
                audioReady = false;
            }

            MediaPlayer.Volume = 0.50f;
            MediaPlayer.IsRepeating = true;
            play("music", "title");
        }
Exemplo n.º 22
0
        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");
            }
        }
Exemplo n.º 23
0
        public Sounds(Song song1, Song song2, Song song3, SoundEffect blimpEngineSound, SoundEffect explosionSound, SoundEffect failedSound,
            Song gameStartSound, SoundEffect playerEngineSound, SoundEffect rewardSound, SoundEffect shotSound)
        {
            level1Music = song1;
            level2Music = song2;
            level3Music = song3;
            MediaPlayer.IsRepeating = true;

            blimpEngineSE = blimpEngineSound;
            blimpEngineSEI = blimpEngineSE.CreateInstance();
            blimpEngineSEI.IsLooped = true;
            blimpEngineSEI.Pitch = 0.0f;
            blimpEngineSEI.Pan = 0.0f;

            missileEngineSE = blimpEngineSound;
            missileEngineSEI = missileEngineSE.CreateInstance();
            missileEngineSEI.IsLooped = true;
            missileEngineSEI.Pitch = 1.0f;
            missileEngineSEI.Pan = 0.0f;

            playerEngineSE = playerEngineSound;
            playerEngineSEI = playerEngineSE.CreateInstance();
            playerEngineSEI.IsLooped = true;
            playerEngineSEI.Pitch = -1.0f;

            explosionSE = explosionSound;
            failedSE = failedSound;
            gameStart = gameStartSound;
            rewardSE = rewardSound;
            shotSE = shotSound;
        }
Exemplo n.º 24
0
 protected override void LoadContent()
 {
   base.LoadContent();
   this.sBegin = this.CMProvider.Global.Load<SoundEffect>("Sounds/Gomez/TeeterBegin");
   this.sMouthOpen = this.CMProvider.Global.Load<SoundEffect>("Sounds/Gomez/TeeterMouthOpen");
   this.sMouthClose = this.CMProvider.Global.Load<SoundEffect>("Sounds/Gomez/TeeterMouthClose");
 }
        public static void LoadContent()
        {
            for (int i = 0; i < cry.Length; i++)
            {
                cry[i] = c.Load<SoundEffect>("Sound\\cry" + i.ToString());
            }
            swoosh = c.Load<SoundEffect>("Sound\\swoosh");
            shake = c.Load<SoundEffect>("Sound\\shake");
            gun = c.Load<SoundEffect>("Sound\\gun");
            spring = c.Load<SoundEffect>("Sound\\spring");
            run = c.Load<SoundEffect>("Sound\\run");
            reload = c.Load<SoundEffect>("Sound\\reload");
            enemyDeath = c.Load<SoundEffect>("Sound\\zombie-death");
            spawn = c.Load<SoundEffect>("Sound\\spawn");
            spawn2 = c.Load<SoundEffect>("Sound\\spawn2");
            coin = c.Load<SoundEffect>("Sound\\coin");
            explosion1 = c.Load<SoundEffect>("Sound\\explode1");
            explosion2 = c.Load<SoundEffect>("Sound\\explode2");
            ladder = c.Load<SoundEffect>("Sound\\ladder");
            catchBaby = c.Load<SoundEffect>("Sound\\smack");
            slice = c.Load<SoundEffect>("Sound\\slice");
            banshee = c.Load<SoundEffect>("Sound\\banshee");

            LoadInstances();
        }
 public void LoadSounds()
 {
     gun = content.Load<SoundEffect>("gunsound1");
     magnumSound = content.Load<SoundEffect>("MagnumSound");
     ExtinguisherSound = content.Load<SoundEffect>("ExtinguisherSound");
     SilencerSound = content.Load<SoundEffect>("SilencerSound");
 }
Exemplo n.º 27
0
        public PostGameState( int score ) : base()
        {
            m_heading = content.Load<Texture2D>("Images/GameOverTitle");
            m_backgroundSprite = content.Load<Texture2D>("Images/MenuBackground");
            m_indicator = content.Load<Texture2D>("Images/LeftSelector");
            m_scoresText = content.Load<Texture2D>("Images/ScoreText");
            m_nameText = content.Load<Texture2D>("Images/NameText");
            m_acceptText = content.Load<Texture2D>("Images/AcceptText");

            m_indicatorLeftPosition = new Vector2(412, 378);
            m_indicatorRightPosition = new Vector2(448, 378);

            m_blipSound = content.Load<SoundEffect>("Sounds/Blip");
            m_blipVolume = 0.1f;

            m_playerScore = score;
            m_highScoreList = new HighScoresObject();
            m_highScoreList.LoadHighScores();
            m_buttonSelected = 0;

            m_letterInt = new List<int>();
            m_letterInt.Add(0);
            m_letterInt.Add(0);
            m_letterInt.Add(0);

            m_letterString = new List<string>();
            m_letterString.Add("A");
            m_letterString.Add("A");
            m_letterString.Add("A");
        }
Exemplo n.º 28
0
        public Player(Vector3 position,
            Vector3 velocity)
        {
            mPosition = position;
            mVelocity = velocity;

            mBound = new BoundingBox(mPosition + new Vector3(-5.0f, -100.0f, -5.0f), mPosition + new Vector3(5.0f, 35.0f, 5.0f));

            mYaw   = 0.0f;
            mPitch = 0.0f;

            mPlayerCamera = new Camera(mPosition, Quaternion.CreateFromAxisAngle(Vector3.Up, mYaw));

            // Start Player with 3 Stones.
            mBackpack.Clear();
            Player.AddItem("Stone");
            Player.AdjustQuantity("Stone", 2);

            m_rumble_start  = 150.0f;
            m_rumble_finish = 150.0f;
            m_prev_time     = 0.0f;
            m_time          = 0.0f;

            mFinishJump = SoundMaster.GetSound("jump_thud");
            mThrowStone = SoundMaster.GetSound("throw_sound");
        }
Exemplo n.º 29
0
 public EpicGun(Vector2 size_window, RTGame rtgame, Boolean ennemyermainplayer)
     : base(size_window, rtgame, ennemyermainplayer)
 {
     NomArme = "Epic Gun";
     color = Color.White;
     explosionSound = rtgame.content.Load<SoundEffect>("Sounds/bomb");
 }
Exemplo n.º 30
0
 internal SoundEffect(XnaSoundEffect effect)
 {
     this.Position  = new DoubleMeter(0, 0, 0);
     this.assetName = null;
     xnaEffect      = effect;
     InitPosition();
 }
Exemplo n.º 31
0
 //Modular Constructor
 public SoundObject(SoundEffect target, Vector2 posn)
 {
     this.sound = target;
     this.position = posn;
     this.isModular = true;
     this.dynamic = sound.CreateInstance();
 }
Exemplo n.º 32
0
        private XnaSoundEffect FromContent(string assetname)
        {
            assetName = Game.FileExtensionCheck(assetName, soundExtensions);
            FileStream     fs    = new FileStream(assetName, FileMode.Open);
            XnaSoundEffect sound = XnaSoundEffect.FromStream(fs);

            fs.Close();
            return(sound);
        }
Exemplo n.º 33
0
        private void DoLoad()
        {
            if (xnaEffect == null)
            {
                Debug.Assert(assetName != null);
                xnaEffect = FromContent(assetName);
            }

            Position.MaxValue = xnaEffect.Duration.TotalSeconds;
        }
Exemplo n.º 34
0
    private static SoundEffect LoadSoundEffectFromFile(string wavPath)
    {
        SoundEffect jypeliSoundEffect = null;

        FileStream   fs     = new FileStream(wavPath, FileMode.Open, FileAccess.Read);
        BinaryReader reader = new BinaryReader(fs);

        //Read the wave file header from the buffer. (COPY/PASTE from MSDN)
        int chunkID       = reader.ReadInt32();
        int fileSize      = reader.ReadInt32();
        int riffType      = reader.ReadInt32();
        int fmtID         = reader.ReadInt32();
        int fmtSize       = reader.ReadInt32();
        int fmtCode       = reader.ReadInt16();
        int channels      = reader.ReadInt16();
        int sampleRate    = reader.ReadInt32();
        int fmtAvgBPS     = reader.ReadInt32();
        int fmtBlockAlign = reader.ReadInt16();
        int bitDepth      = reader.ReadInt16();

        if (fmtSize == 18)
        {
            // Read any extra values
            int fmtExtraSize = reader.ReadInt16();
            reader.ReadBytes(fmtExtraSize);
        }

        int dataID   = reader.ReadInt32();
        int dataSize = reader.ReadInt32();

        // Read the data
        byte[] byteArray = reader.ReadBytes(dataSize);

        // Create the SoundEffect from the Stream
        XnaSoundEffect xnaSE = new XnaSoundEffect(byteArray, sampleRate, (AudioChannels)channels);

        // The needed constructor of Jypeli.SoundEffect is internal, so we cant simply do this:
        //SoundEffect sound = new SoundEffect( xnaSE );
        // instead we have to do this:
        jypeliSoundEffect =
            (SoundEffect)(Activator.CreateInstance(typeof(SoundEffect),
                                                   BindingFlags.NonPublic | BindingFlags.Instance,
                                                   null, new object[] { xnaSE }, null));

        return(jypeliSoundEffect);
    }
        public static void VibrationSound()
        {
            //consider writing the bit that makes the text flash
            Microsoft.Xna.Framework.Audio.SoundEffect sound = SoundEffect.FromStream(TitleContainer.OpenStream("Assets/sound.wav"));

            AppSettings settings = new AppSettings();

            if (settings.ToggleSwitchVibration)
            {
                Microsoft.Devices.VibrateController testVibrateController = Microsoft.Devices.VibrateController.Default;
                testVibrateController.Start(TimeSpan.FromSeconds(3));
            }
            if (settings.ToggleSwitchSound)
            {
                FrameworkDispatcher.Update();
                sound.Play();
            }
        }
Exemplo n.º 36
0
        /// <param name="audioEngine">Instance of the AudioEngine to associate this wave bank with.</param>
        /// <param name="nonStreamingWaveBankFilename">Path to the .xwb file to load.</param>
        /// <remarks>This constructor immediately loads all wave data into memory at once.</remarks>
        public WaveBank(AudioEngine audioEngine, string nonStreamingWaveBankFilename)
        {
            //XWB PARSING
            //Adapted from MonoXNA
            //Originally adaped from Luigi Auriemma's unxwb

            WaveBankHeader wavebankheader;
            WaveBankData   wavebankdata;
            WaveBankEntry  wavebankentry;

            wavebankdata.EntryNameElementSize = 0;
            wavebankdata.CompactFormat        = 0;
            wavebankdata.Alignment            = 0;
            wavebankdata.BuildTime            = 0;

            wavebankentry.Format            = 0;
            wavebankentry.PlayRegion.Length = 0;
            wavebankentry.PlayRegion.Offset = 0;

            int wavebank_offset = 0;

            nonStreamingWaveBankFilename = FileHelpers.NormalizeFilePathSeparators(nonStreamingWaveBankFilename);

#if !ANDROID
            BinaryReader reader = new BinaryReader(TitleContainer.OpenStream(nonStreamingWaveBankFilename));
#else
            Stream       stream = Game.Activity.Assets.Open(nonStreamingWaveBankFilename);
            MemoryStream ms     = new MemoryStream();
            stream.CopyTo(ms);
            stream.Close();
            ms.Position = 0;
            BinaryReader reader = new BinaryReader(ms);
#endif
            reader.ReadBytes(4);

            wavebankheader.Version = reader.ReadInt32();

            int last_segment = 4;
            //if (wavebankheader.Version == 1) goto WAVEBANKDATA;
            if (wavebankheader.Version <= 3)
            {
                last_segment = 3;
            }
            if (wavebankheader.Version >= 42)
            {
                reader.ReadInt32();                                  // skip HeaderVersion
            }
            wavebankheader.Segments = new Segment[5];

            for (int i = 0; i <= last_segment; i++)
            {
                wavebankheader.Segments[i].Offset = reader.ReadInt32();
                wavebankheader.Segments[i].Length = reader.ReadInt32();
            }

            reader.BaseStream.Seek(wavebankheader.Segments[0].Offset, SeekOrigin.Begin);

            //WAVEBANKDATA:

            wavebankdata.Flags      = reader.ReadInt32();
            wavebankdata.EntryCount = reader.ReadInt32();

            if ((wavebankheader.Version == 2) || (wavebankheader.Version == 3))
            {
                wavebankdata.BankName = System.Text.Encoding.UTF8.GetString(reader.ReadBytes(16), 0, 16).Replace("\0", "");
            }
            else
            {
                wavebankdata.BankName = System.Text.Encoding.UTF8.GetString(reader.ReadBytes(64), 0, 64).Replace("\0", "");
            }

            _bankName = wavebankdata.BankName;

            if (wavebankheader.Version == 1)
            {
                //wavebank_offset = (int)ftell(fd) - file_offset;
                wavebankdata.EntryMetaDataElementSize = 20;
            }
            else
            {
                wavebankdata.EntryMetaDataElementSize = reader.ReadInt32();
                wavebankdata.EntryNameElementSize     = reader.ReadInt32();
                wavebankdata.Alignment = reader.ReadInt32();
                wavebank_offset        = wavebankheader.Segments[1].Offset; //METADATASEGMENT
            }

            if ((wavebankdata.Flags & Flag_Compact) != 0)
            {
                reader.ReadInt32(); // compact_format
            }

            int playregion_offset = wavebankheader.Segments[last_segment].Offset;
            if (playregion_offset == 0)
            {
                playregion_offset =
                    wavebank_offset +
                    (wavebankdata.EntryCount * wavebankdata.EntryMetaDataElementSize);
            }

            int segidx_entry_name = 2;
            if (wavebankheader.Version >= 42)
            {
                segidx_entry_name = 3;
            }

            if ((wavebankheader.Segments[segidx_entry_name].Offset != 0) &&
                (wavebankheader.Segments[segidx_entry_name].Length != 0))
            {
                if (wavebankdata.EntryNameElementSize == -1)
                {
                    wavebankdata.EntryNameElementSize = 0;
                }
                byte[] entry_name = new byte[wavebankdata.EntryNameElementSize + 1];
                entry_name[wavebankdata.EntryNameElementSize] = 0;
            }

            _sounds = new SoundEffect[wavebankdata.EntryCount];

            for (int current_entry = 0; current_entry < wavebankdata.EntryCount; current_entry++)
            {
                reader.BaseStream.Seek(wavebank_offset, SeekOrigin.Begin);
                //SHOWFILEOFF;

                //memset(&wavebankentry, 0, sizeof(wavebankentry));
                wavebankentry.LoopRegion.Length = 0;
                wavebankentry.LoopRegion.Offset = 0;

                if ((wavebankdata.Flags & Flag_Compact) != 0)
                {
                    int len = reader.ReadInt32();
                    wavebankentry.Format            = wavebankdata.CompactFormat;
                    wavebankentry.PlayRegion.Offset = (len & ((1 << 21) - 1)) * wavebankdata.Alignment;
                    wavebankentry.PlayRegion.Length = (len >> 21) & ((1 << 11) - 1);

                    // workaround because I don't know how to handke the deviation length
                    reader.BaseStream.Seek(wavebank_offset + wavebankdata.EntryMetaDataElementSize, SeekOrigin.Begin);

                    //MYFSEEK(wavebank_offset + wavebankdata.dwEntryMetaDataElementSize); // seek to the next
                    if (current_entry == (wavebankdata.EntryCount - 1))
                    {              // the last track
                        len = wavebankheader.Segments[last_segment].Length;
                    }
                    else
                    {
                        len = ((reader.ReadInt32() & ((1 << 21) - 1)) * wavebankdata.Alignment);
                    }
                    wavebankentry.PlayRegion.Length =
                        len -                             // next offset
                        wavebankentry.PlayRegion.Offset;  // current offset
                    goto wavebank_handle;
                }

                if (wavebankheader.Version == 1)
                {
                    wavebankentry.Format            = reader.ReadInt32();
                    wavebankentry.PlayRegion.Offset = reader.ReadInt32();
                    wavebankentry.PlayRegion.Length = reader.ReadInt32();
                    wavebankentry.LoopRegion.Offset = reader.ReadInt32();
                    wavebankentry.LoopRegion.Length = reader.ReadInt32();
                }
                else
                {
                    if (wavebankdata.EntryMetaDataElementSize >= 4)
                    {
                        wavebankentry.FlagsAndDuration = reader.ReadInt32();
                    }
                    if (wavebankdata.EntryMetaDataElementSize >= 8)
                    {
                        wavebankentry.Format = reader.ReadInt32();
                    }
                    if (wavebankdata.EntryMetaDataElementSize >= 12)
                    {
                        wavebankentry.PlayRegion.Offset = reader.ReadInt32();
                    }
                    if (wavebankdata.EntryMetaDataElementSize >= 16)
                    {
                        wavebankentry.PlayRegion.Length = reader.ReadInt32();
                    }
                    if (wavebankdata.EntryMetaDataElementSize >= 20)
                    {
                        wavebankentry.LoopRegion.Offset = reader.ReadInt32();
                    }
                    if (wavebankdata.EntryMetaDataElementSize >= 24)
                    {
                        wavebankentry.LoopRegion.Length = reader.ReadInt32();
                    }
                }

                if (wavebankdata.EntryMetaDataElementSize < 24)
                {                              // work-around
                    if (wavebankentry.PlayRegion.Length != 0)
                    {
                        wavebankentry.PlayRegion.Length = wavebankheader.Segments[last_segment].Length;
                    }
                }// else if(wavebankdata.EntryMetaDataElementSize > sizeof(WaveBankEntry)) {    // skip unused fields
                //   MYFSEEK(wavebank_offset + wavebankdata.EntryMetaDataElementSize);
                //}

wavebank_handle:
                wavebank_offset += wavebankdata.EntryMetaDataElementSize;
                wavebankentry.PlayRegion.Offset += playregion_offset;

                // Parse WAVEBANKMINIWAVEFORMAT

                int codec;
                int chans;
                int rate;
                int align;
                //int bits;

                if (wavebankheader.Version == 1)
                {         // I'm not 100% sure if the following is correct
                    // version 1:
                    // 1 00000000 000101011000100010 0 001 0
                    // | |         |                 | |   |
                    // | |         |                 | |   wFormatTag
                    // | |         |                 | nChannels
                    // | |         |                 ???
                    // | |         nSamplesPerSec
                    // | wBlockAlign
                    // wBitsPerSample

                    codec = (wavebankentry.Format) & ((1 << 1) - 1);
                    chans = (wavebankentry.Format >> (1)) & ((1 << 3) - 1);
                    rate  = (wavebankentry.Format >> (1 + 3 + 1)) & ((1 << 18) - 1);
                    align = (wavebankentry.Format >> (1 + 3 + 1 + 18)) & ((1 << 8) - 1);
                    //bits = (wavebankentry.Format >> (1 + 3 + 1 + 18 + 8)) & ((1 << 1) - 1);

                    /*} else if(wavebankheader.dwVersion == 23) { // I'm not 100% sure if the following is correct
                     *  // version 23:
                     *  // 1000000000 001011101110000000 001 1
                     *  // | |        |                  |   |
                     *  // | |        |                  |   ???
                     *  // | |        |                  nChannels?
                     *  // | |        nSamplesPerSec
                     *  // | ???
                     *  // !!!UNKNOWN FORMAT!!!
                     *
                     *  //codec = -1;
                     *  //chans = (wavebankentry.Format >>  1) & ((1 <<  3) - 1);
                     *  //rate  = (wavebankentry.Format >>  4) & ((1 << 18) - 1);
                     *  //bits  = (wavebankentry.Format >> 31) & ((1 <<  1) - 1);
                     *  codec = (wavebankentry.Format                    ) & ((1 <<  1) - 1);
                     *  chans = (wavebankentry.Format >> (1)             ) & ((1 <<  3) - 1);
                     *  rate  = (wavebankentry.Format >> (1 + 3)         ) & ((1 << 18) - 1);
                     *  align = (wavebankentry.Format >> (1 + 3 + 18)    ) & ((1 <<  9) - 1);
                     *  bits  = (wavebankentry.Format >> (1 + 3 + 18 + 9)) & ((1 <<  1) - 1); */
                }
                else
                {
                    // 0 00000000 000111110100000000 010 01
                    // | |        |                  |   |
                    // | |        |                  |   wFormatTag
                    // | |        |                  nChannels
                    // | |        nSamplesPerSec
                    // | wBlockAlign
                    // wBitsPerSample

                    codec = (wavebankentry.Format) & ((1 << 2) - 1);
                    chans = (wavebankentry.Format >> (2)) & ((1 << 3) - 1);
                    rate  = (wavebankentry.Format >> (2 + 3)) & ((1 << 18) - 1);
                    align = (wavebankentry.Format >> (2 + 3 + 18)) & ((1 << 8) - 1);
                    //bits = (wavebankentry.Format >> (2 + 3 + 18 + 8)) & ((1 << 1) - 1);
                }

                reader.BaseStream.Seek(wavebankentry.PlayRegion.Offset, SeekOrigin.Begin);
                byte[] audiodata = reader.ReadBytes(wavebankentry.PlayRegion.Length);

                if (codec == MiniFormatTag_PCM)
                {
                    //write PCM data into a wav
#if DIRECTX
                    // TODO: Wouldn't storing a SoundEffectInstance like this
                    // result in the "parent" SoundEffect being garbage collected?

                    SharpDX.Multimedia.WaveFormat waveFormat = new SharpDX.Multimedia.WaveFormat(rate, chans);
                    var sfx = new SoundEffect(audiodata, 0, audiodata.Length, rate, (AudioChannels)chans, wavebankentry.LoopRegion.Offset, wavebankentry.LoopRegion.Length)
                    {
                        _format = waveFormat
                    };

                    _sounds[current_entry] = sfx;
#else
                    _sounds[current_entry] = new SoundEffect(audiodata, rate, (AudioChannels)chans);
#endif
                }
                else if (codec == MiniForamtTag_WMA)     //WMA or xWMA (or XMA2)
                {
                    byte[] wmaSig = { 0x30, 0x26, 0xb2, 0x75, 0x8e, 0x66, 0xcf, 0x11, 0xa6, 0xd9, 0x0, 0xaa, 0x0, 0x62, 0xce, 0x6c };

                    bool isWma = true;
                    for (int i = 0; i < wmaSig.Length; i++)
                    {
                        if (wmaSig[i] != audiodata[i])
                        {
                            isWma = false;
                            break;
                        }
                    }

                    //Let's support m4a data as well for convenience
                    byte[][] m4aSigs = new byte[][] {
                        new byte[] { 0x00, 0x00, 0x00, 0x18, 0x66, 0x74, 0x79, 0x70, 0x4D, 0x34, 0x41, 0x20, 0x00, 0x00, 0x02, 0x00 },
                        new byte[] { 0x00, 0x00, 0x00, 0x20, 0x66, 0x74, 0x79, 0x70, 0x4D, 0x34, 0x41, 0x20, 0x00, 0x00, 0x00, 0x00 }
                    };

                    bool isM4a = false;
                    for (int i = 0; i < m4aSigs.Length; i++)
                    {
                        byte[] sig     = m4aSigs[i];
                        bool   matches = true;
                        for (int j = 0; j < sig.Length; j++)
                        {
                            if (sig[j] != audiodata[j])
                            {
                                matches = false;
                                break;
                            }
                        }
                        if (matches)
                        {
                            isM4a = true;
                            break;
                        }
                    }

                    if (isWma || isM4a)
                    {
                        //WMA data can sometimes be played directly
#if DIRECTX
                        throw new NotImplementedException();
#elif !WINRT
                        //hack - NSSound can't play non-wav from data, we have to give a filename
                        string filename = Path.GetTempFileName();
                        if (isWma)
                        {
                            filename = filename.Replace(".tmp", ".wma");
                        }
                        else if (isM4a)
                        {
                            filename = filename.Replace(".tmp", ".m4a");
                        }
                        using (var audioFile = File.Create(filename))
                        {
                            audioFile.Write(audiodata, 0, audiodata.Length);
                            audioFile.Seek(0, SeekOrigin.Begin);

                            _sounds[current_entry] = SoundEffect.FromStream(audioFile);
                        }
#else
                        throw new NotImplementedException();
#endif
                    }
                    else
                    {
                        //An xWMA or XMA2 file. Can't be played atm :(
                        throw new NotImplementedException();
                    }
#if !DIRECTX
                    /* DirectX platforms can use XAudio2 to stream MSADPCM natively.
                     * This code is cross-platform, but the problem is that it just
                     * decodes ALL of the wavedata here. For XAudio2 in particular,
                     * this is probably ludicrous.
                     *
                     * You need to write a DIRECTX ADPCM reader that just loads this
                     * into the SoundEffect. No decoding should be necessary.
                     * -flibit
                     */
                }
                else if (codec == MiniFormatTag_ADPCM)
                {
                    using (MemoryStream dataStream = new MemoryStream(audiodata)) {
                        using (BinaryReader source = new BinaryReader(dataStream)) {
                            _sounds[current_entry] = new SoundEffect(
                                MSADPCMToPCM.MSADPCM_TO_PCM(source, (short)chans, (short)align),
                                rate,
                                (AudioChannels)chans
                                );
                        }
                    }
#endif
                }
                else
                {
                    throw new NotImplementedException();
                }
            }

            audioEngine.Wavebanks[_bankName] = this;
        }
Exemplo n.º 37
0
 public GameMusic(SoundEffect soundEffect)
 {
     _instance          = soundEffect.CreateInstance();
     _instance.IsLooped = true;
 }
Exemplo n.º 38
0
        public virtual void Play()
        {
            if (State == SoundState.Playing)
            {
                return;
            }
            if (State == SoundState.Paused)
            {
                /* Just resume the existing handle */
                FAudio.FAudioSourceVoice_Start(handle, 0, 0);
                INTERNAL_state = SoundState.Playing;
                return;
            }

            SoundEffect.FAudioContext dev = SoundEffect.Device();

            /* Create handle */
            FAudio.FAudioWaveFormatEx fmt = isDynamic ?
                                            (this as DynamicSoundEffectInstance).format :
                                            parentEffect.format;
            FAudio.FAudio_CreateSourceVoice(
                dev.Handle,
                out handle,
                ref fmt,
                FAudio.FAUDIO_VOICE_USEFILTER,
                FAudio.FAUDIO_DEFAULT_FREQ_RATIO,
                IntPtr.Zero,
                IntPtr.Zero,
                IntPtr.Zero
                );
            if (handle == IntPtr.Zero)
            {
                return;                 /* What */
            }

            /* Apply current properties */
            FAudio.FAudioVoice_SetVolume(handle, INTERNAL_volume, 0);
            UpdatePitch();
            if (is3D || Pan != 0.0f)
            {
                FAudio.FAudioVoice_SetOutputMatrix(
                    handle,
                    SoundEffect.Device().MasterVoice,
                    dspSettings.SrcChannelCount,
                    dspSettings.DstChannelCount,
                    dspSettings.pMatrixCoefficients,
                    0
                    );
            }

            /* For static effects, submit the buffer now */
            if (isDynamic)
            {
                (this as DynamicSoundEffectInstance).QueueInitialBuffers();
            }
            else
            {
                if (IsLooped)
                {
                    parentEffect.handle.LoopCount  = 255;
                    parentEffect.handle.LoopBegin  = parentEffect.loopStart;
                    parentEffect.handle.LoopLength = parentEffect.loopLength;
                }
                else
                {
                    parentEffect.handle.LoopCount  = 0;
                    parentEffect.handle.LoopBegin  = 0;
                    parentEffect.handle.LoopLength = 0;
                }
                FAudio.FAudioSourceVoice_SubmitSourceBuffer(
                    handle,
                    ref parentEffect.handle,
                    IntPtr.Zero
                    );
            }

            /* Play, finally. */
            FAudio.FAudioSourceVoice_Start(handle, 0, 0);
            INTERNAL_state = SoundState.Playing;
            hasStarted     = true;
        }
Exemplo n.º 39
0
 internal SoundEffect(string assetName)
 {
     this.assetName = assetName;
     this.xnaEffect = null;
     InitPosition();
 }