Still problem with my sound
by osamah · in Torque X 2D · 06/16/2010 (3:16 am) · 5 replies
Hello , this is really frustrating !
I tried everything to include the sound in my game , but I still got this "null exception" with the audio engine . here's what I did , I used XACT to create the sound and wave banks , then included the project in a folder called sound , then I build the project in XACT that's when I get the two folders "win" and "xbox" which has the .xgs and the sound and wave banks , then I declare these variables:
SoundGroup sg;
Cue c;
then in begin run I do this :
sg =
SoundManager.Instance.RegisterSoundGroup("sound", @"data/sound/Wave Bank.xwb", @"data/sound/Sound Bank.xsb");
AudioCategory _sfx = Game.Instance.Engine.SFXDevice.GetCategory("last");
_sfx.SetVolume(0.8f);
AudioCategory _music = Game.Instance.Engine.SFXDevice.GetCategory("Music");
_music.SetVolume(0.8f);
that's when I get the "null refrence" in this line : Game.Instance.Engine.SFXDevice.GetCategory("last");
and I did enable the audio in XML settings file and I added the :
<AudioGlobalSettingsFile>
data/sound/lasts.xgs
</AudioGlobalSettingsFile>
thanks
I tried everything to include the sound in my game , but I still got this "null exception" with the audio engine . here's what I did , I used XACT to create the sound and wave banks , then included the project in a folder called sound , then I build the project in XACT that's when I get the two folders "win" and "xbox" which has the .xgs and the sound and wave banks , then I declare these variables:
SoundGroup sg;
Cue c;
then in begin run I do this :
sg =
SoundManager.Instance.RegisterSoundGroup("sound", @"data/sound/Wave Bank.xwb", @"data/sound/Sound Bank.xsb");
AudioCategory _sfx = Game.Instance.Engine.SFXDevice.GetCategory("last");
_sfx.SetVolume(0.8f);
AudioCategory _music = Game.Instance.Engine.SFXDevice.GetCategory("Music");
_music.SetVolume(0.8f);
that's when I get the "null refrence" in this line : Game.Instance.Engine.SFXDevice.GetCategory("last");
and I did enable the audio in XML settings file and I added the :
<AudioGlobalSettingsFile>
data/sound/lasts.xgs
</AudioGlobalSettingsFile>
thanks
#2
06/17/2010 (9:01 am)
Can you post the contents of your GameSounds.xap file? You can read it from within Visual Studio.
#3
Game.Instance._soundgroup.PlaySound("The sound");
Is there anything wrong with this Method ?
06/24/2010 (1:44 am)
okay the sound works fine , but I didn't use the method you posted Mr.Henry . I just defined a sound group then I didn't retrieve the Category like you did , I just play the sound right away like this :Game.Instance._soundgroup.PlaySound("The sound");
Is there anything wrong with this Method ?
#4
rbwhitaker.wikidot.com/using-xact
I used this tutorial and got sound to work.
06/25/2010 (6:46 am)
I also cannot get that tutorial to work.rbwhitaker.wikidot.com/using-xact
I used this tutorial and got sound to work.
#5
06/26/2010 (10:11 pm)
Have you guys checked out the documentation that comes with XNA regarding XACT? there are tons of tutorials in there and should give you some good knowledge about how XACT works. I will probably make my tutorial simpler though since three people have had problems with it.
Torque 3D Owner Henry Shilling
Smokin Skull
I explain here how ti get sound working in tx2D