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

C# Audio.AudioEmitter类代码示例

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

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



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

示例1: SoundObject

 protected SoundObject(ISoundObjectParent parent, SoundEffectGame sfx)
 {
     this.parent = parent;
     this.soundEffectGame = sfx;
     this.emitter = new AudioEmitter();
     this.Volume = sfx.Volume;
 }
开发者ID:yuri410,项目名称:lrvbsvnicg,代码行数:7,代码来源:SoundObject.cs


示例2: PlatformApply3D

        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);
        }
开发者ID:KennethYap,项目名称:MonoGame,代码行数:31,代码来源:SoundEffectInstance.XAudio.cs


示例3: SoundManager

 public SoundManager(Game game)
     : base(game)
 {
     _sounds = new List<AudioSound>();
     _listener = new AudioListener();
     _emitter = new AudioEmitter();
 }
开发者ID:gabry90,项目名称:BIOXFramework,代码行数:7,代码来源:SoundManager.cs


示例4: PlaySound

 public Cue PlaySound(string soundName, AudioListener audioListener, AudioEmitter audioEmitter)
 {
     Cue result = GetCue(soundName);
     result.Apply3D(audioListener, audioEmitter);
     result.Play();
     return result;
 }
开发者ID:Hamsand,项目名称:Swf2XNA,代码行数:7,代码来源:AudioManager.cs


示例5: Destroy

        public override void Destroy()
        {
            isDestroyed = true;

            Vector3 pos = position;
            //float amount = (float)(min + (float)random.NextDouble() * (max - min));
            double min = 0;
            double max = MathHelper.TwoPi;
            double angle;
            for (int i = 0; i < numExplosionSmokeParticles; i++)
            {
                pos = position;
                angle = min + Screen.random.NextDouble() * (max - min);
                Matrix.CreateFromAxisAngle(new Vector3(1, 0, 0), rotation.X);
                pos.Y += (float)(radius * Math.Sin(angle));
                pos.X += (float)(radius * Math.Cos(angle));

                drawClass.ringExplosionParticles.AddParticle(pos, Body.Velocity);
                pos.Y -= 0.02f;
            }

            Screen.cue = parentGame.soundBank.GetCue("ring");

            AudioEmitter emitter = new AudioEmitter();
            emitter.Position = position;
            Screen.cue.Apply3D(Screen.listener, emitter);
            Screen.cue.Play();
        }
开发者ID:alittle1234,项目名称:XNA_Project,代码行数:28,代码来源:Ring.cs


示例6: Apply3DPosition

 public void Apply3DPosition(Cue cue, AudioListener listener, AudioEmitter emitter,
     Vector3 listenerPosition, Vector3 emitterPosition)
 {
     listenerPosition = listener.Position;
     emitterPosition = emitter.Position;
     cue.Apply3D(listener, emitter);
 }
开发者ID:bradleat,项目名称:trafps,代码行数:7,代码来源:Audio.cs


示例7: AssemblyLane

 public AssemblyLane(ContentManager content, Vector3 position, Vector3 rotation, float scale)
     : base(@"Models\AssemblyLane", content, position, rotation, scale)
 {
     FogEnd = 10000;
     emitter = new AudioEmitter();
     emitter.Position = position;
 }
开发者ID:skakri09,项目名称:LabyrinthExplorer-XNA-3D-game,代码行数:7,代码来源:AssemblyLane.cs


示例8: XnaAudioSource

        public XnaAudioSource(AudioEmitter audioEmitter)
        {
            if (audioEmitter == null)
                throw new ArgumentNullException ("audioEmitter");

            this.audioEmitter = audioEmitter;
        }
开发者ID:ermau,项目名称:Symphony,代码行数:7,代码来源:XnaAudioSource.cs


示例9: ChangeEmitterVelocity

 public void ChangeEmitterVelocity(AudioEmitter emitter, float maxVelocity, bool increase, float amount)
 {
     if (increase)
         emitter.Velocity = new Vector3(maxVelocity * amount, 0.0f, 0.0f);
     else
         emitter.Velocity = new Vector3(-maxVelocity * amount, 0.0f, 0.0f);
 }
开发者ID:bradleat,项目名称:trafps,代码行数:7,代码来源:Audio.cs


示例10: CueEmitter

        public CueEmitter(Cue sound, Vector3 position)
        {
            cue = sound;

            audioEmitter = new AudioEmitter();
            audioEmitter.Position = position;
            audioEmitter.Velocity = Vector3.Zero;
        }
开发者ID:MintL,项目名称:datx02-rally,代码行数:8,代码来源:EnvironmentSoundManager.cs


示例11: Enemy

        public Enemy(string modelName, ContentManager content, float scale)
        {
            this.modelName = modelName;
            LoadContent(content);
            modelScale = scale;
            emitter = new AudioEmitter();

            emitter.Position = position;
        }
开发者ID:skakri09,项目名称:LabyrinthExplorer-XNA-3D-game,代码行数:9,代码来源:Enemy.cs


示例12: PositionedSound

 public PositionedSound(Cue cue, String cueName, string soundBankFile)
     : base()
 {
     mSound = new Sound(cue, cueName, soundBankFile);
     Variables = mSound.Variables;
     mSound.OnCueRetrieved += new Sound.OnCueRetrievedHandler(UpdateAudio);
     
     mEmitter = new AudioEmitter();
 }
开发者ID:vchelaru,项目名称:FlatRedBall,代码行数:9,代码来源:PositionedSound.cs


示例13: Apply3DAll

 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);
 }
开发者ID:bradleat,项目名称:trafps,代码行数:9,代码来源:Audio.cs


示例14: HangarSound

 public HangarSound(string soundName, Vector3 position, float volume = 1, float customDivFact = 300)
 {
     this.soundName = soundName;
     this.volume = volume;
     divFact = customDivFact;
     this.position = position;
     emitter = new AudioEmitter();
     emitter.Position = position;
 }
开发者ID:skakri09,项目名称:LabyrinthExplorer-XNA-3D-game,代码行数:9,代码来源:Hangar.cs


示例15: CorvSoundEffectCue

        /// <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);
        }
开发者ID:Octanum,项目名称:Corvus,代码行数:13,代码来源:CorvSoundEffectCue.cs


示例16: Key

 public Key(ContentManager content, string keyID)
     : base(@"Models\Key", content)
 {
     emitter = new AudioEmitter();
     emitter.Position = position;
     this.KeyID = keyID;
     screenTransforms = new Matrix[base.model.Bones.Count];
     screenWorldMatrix = Matrix.Identity;
     GetKeyColor(keyID);
 }
开发者ID:skakri09,项目名称:LabyrinthExplorer-XNA-3D-game,代码行数:10,代码来源:Key.cs


示例17: PianoPlayer

        public PianoPlayer(Game game)
        {
            _tune = game.Content.Load<SoundEffect>("piano");
            _tuneInstance = _tune.CreateInstance();
            _tuneInstance.IsLooped = true;

            _emitter = new AudioEmitter();
            _emitter.Forward = Vector3.Backward;
            _emitter.Up = Vector3.Up;
        }
开发者ID:Westerdals,项目名称:PG2200LectureCode2013,代码行数:10,代码来源:PianoPlayer.cs


示例18: SoundInstanceXNA

 public SoundInstanceXNA(SoundEffectInstance effect, Func<Vector2?> getEmitterPos, Func<Vector2?> getEmitterMove, float baseVolume, float distanceScale)
 {
     _instance = effect;
     _getEmitterPos = getEmitterPos;
     _getEmitterMove = getEmitterMove;
     _emitter = new AudioEmitter();
     _baseVolume = baseVolume;
     _distanceScale = distanceScale;
     SetVolume(1);
     UpdateSpatial(DEFAULT_LISTENERS);
 }
开发者ID:vvnurmi,项目名称:assaultwing,代码行数:11,代码来源:SoundInstanceXNA.cs


示例19: BepuCarActor

        /// <summary>
        /// Create a car Actor which can interface with the BEPU physics engine
        /// </summary>
        /// <param name="position"></param>
        /// <param name="orientation"></param>
        public BepuCarActor(Game game, CarModelRenderer renderer, Matrix worldMatrix)
            : base(game, renderer)
        {
            emitter_ = new AudioEmitter();
            CarSoundEmitters.AudioEmitters.Add(emitter_);

            // create a pin (for keeping the car stuck to the track)
            Capsule pin = new Capsule(new Vector3(0, -0.7f, -2), 0.6f, 0.12f, 1);
            pin.Bounciness = 0f;
            pin.DynamicFriction = 0f;
            pin.StaticFriction = 0f;

            // create a body:
            CompoundBody body = new CompoundBody();
            body.AddBody(new Box(new Vector3(0, 0, 0), 2.5f, .75f, 4.5f, 60));
            body.AddBody(new Box(new Vector3(0, .75f / 2 + .3f / 2, .5f), 2.5f, .3f, 2f, 1));
            body.AddBody(pin);
            body.CenterOfMassOffset = new Vector3(0, -.5f, 0);

            body.WorldTransform = worldMatrix;
            body.LinearVelocity = Vector3.Zero;
            body.AngularVelocity = Vector3.Zero;
            // construct the car:
            car = new Vehicle(body);

            // attach wheels:
            Matrix wheelGraphicRotation = Matrix.CreateFromAxisAngle(Vector3.Forward, MathHelper.PiOver2);
            for (int i = 0; i < 4; i++)
            {
                Wheel wheel = new Wheel(
                                 new RaycastWheelShape(.375f, wheelGraphicRotation),
                                 new WheelSuspension(2000, 100f, Vector3.Down, .8f,
                                     new Vector3(
                                         ( i <= 1 ) ? -1.1f : 1.1f,
                                         0,
                                         ( (i & 1) == 0 ) ? 1.8f : - 1.8f)),
                                 new WheelDrivingMotor(2.5f, 30000, 10000),
                                 new WheelBrake(1.5f, 2, .02f),
                                 new WheelSlidingFriction(4, 5));

                car.AddWheel(wheel);

                // adjust additional values
                wheel.Shape.FreezeWheelsWhileBraking = true;
                wheel.Suspension.SolverSettings.MaximumIterations = 2;
                wheel.Brake.SolverSettings.MaximumIterations = 2;
                wheel.SlidingFriction.SolverSettings.MaximumIterations = 2;
                wheel.DrivingMotor.SolverSettings.MaximumIterations = 2;

            }

            // add it to physics
            Engine.currentWorld.Space.Add(car);
        }
开发者ID:smanoharan,项目名称:242TopGearElectrified,代码行数:59,代码来源:BepuCarActor.cs


示例20: FinalGate

 public FinalGate(ContentManager content,
     ref List<AABB> collisionList,
     Vector3 position, Vector3 rotation, float scale)
     : base(@"Models\Environment\FinalGatePillars", content, position, rotation, scale)
 {
     CreateDoors(content, ref collisionList, position, scale);
     base.FogEnd = 3000;
     currentState = GateState.CLOSED;
     emitter = new AudioEmitter();
     emitter.Position = position;
 }
开发者ID:skakri09,项目名称:LabyrinthExplorer-XNA-3D-game,代码行数:11,代码来源:FinalGate.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C# Audio.AudioEngine类代码示例发布时间:2022-05-26
下一篇:
C# Framework.Vector3类代码示例发布时间: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