Exemplo n.º 1
0
    /// <summary>
    /// Update the sound with a new matrix manually.
    /// </summary>
    /// <param name="matrix">Object-To-World Matrix for the 3D sound</param>
    /// <param name="gameTime"></param>
    public void UpdateMatrix(Matrix matrix, GameTime gameTime)
    {
        float dt = (float)gameTime.ElapsedGameTime.TotalSeconds;

        m_emitter.Forward  = matrix.Forward;
        m_emitter.Up       = matrix.Up;
        m_emitter.Position = Vector3.Transform(m_offset, matrix);
        m_emitter.Velocity = (m_emitter.Position - m_oldPos) / dt;
        m_oldPos           = m_emitter.Position;

        AudioComponent.Get().UpdateSound3D(m_sound, m_emitter);
    }
Exemplo n.º 2
0
 /// <summary>
 /// Start a new sound.
 /// </summary>
 /// <param name="sound">The name of the sound to play</param>
 public void PlaySound(string sound)
 {
     StopSound();    //This class can only track one sound at a time so kill any previous sounds.
     m_sound = AudioComponent.Get().PlaySound3D(sound, m_emitter);
 }
Exemplo n.º 3
0
 /// <summary>
 /// Stop the sound
 /// </summary>
 public void StopSound()
 {
     AudioComponent.Get().StopSound(m_sound);
     m_sound.Invalidate();
 }
Exemplo n.º 4
0
 /// <summary>
 /// Sets a user-defined variable for the sound
 /// </summary>
 /// <param name="varName">name of the variable to set</param>
 /// <param name="value">value of the variable to set</param>
 public void SetVariable(string varName, float value)
 {
     AudioComponent.Get().SetVariable(m_sound, varName, value);
 }