Like in question, i don’t get what is the difference between using those classes. What are advantages and limitations of each class. I read many tutorials, and still can’t decide what should i do.
To make things more clear, i got AudioModule, AudioEmitterComponent and AudioListenerComponent. (Our game’s eninge is based on component. When you create and object which is source of some sounds (monster or sth), i add emitter component.. and i got problems then. I can’t figure out how to do it best. First i wanted Audio Module to got List, the same for listeners (and also lists for wave and soundbanks). Now i got problem, not in coding itself (at the moment) but with the concept what, where, when, why. Any ideas are valuable 🙂
Think of
SoundEffectas being the sound file. You can load these using content manager.And
SoundEffectInstanceas a program playing the sound file.SoundEffecthas aPlaymethod. This is just for convenience. What this does internally is create aSoundEffectInstance, play it, and then clean up when it finishes. (Known as “fire and forget”.)When using
SoundEffectInstance(that you create withSoundEffect.CreateInstance) you need to manage all of that yourself – the advantage is that you can manipulate the properties of the sound (volume, etc) while the sound is playing. You can also loop the sound, stop or pause part way through, etc.When you finish with your
SoundEffectInstance, don’t forget toDispose()of it!Another thing you can do with
SoundEffectInstance(which is entirely optional) is apply a 3D effect to it. This gives you an easy way to “place” the sound in 3D space. You apply the 3D effect usingSoundEffectInstance.Apply3D(giving it a listener and an emitter that provide information about the camera and the sound source). The exact details of this are best left to the “Applying a 3D Positional Effect to a Sound” article on MSDN.