예제 #1
0
        protected override void LoadContent()
        {
            spritebatch = new SpriteBatch(GraphicsDevice);

            menuSoundEffect = GameContent.Load<SoundEffect>("Music and Sounds/Menus");
            creditsSoundEffect = GameContent.Load<SoundEffect>("Music and Sounds/Credits");
            menuSound = menuSoundEffect.Create();
            creditsSound = creditsSoundEffect.Create();
            creditsSound.IsLooped = true;
            creditsSound.Volume = vol;
            menuSound.IsLooped = true;
            menuSound.Volume = vol;
            currentSound = creditsSound;
            currentSound.Play();
            GameState = GameStates.MainMenu;

            base.LoadContent();
        }
예제 #2
0
        private void PlayAudio3D()
        {
            if (play3D)
                return;

            EnableSpatialAudioWithReverb();

            listener = Matrix.LookAtRH(Vector3.Zero, new Vector3(0, 0, 8), Vector3.Up);
            listenerVelocity = Vector3.Zero;

            emitter = Matrix.LookAtRH(new Vector3(0, 0, 8), Vector3.Zero, Vector3.Up);
            emitterVelocity = Vector3.Zero;

            audio3DEffectInstance = waveBank.Create("PewPew");
            audio3DEffectInstance.IsLooped = true;
            audio3DEffectInstance.Apply3D(listener, listenerVelocity, emitter, emitterVelocity);
            audio3DEffectInstance.Play();
            play3D = true;
        }