XNA Creators Club Online
Page 1 of 1 (3 items)
Sort Posts: Previous Next

A kind of echo playing a SoundEffect

Last post 1/6/2009 5:07 AM by marioaae. 2 replies.
  • 1/5/2009 5:16 AM

    A kind of echo playing a SoundEffect

    Hi everybody, I'm trying to play a SoundEffect but it sounds with a kind of echo, I'm playing it this way:

    --C# code--

    SoundEffect mySoundEffect;

    mySoundEffect = Content.Load<SoundEffect>("Audio\\Waves\\puchun");
    mySoundEffect.Play();

    --end--

    The only way I can remove that echo is playing it with a SoundEffectInstance and checking if it is null or not, like this:

    --C# code--

    SoundEffectInstance mySoundEffectInstance;
    SoundEffect mySoundEffect;

    mySoundEffect = Content.Load<SoundEffect>("Audio\\Waves\\puchun");

    if ( mySoundEffectInstance == null)
       mySoundEffectInstance = mySoundEffect.Play();

    --end--

    If I don't check if the SoundEffectInstance is null is the same thing, it sounds wierd.

    Thank you for your help.




  • 1/5/2009 12:30 PM In reply to

    Re: A kind of echo playing a SoundEffect

    One possible source of the echo could be that you unintentionally load and play the sound more than once, which would explain why there's no echo with the second code snippet. The second code snippet is pretty much the only way to prevent multiple plays and check its State property to ensure your sound is played only once.
    We are boki. The rest is known.

    The not so known part of the rest: It is Björn or Bjoern, but never Bjorn.

    Twitter ~ Bnoerj ~ SharpSteer ~ SgtConker.com
  • 1/6/2009 5:07 AM In reply to

    Re: A kind of echo playing a SoundEffect

    Thank you Bjoern, when I was pressing a button to play the SoundEffect I was unintentionally playing it a lot of times, so, I'm going to work with events.
Page 1 of 1 (3 items) Previous Next