当前位置: 首页>>代码示例>>C#>>正文


C# Audio.AudioEmitter类代码示例

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


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


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