コード例 #1
0
        private void PlatformApply3D(AudioListener listener, AudioEmitter emitter)
        {
            // If we have no voice then nothing to do.
            if (_voice == null)
                return;

            // Convert from XNA Emitter to a SharpDX Emitter
            var e = emitter.ToEmitter();
            e.CurveDistanceScaler = SoundEffect.DistanceScale;
            e.DopplerScaler = SoundEffect.DopplerScale;
            e.ChannelCount = _effect._format.Channels;

            // Convert from XNA Listener to a SharpDX Listener
            var l = listener.ToListener();

            // Number of channels in the sound being played.
            // Not actually sure if XNA supported 3D attenuation of sterio sounds, but X3DAudio does.
            var srcChannelCount = _effect._format.Channels;

            // Number of output channels.
            var dstChannelCount = SoundEffect.MasterVoice.VoiceDetails.InputChannelCount;

            // XNA supports distance attenuation and doppler.            
            var dpsSettings = SoundEffect.Device3D.Calculate(l, e, CalculateFlags.Matrix | CalculateFlags.Doppler, srcChannelCount, dstChannelCount);

            // Apply Volume settings (from distance attenuation) ...
            _voice.SetOutputMatrix(SoundEffect.MasterVoice, srcChannelCount, dstChannelCount, dpsSettings.MatrixCoefficients, 0);

            // Apply Pitch settings (from doppler) ...
            _voice.SetFrequencyRatio(dpsSettings.DopplerFactor);
        }
コード例 #2
0
ファイル: Audio.cs プロジェクト: bradleat/trafps
 public void Apply3DPosition(Cue cue, AudioListener listener, AudioEmitter emitter,
     Vector3 listenerPosition, Vector3 emitterPosition)
 {
     listenerPosition = listener.Position;
     emitterPosition = emitter.Position;
     cue.Apply3D(listener, emitter);
 }
コード例 #3
0
ファイル: SoundManager.cs プロジェクト: JacopoV/Tap---Conquer
        public SoundManager(ContentManager content)
        {
            //gameState = content.ServiceProvider.GetService(typeof(GameState)) as GameState;
            stateGame = content.ServiceProvider.GetService(typeof(StateGame)) as StateGame;
            renderingState = content.ServiceProvider.GetService(typeof(RenderingState)) as RenderingState;
            selection = content.Load<SoundEffect>("Sounds/select");
            explosion = content.Load<SoundEffect>("Sounds/explosion2");
            laser = content.Load<SoundEffect>("Sounds/laser");

            cameraListener = new AudioListener();
            cameraListener.Position =
                new Vector3(
                    renderingState.spriteBatch.GraphicsDevice.Viewport.Width / 2,
                    renderingState.spriteBatch.GraphicsDevice.Viewport.Height / 2,
                    0);

            explosionEmitter = new List<AudioEmitter>();
            explosionInstance = new List<SoundEffectInstance>();
            explosionPos = new List<Vector3>();

            laserEmitter = new List<AudioEmitter>();
            laserInstance = new List<SoundEffectInstance>();
            laserPos = new List<Vector3>();

            isSoundActive = true;
        }
コード例 #4
0
ファイル: SoundManager.cs プロジェクト: gabry90/BIOXFramework
 public SoundManager(Game game)
     : base(game)
 {
     _sounds = new List<AudioSound>();
     _listener = new AudioListener();
     _emitter = new AudioEmitter();
 }
コード例 #5
0
ファイル: SharpDXHelper.cs プロジェクト: Damian666/blasters
        static public SharpDX.X3DAudio.Listener ToListener(this Audio.AudioListener listener)
        {
            // Pulling out Vector properties for efficiency.
            var pos     = listener.Position;
            var vel     = listener.Velocity;
            var forward = listener.Forward;
            var up      = listener.Up;

            // From MSDN:
            //  X3DAudio uses a left-handed Cartesian coordinate system,
            //  with values on the x-axis increasing from left to right, on the y-axis from bottom to top,
            //  and on the z-axis from near to far.
            //  Azimuths are measured clockwise from a given reference direction.
            //
            // From MSDN:
            //  The XNA Framework uses a right-handed coordinate system,
            //  with the positive z-axis pointing toward the observer when the positive x-axis is pointing to the right,
            //  and the positive y-axis is pointing up.
            //
            // Programmer Notes:
            //  According to this description the z-axis (forward vector) is inverted between these two coordinate systems.
            //  Therefore, we need to negate the z component of any position/velocity values, and negate any forward vectors.

            forward *= -1.0f;
            pos.Z   *= -1.0f;
            vel.Z   *= -1.0f;

            return(new SharpDX.X3DAudio.Listener()
            {
                Position = new SharpDX.Vector3(pos.X, pos.Y, pos.Z),
                Velocity = new SharpDX.Vector3(vel.X, vel.Y, vel.Z),
                OrientFront = new SharpDX.Vector3(forward.X, forward.Y, forward.Z),
                OrientTop = new SharpDX.Vector3(up.X, up.Y, up.Z),
            });
        }
コード例 #6
0
ファイル: MainGame.cs プロジェクト: babaq/StiLib
        /// <summary>
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        protected override void Initialize()
        {
            base.Initialize();

            frameinfo = new FrameInfo();
            text = new Text(GraphicsDevice, Services, "Content", "Arial");
            model = new SLModel(GraphicsDevice, Services, "Content", "earth");
            model.Para.BasePara.space = 200;
            model.Para.BasePara.speed3D = Vector3.Backward * 3f;
            model.Para.BasePara.rotationspeed3D = Vector3.UnitY * 0.3f;
            model.ProjectionType = ProjectionType.Perspective;
            model.globalCamera.Position = Vector3.UnitZ * 200;
            model.globalCamera.NearPlane = 1.0f;
            model.globalCamera.FarPlane = 1000f;

            audio = new SLAudio(SLConfig["content"] + "StiLib", SLConfig["content"] + "SLMWB", SLConfig["content"] + "SLSWB", SLConfig["content"] + "SLSB");
            audiolistener = new AudioListener()
                                {
                                    Forward = model.globalCamera.Direction,
                                    Position = model.globalCamera.Position,
                                    Up = model.globalCamera.Up,
                                    Velocity = Vector3.Zero
                                };
            audio.Listeners.Add(audiolistener);
            audioemitter = new AudioEmitter()
                               {
                                   DopplerScale = 1.0f,
                                   Forward = Vector3.Forward,
                                   Position = model.BasePara.center,
                                   Up = Vector3.Up,
                                   Velocity = model.BasePara.speed3D
                               };
            //audio.Update();
            audio.Play("Buzz", audioemitter);
        }
コード例 #7
0
ファイル: AudioManager.cs プロジェクト: Hamsand/Swf2XNA
 public Cue PlaySound(string soundName, AudioListener audioListener, AudioEmitter audioEmitter)
 {
     Cue result = GetCue(soundName);
     result.Apply3D(audioListener, audioEmitter);
     result.Play();
     return result;
 }
コード例 #8
0
 public CameraController(Game game, CarActor carActor)
     : base(game)
 {
     this.carActor_ = carActor;
     cameraState_ = new LinkedList<CameraState>();
     listener_ = new AudioListener();
     SetupCamera();
 }
コード例 #9
0
 public void PlaySounds(AudioListener listener)
 {
     //If you do not apply 3D before using play, the sound will not be flagged as 3D.
     _tuneInstance.Apply3D(listener, _emitter);
     if (_tuneInstance.State == SoundState.Stopped)
     {
         _tuneInstance.Play();
     }
 }
コード例 #10
0
ファイル: Audio.cs プロジェクト: bradleat/trafps
 public void Apply3DAll(Cue cue, AudioListener listener, AudioEmitter emitter, Vector3 listenerPosition,
     Vector3 emitterPosition, Vector3 listenerVelocity, Vector3 emitterVelocity)
 {
     listenerPosition = listener.Position;
     emitterPosition = emitter.Position;
     listener.Velocity = listener.Velocity;
     emitter.Velocity = emitter.Velocity;
     cue.Apply3D(listener, emitter);
 }
コード例 #11
0
        //Only one listener, several emitters
        //Store emitters in a list?
        //Store listener as a single variable in the class
        //Update receives emitters current position and velocity
        //
        public OpponentEngineSoundManager(Vector3 position, Vector3 velocity)
        {
            player = new AudioListener();
            player.Position = position;
            player.Velocity = velocity;

            opponentEngines = new Dictionary<string, MovingCueEmitter>();

            AEM = AudioEngineManager.GetInstance();
        }
コード例 #12
0
        //Only one listener, several emitters
        //Store emitters in a list?
        //Store listener as a single variable in the class
        //Update receives emitters current position and velocity
        //
        public EnvironmentSoundManager(Vector3 position, Vector3 velocity)
        {
            player = new AudioListener();
            player.Position = position;
            player.Velocity = velocity;

            environmentSounds = new List<CueEmitter>();

            AEM = AudioEngineManager.GetInstance();
        }
コード例 #13
0
ファイル: CorvSoundEffectCue.cs プロジェクト: Octanum/Corvus
        /// <summary>
        /// Creates a new instance of CorvSoundEffectCue with attenuation.
        /// </summary>
        public CorvSoundEffectCue(Cue cue, Vector2 listenerPosition, Vector2 emitterPosition)
            : base(cue)
        {
            this._Listener = new AudioListener();
            this._Listener.Position = new Vector3(listenerPosition, 0);
            this._Emitter = new AudioEmitter();
            this._Emitter.Position = new Vector3(emitterPosition, 0);

            Cue.Apply3D(this._Listener, this._Emitter);
        }
コード例 #14
0
ファイル: SoundManager.cs プロジェクト: ApexHAB/apex-lumia
 public SoundManager()
 {
     UpdateDeltaTime();
     _audioBufferList = new byte[AudioBufferCount][];
     for (int i = 0; i < _audioBufferList.Length; ++i)
         _audioBufferList[i] = new byte[ChannelCount * BytesPerSample * AudioBufferSize];
     _renderingBuffer = new short[ChannelCount*AudioBufferSize];
     SoundFunction = MySin;
     AudioListener x = new AudioListener();
 }
コード例 #15
0
 //See http://rbwhitaker.wikidot.com/audio-tutorials
 //See http://msdn.microsoft.com/en-us/library/ff827590.aspx
 //See http://msdn.microsoft.com/en-us/library/dd940200.aspx
 public SoundManager(Main game, string audioEngineStr, string waveBankStr, string soundBankStr)
     : base(game)
 {
     this.game = game;
     this.audioEngine = new AudioEngine(@"" + audioEngineStr);
     this.waveBank = new WaveBank(audioEngine, @"" + waveBankStr);
     this.soundBank = new SoundBank(audioEngine, @"" + soundBankStr);
     this.cueList = new List<Cue3D>();
     this.playSet = new HashSet<string>();
     this.audioListener = new AudioListener();
 }
コード例 #16
0
ファイル: AudioManager.cs プロジェクト: Hamsand/Swf2XNA
        public Cue PlaySound(string soundName, AudioListener audioListener, AudioEmitter audioEmitter, AudioHandler callback)
        {
            Cue result = PlaySound(soundName, audioListener, audioEmitter);

            // todo: need to make this multicast
            if (callbackList[result] != null)
            {
                callbackList[result].Invoke(result);
            }

            callbackList[result] = callback;
            return result;
        }
コード例 #17
0
 /// <summary>
 /// Allows the game to perform any initialization it needs to before starting to run.
 /// This is where it can query for any required services and load any non-graphic
 /// related content.  Calling base.Initialize will enumerate through any components
 /// and initialize them as well.
 /// </summary>
 protected override void Initialize()
 {
     for (int i = 0; i < 3; i++)
     {
         _gameObjects.Add(new GameObject());
         _gameObjects.Add(new Bonfire());
     }
     _listener = new AudioListener();
     _listener.Position = Vector3.Zero; //It's already set to this but never mind :)
     _listener.Forward = Vector3.Forward;
     _listener.Up = Vector3.Up;
     base.Initialize();
 }
コード例 #18
0
        public AudioManager(Game game)
        {
            soundBank = game.Content.LoadDirectory<SoundEffect>("audio/bz");
            musicBank = game.Content.LoadDirectory<Song>("audio/music");

            // register ourselves as a service
            if (game.Services != null)
                game.Services.AddService(typeof(IAudioManager), this);

            emitter = new AudioEmitter();
            listener = new AudioListener();

        }
コード例 #19
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ISoundEmitter3D"/> class.
        /// </summary>
        /// <param name="factory">The factory.</param>
        /// <param name="SoundName">Name of the sound.</param>
        public ISoundEmitter3D(GraphicFactory factory,String SoundName)
        {
            System.Diagnostics.Debug.Assert(factory != null);
            System.Diagnostics.Debug.Assert(!String.IsNullOrEmpty(SoundName));

            this.internalName = SoundName;
            SoundEffect se = factory.GetAsset<SoundEffect>(SoundName);                        
            soundEngineInstance = se.CreateInstance();

            Name = se.Name;
            Duration = se.Duration;
            listener = new AudioListener();
            emiter = new AudioEmitter();
        }
コード例 #20
0
        public override void AddedToStage(EventArgs e)
        {
            base.AddedToStage(e);

            if (audioListener == null)
            {
                audioListener = new AudioListener();
                audioListener.Position = new Vector3(600, 0, 0);
                audioListener.Velocity = new Vector3(0, 0, 0);
                audioListener.Forward = new Vector3(-1, 0, 0);
            }
            audioEmitter = new AudioEmitter();
            audioEmitter.Forward = new Vector3(1, 0, 0);
        }
コード例 #21
0
ファイル: Game1.cs プロジェクト: serapth/MonoGameBook
        protected override void LoadContent()
        {
            spriteBatch = new SpriteBatch(GraphicsDevice);

            soundEffect = this.Content.Load<SoundEffect>("circus");
            instance = soundEffect.CreateInstance();
            instance.IsLooped = true;

            listener = new AudioListener();
            emitter = new AudioEmitter();

            // WARNING!!!!  Apply3D requires sound effect be Mono!  Stereo will throw exception
            instance.Apply3D(listener, emitter);
            instance.Play();
        }
コード例 #22
0
ファイル: Player.cs プロジェクト: PhoenixWright/Mystery
        public Player(Engine engine, Vector2 tilePosition)
            : base(engine, tilePosition)
        {
            DrawOrder = (int)Global.Layers.Player;

              AudioListener = new AudioListener();
              AudioListener.Position = new Vector3(Position, 0);

              light = new Light(engine);
              light.Color = Color.White;
              light.Fov = MathHelper.TwoPi;
              light.Position = Position;
              light.Range = 250;
              light.ShadowType = Krypton.Lights.ShadowType.Illuminated;

              Engine.AddComponent(this);
        }
コード例 #23
0
ファイル: AudioManager.cs プロジェクト: ronforbes/omega
        public AudioManager(bool soundEnabled, float soundVolume, bool musicEnabled, float musicVolume)
            : base()
        {
            sounds = new Dictionary<string, SoundEffect>();
            songs = new Dictionary<string, Song>();

            listener = new AudioListener();
            listener.Forward = Vector3.Forward;
            listener.Up = Vector3.Up;

            SoundEnabled = soundEnabled;
            SoundVolume = soundVolume;
            MusicEnabled = musicEnabled;
            MusicVolume = musicVolume;

            SoundEffect.DistanceScale = 300.0f;
        }
コード例 #24
0
 public Player(Game game, Vector3 position)
     : base(Vector3.Zero, GameConstants.CAM_BOUNDS_PADDING)
 {
     this.game = game;
     camera = new Camera(game);
     game.Components.Add(camera);
     SetCameraProperties();
     EnableColorMap = true;
     PerformPlayerCollision = true;
     playerListener = new AudioListener();
     playerListener.Position = camera.Position;
     playerListener.Forward = camera.ViewDirection;
     playerListener.Up = Vector3.Up;
     inventory = new Inventory();
     PlayerAbleToMove = true;
     MakeFootstepSound = true;
 }
コード例 #25
0
ファイル: SoundManager.cs プロジェクト: kozupi/--
        private SoundManager(Game game, Func<Vector3> getListenerPosition, Func<Vector3> getListenerForward, Func<Vector3> getListenerUp)
            : base(game)
        {
            audioEngine = new AudioEngine(@"Content\Audio\GameAudio.xgs");
            waveBank = new WaveBank(audioEngine, @"Content\Audio\Wave Bank.xwb");
            soundBank = new SoundBank(audioEngine, @"Content\Audio\Sound Bank.xsb");
            musicCategory = audioEngine.GetCategory("Default");
            volume = 10;
            musicCategory.SetVolume(volume);

            cuelist = new List<Cue>();
            BGMCuelist = new List<Cue>();

            updateListenerForward = getListenerForward;
            updateListenerUp = getListenerUp;
            updateListenerPosition = getListenerPosition;
            listener = new AudioListener();
        }
コード例 #26
0
ファイル: Player.cs プロジェクト: crobinson95/GDAPS-Project-2
        public Player(int x, int y, int w, int h)
            : base(x, y, w, h)
        {
            grav = gravDirection.Down;
            gravity = GameVariables.gravity;
            xVelocity = 0;
            yVelocity = 0;
            inAir = true;
            alive = true;

            // Player is a listener, 3d audio scales with distance.
            listener = new AudioListener();
            listener.Position = new Vector3(x, y, 10.0f);

            FramesPerSec = 10;

            // All different player animations initialized.
            AddAnimation(15, 80, 40, 0, "Down_Right", 255, 124, 216, new Vector2(0, 0));
            AddAnimation(15, 68, 294, 0, "Down_Left", 255, 124, 216, new Vector2(0, 0));
            AddAnimation(15, 80, 548, 0, "Up_Right", 255, 124, 216, new Vector2(0, 0));
            AddAnimation(15, 68, 804, 0, "Up_Left", 255, 124, 216, new Vector2(0, 0));
            AddAnimation(15, 22, 1110, 0, "Left_Up", 255, 222, 124, new Vector2(0, 0));
            AddAnimation(15, 22, 1360, 0, "Left_Down", 255, 222, 124, new Vector2(0, 0));
            AddAnimation(15, 10, 1616, 0, "Right_Up", 255, 218, 128, new Vector2(0, 0));
            AddAnimation(15, 22, 1868, 0, "Right_Down", 255, 222, 120, new Vector2(0, 0));
            AddAnimation(1, 80, 40, 0, "Down_Idle_Right", 255, 124, 216, new Vector2(0, 0));
            AddAnimation(1, 68, 294, 0, "Down_Idle_Left", 255, 124, 216, new Vector2(0, 0));
            AddAnimation(1, 80, 548, 0, "Up_Idle_Right", 255, 124, 216, new Vector2(0, 0));
            AddAnimation(1, 68, 804, 0, "Up_Idle_Left", 255, 124, 216, new Vector2(0, 0));
            AddAnimation(1, 22, 1110, 0, "Left_Idle_Up", 255, 222, 124, new Vector2(0, 0));
            AddAnimation(1, 22, 1360, 0, "Left_Idle_Down", 255, 222, 124, new Vector2(0, 0));
            AddAnimation(1, 22, 1616, 0, "Right_Idle_Up", 255, 222, 128, new Vector2(0, 0));
            AddAnimation(1, 22, 1868, 0, "Right_Idle_Down", 255, 222, 120, new Vector2(0, 0));
            AddAnimation(1, 68, 2018, 0, "Down_Jump_Right", 255, 120, 220, new Vector2(0, 0));
            AddAnimation(1, 286, 2022, 0, "Down_Jump_Left", 255, 120, 220, new Vector2(0, 0));
            AddAnimation(1, 284, 2304, 0, "Up_Jump_Right", 255, 120, 220, new Vector2(0, 0));
            AddAnimation(1, 68, 2304, 0, "Up_Jump_Left", 255, 120, 220, new Vector2(0, 0));
            AddAnimation(1, 284, 2590, 0, "Right_Jump_Up", 255, 220, 120, new Vector2(0, 0));
            AddAnimation(1, 36, 2608, 0, "Right_Jump_Down", 255, 220, 120, new Vector2(0, 0));
            AddAnimation(1, 266, 2826, 0, "Left_Jump_Up", 255, 220, 120, new Vector2(0, 0));
            AddAnimation(1, 24, 2826, 0, "Left_Jump_Down", 255, 220, 120, new Vector2(0, 0));
        }
コード例 #27
0
 public void Initialize()
 {
     audioEngine = new AudioEngine(@"Content\Sounds\Sounds.xgs");
     waveBank = new WaveBank(audioEngine, @"Content\Sounds\Wave Bank.xwb");
     soundBank = new SoundBank(audioEngine, @"Content\Sounds\Sound Bank.xsb");
     soundEffects_cue = new Cue[8];
     music_cue = new Cue[3];
     listener = new AudioListener();
     emitter = new AudioEmitter();
     soundEffects_cue[0] = soundBank.GetCue("afterburner");
     soundEffects_cue[1] = soundBank.GetCue("missile");
     soundEffects_cue[2] = soundBank.GetCue("bullet");
     soundEffects_cue[3] = soundBank.GetCue("UI_Click");
     soundEffects_cue[4] = soundBank.GetCue("engage_engines");
     soundEffects_cue[5] = soundBank.GetCue("explode");
     soundEffects_cue[6] = soundBank.GetCue("jet_explode");
     soundEffects_cue[7] = soundBank.GetCue("equip");
     music_cue[0] = soundBank.GetCue("bg01");
     music_cue[1] = soundBank.GetCue("bg02");
     music_cue[2] = soundBank.GetCue("bg03");
 }
コード例 #28
0
ファイル: SoundManager.cs プロジェクト: JacopoV/TimeJumper
        public SoundManager(ContentManager content)
        {
            rand = new Random();
            level = content.ServiceProvider.GetService(typeof(Level)) as Level;

            jump = content.Load<SoundEffect>("Sounds/PlayerJump").CreateInstance();
            diePlayer = content.Load<SoundEffect>("Sounds/PlayerKilled").CreateInstance();
            goodSwitch = content.Load<SoundEffect>("Sounds/goodSwitch").CreateInstance();
            badSwitch = content.Load<SoundEffect>("Sounds/badSwitch").CreateInstance();

            if (level.numLevel > 3)
            {
                music[0] = content.Load<SoundEffect>("Sounds/s2").CreateInstance();
                music[1] = content.Load<SoundEffect>("Sounds/h2").CreateInstance();
            }
            else
            {
                music[0] = content.Load<SoundEffect>("Sounds/s1").CreateInstance();
                music[1] = content.Load<SoundEffect>("Sounds/h1").CreateInstance();
            }

            openDoor = content.Load<SoundEffect>("Sounds/openDoor").CreateInstance();
            door = (content.Load<SoundEffect>("Sounds/door")).CreateInstance();
            nextLevel = content.Load<SoundEffect>("Sounds/ExitReached").CreateInstance();
            keyCollected = content.Load<SoundEffect>("Sounds/GemCollected").CreateInstance();

            openDoor.Volume = 0.5f;
            door.Volume = 0.5f;
            diePlayer.Volume = 0.5f;

            cameraListener = new AudioListener();
            cameraListener.Position =
                new Vector3(
                    GraphicsDeviceManager.DefaultBackBufferWidth / 2,
                    GraphicsDeviceManager.DefaultBackBufferHeight / 2,
                    0);
            isSoundActive = true;
        }
コード例 #29
0
ファイル: GameAudio.cs プロジェクト: kiniry-teaching/UCD
        public GameAudio()
        {
            musicEngine = new AudioEngine("Content\\Audio\\Win\\Game Sounds.xgs");
            musicWaveBank = new WaveBank(musicEngine, "Content\\Audio\\Win\\Wave Bank.xwb");

            musicSoundBank = new SoundBank(musicEngine, "Content\\Audio\\Win\\Base Bank.xsb");
            stringBank = new SoundBank(musicEngine, "Content\\Audio\\Win\\String Bank.xsb");
            drumBank = new SoundBank(musicEngine, "Content\\Audio\\Win\\Drum Bank.xsb");
            ballBank = new SoundBank(musicEngine, "Content\\Audio\\Win\\Ball Noise Bank.xsb");
            synthBank = new SoundBank(musicEngine, "Content\\Audio\\Win\\Synth Bank.xsb");
            harpBank = new SoundBank(musicEngine, "Content\\Audio\\Win\\Harp Bank.xsb");
            specialBank = new SoundBank(musicEngine, "Content\\Audio\\Win\\Special Music.xsb");

            Alter = new Thread(new ParameterizedThreadStart(ChangeMelody));
            Base = new Thread(new ThreadStart(ModifyBase));
            Drums = new Thread(new ThreadStart(ModifyDrums));
            Strings = new Thread(new ThreadStart(ModifyStrings));
            Harps = new Thread(new ThreadStart(ModifyHarp));
            Synth = new Thread(new ThreadStart(ModifySynth));

            listener = new AudioListener();
            emitter = new AudioEmitter();
        }
コード例 #30
0
        /// <summary>
        /// Creates a camera.
        /// </summary>
        /// <param name="fieldOfView">The field of view in radians.</param>
        /// <param name="aspectRatio">The aspect ratio of the game.</param>
        /// <param name="nearPlane">The near plane.</param>
        /// <param name="farPlane">The far plane.</param>
        public MyCamera(float fieldOfView, float aspectRatio, float nearPlane, float farPlane)
        {
            if(nearPlane < 0.1f)
                throw new ArgumentException("nearPlane must be greater than 0.1.");

            Position = new Vector3(20, 20, 20);

            HorizontalAngle = MathHelper.PiOver4;
            VerticalAngle = (float)Math.Sqrt(3) / 2;

            this.Projection = Matrix.CreatePerspectiveFieldOfView(fieldOfView, aspectRatio,
                                                                        nearPlane, farPlane);
            this.LookAt(TargetPosition);
            this.View = Matrix.CreateLookAt(this.Position,
                                            this.Position + this.rotation.Forward,
                                            this.rotation.Up);

            Ears = new AudioListener();
            Ears.Up = Vector3.UnitZ;
            Ears.Position = Position;
            Ears.Forward = rotation.Forward;
            Update(new GameTime()); // call a quick update to get everything in order
        }
コード例 #31
0
        private void PlatformApply3D(AudioListener listener, AudioEmitter emitter)
        {
            // get AL's listener position
            float x, y, z;
            AL.GetListener(ALListener3f.Position, out x, out y, out z);
            ALHelper.CheckError("Failed to get source position.");

            // get the emitter offset from origin
            Vector3 posOffset = emitter.Position - listener.Position;
            // set up orientation matrix
            Matrix orientation = Matrix.CreateWorld(Vector3.Zero, listener.Forward, listener.Up);
            // set up our final position and velocity according to orientation of listener
            Vector3 finalPos = new Vector3(x + posOffset.X, y + posOffset.Y, z + posOffset.Z);
            finalPos = Vector3.Transform(finalPos, orientation);
            Vector3 finalVel = emitter.Velocity;
            finalVel = Vector3.Transform(finalVel, orientation);

            // set the position based on relative positon
            AL.Source(SourceId, ALSource3f.Position, finalPos.X, finalPos.Y, finalPos.Z);
            ALHelper.CheckError("Failed to set source position.");
            AL.Source(SourceId, ALSource3f.Velocity, finalVel.X, finalVel.Y, finalVel.Z);
            ALHelper.CheckError("Failed to Set source velocity.");
        }
コード例 #32
0
ファイル: Cue.cs プロジェクト: DL-Kazutaka/Xamarin-MonoGame
 public void Apply3D(AudioListener listener, AudioEmitter emitter)
 {
 }
コード例 #33
0
 private void PlatformApply3D(AudioListener listener, AudioEmitter emitter)
 {
     // Looks like a no-op on PSM?
 }
コード例 #34
0
 private void PlatformApply3D(AudioListener listener, AudioEmitter emitter)
 {
     // TODO: Read up the rules for this
     // _pannedNode.setPosition _pannedNode.setVelocity _pannedNode.setOrientation
 }
コード例 #35
0
        private AudioListener(string name) : base(name)
        {
            audioListener = new Microsoft.Xna.Framework.Audio.AudioListener();

            SoundManager.AddAudioListener(this);
        }
コード例 #36
0
 private void PlatformApply3D(AudioListener listener, AudioEmitter emitter)
 {
     throw new NotImplementedException();
 }
コード例 #37
0
 public void Apply3D(AudioListener listener, AudioEmitter emitter)
 {
     throw new NotImplementedException();
 }
コード例 #38
0
 /// <summary>Applies 3D positioning to the SoundEffectInstance using a single listener.</summary>
 /// <param name="listener">Data about the listener.</param>
 /// <param name="emitter">Data about the source of emission.</param>
 public void Apply3D(AudioListener listener, AudioEmitter emitter)
 {
     PlatformApply3D(listener, emitter);
 }
コード例 #39
0
ファイル: ClipEvent.cs プロジェクト: chubbyerror/Gibbo2D
 public abstract void Apply3D(AudioListener listener, AudioEmitter emitter);
コード例 #40
0
 /// <summary>
 /// Wrapper for Apply3D(AudioListener[], AudioEmitter)
 /// </summary>
 /// <param name="listener"></param>
 /// <param name="emitter"></param>
 public void Apply3D(AudioListener listener, AudioEmitter emitter)
 {
     Apply3D(new AudioListener[] { listener }, emitter);
 }