本文整理汇总了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;
}
示例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);
}
示例3: SoundManager
public SoundManager(Game game)
: base(game)
{
_sounds = new List<AudioSound>();
_listener = new AudioListener();
_emitter = new AudioEmitter();
}
示例4: PlaySound
public Cue PlaySound(string soundName, AudioListener audioListener, AudioEmitter audioEmitter)
{
Cue result = GetCue(soundName);
result.Apply3D(audioListener, audioEmitter);
result.Play();
return result;
}
示例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();
}
示例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);
}
示例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;
}
示例8: XnaAudioSource
public XnaAudioSource(AudioEmitter audioEmitter)
{
if (audioEmitter == null)
throw new ArgumentNullException ("audioEmitter");
this.audioEmitter = audioEmitter;
}
示例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);
}
示例10: CueEmitter
public CueEmitter(Cue sound, Vector3 position)
{
cue = sound;
audioEmitter = new AudioEmitter();
audioEmitter.Position = position;
audioEmitter.Velocity = Vector3.Zero;
}
示例11: Enemy
public Enemy(string modelName, ContentManager content, float scale)
{
this.modelName = modelName;
LoadContent(content);
modelScale = scale;
emitter = new AudioEmitter();
emitter.Position = position;
}
示例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();
}
示例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);
}
示例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;
}
示例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);
}