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

Sound Breaking without XACT 3.1

Last post 7/7/2009 5:06 AM by Ashu Tatake. 5 replies.
  • 7/4/2009 7:50 AM

    Sound Breaking without XACT 3.1

    The way XACT deals with volume, among other things, was a real turn off so I decided to start using SoundEffectInstance to play sounds. All the code is exactly the same only I tried using this function to play sounds.

                SoundEffect soundEffect = Sounds[soundName];  
                SoundEffectInstance instance = soundEffect.CreateInstance();  
                  
      
                instance.Volume = volume;  
                instance.Play(); 

    For some reason now sound effects will randomly break. Is there something in XACT that may cause that?
    Also, apply3D doesn't seem to work the same way it used to, might there be a reason for that?

    One more piece of information! I followed the how to play sounds without XACT guide step by step but it didn't seem to mention that I had to add a reference to audio importer. When I did that it gave a weird error about the .Net Target Framework which I have set to 3.5. I'm not sure if that adds to anything.
  • 7/4/2009 12:17 PM In reply to

    Re: Sound Breaking without XACT 3.1

    A bit more information...

    When I play sound without using CreateInstance it works just fine!
  • 7/4/2009 1:00 PM In reply to

    Re: Sound Breaking without XACT 3.1

    One final piece of information! I tried adding the instances of the sounds played into a list and removing sounds that were done playing from the list and this seems to fix the problem. I still have the feeling that I probably shouldn't need to do this.
  • 7/4/2009 3:33 PM In reply to

    Re: Sound Breaking without XACT 3.1

    This is as unrelated to XACT as it can get. While the SoundEffect stuff and XACT use XAudio2 internally XACT will not mess around with the former if it is not initiallized in your project at all (and even if it is both are separate). What you are running into is most likely garbage collection of the SoundEffectInstance instances, which is why storing them in a list until they are done fixes the problem you are experience.
    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
  • 7/4/2009 5:45 PM In reply to

    Re: Sound Breaking without XACT 3.1

    That makes sense... I wonder why it hasn't been brought up before...

    In any case thanks for clearing it up.
  • 7/7/2009 5:06 AM In reply to

    Re: Sound Breaking without XACT 3.1

Page 1 of 1 (6 items) Previous Next