Game Development Community

GUI button sounds

by Kyle Cook · in Torque Game Engine · 06/19/2006 (8:47 am) · 15 replies

For some reason I can not get these event sounds to work with my gui buttons, I have tried and tried, looked at threads, hacked away at code, and nothing. I am beginning to wonder if the sound files dont like TGE, but they play a media player.

Here is what I added to the bottom of my audioProfiles..
new AudioProfile(AudioButtonOver)
{
   filename = "~/Felswourne/client/ui/Sounds/select.wav";
   description = "AudioGui";
   preload = true;
};

 new AudioProfile(AudioButtonDown)
{
   filename = "~/Felswourne/client/ui/Sounds/click.wav";
   description = "AudioGui";
   preload = true;
};

And I added this at the top of my defaultGameProfiles.
// Override base controls
GuiButtonProfile.soundButtonOver = "AudioButtonOver";
GuiButtonProfile.soundButtonDown = "AudioButtonDown";

GuiBitmapButtonTextProfile.soundButtonOver = "AudioButtonOver";
GuiBitmapButtonTextProfile.soundButtonDown = "AudioButtonDown";

And just for good measure in my customProfiles, in all the right spots, I placed this..
// sounds
   soundButtonDown = "~/Felswourne/client/ui/Sounds/click.wav";
   soundButtonOver = "~/Felswourne/client/ui/Sounds/select.wav";

THEN I went into the button itself in the Gui and added these dynamic fields.
soundButtonDown = "./Sounds/click.wav";
         soundButtonOver = "./Sounds/select.wav";

Still no sound, what is the deal here?!

#1
06/19/2006 (9:03 am)
Works for me.

I would remove any unnecessary code from customProfiles.cs and in the Gui. You shouldn't need it and it may be conflicting with something.

Lastly, make sure 'GuiBitmapButtonTextProfile' exists and is named correctly. By default these buttons use the 'GuiButtonProfile'.
#2
06/19/2006 (9:14 am)
Did all that with no luck still, man this is a nerve racker..
#3
06/19/2006 (9:34 am)
So your buttons' profile is using the same named profile as declared at the top of defaultGameProfiles? Damn, I thought this was the problem.

Well try using a different sound to eliminate the possibility that Torque doesn't like your particular sound file. Try ogg, or wav, stereo, mono, different sampling rates etc.

Better yet grab one of the ogg's that ships with Torque and test with that, this way you can determine for sure if it's a scripting problem or a sound file issue.
#4
06/19/2006 (11:44 am)
Alright I took a default ogg from the game and used it, no sound still...

This is the gui button
new GuiBitmapButtonTextCtrl(LoginBTN) {
         Profile = "GuiBitmapButtonTextProfile";
         HorizSizing = "relative";
         VertSizing = "relative";
         position = "9 142";
         Extent = "127 22";
         MinExtent = "8 2";
         Visible = "1";
         Command = "LoginAccount();";
         tooltipprofile = "GuiButtonProfile";
         text = "Login Account";
         groupNum = "-1";
         buttonType = "PushButton";
         bitmap = "./Images/bigbutton";
      };

Bottom of audioProfiles
new AudioProfile(AudioButtonOver)
{
   filename = "~/Felswourne/data/sound/Crossbow_explosion.ogg";
   description = "AudioGui";
   preload = true;
};

 new AudioProfile(AudioButtonDown)
{
   filename = "~/Felswourne/data/sound/Crossbow_explosion.ogg";
   description = "AudioGui";
   preload = true;
};

Top of defaultGameProfiles
GuiButtonProfile.soundButtonOver = "AudioButtonOver";
GuiButtonProfile.soundButtonDown = "AudioButtonDown";

GuiBitmapButtonTextProfile.soundButtonOver = "AudioButtonOver";
GuiBitmapButtonTextProfile.soundButtonDown = "AudioButtonDown";

Still no sound!! Arg! Can anyone see what I am doing wrong?
#5
06/19/2006 (12:22 pm)
Are your speakers plugged in? =)
#6
06/19/2006 (12:23 pm)
And blastin at full volume..
#7
06/19/2006 (1:22 pm)
Are you getting any sound from Torque at all? If not, the issue is probably not at the scripting level, but driver interaction issues of some sort.
#8
06/19/2006 (2:13 pm)
I get all sounds in game. Something must be wrong in my scripts somewhere.
#9
06/19/2006 (2:25 pm)
It's probable that the profile you are using is being over-written later in the script loading process.

Try creating a totally unique named guiprofile with all of the appropriate data elements (including sound), and see if it works properly.
#10
06/20/2006 (6:13 am)
I dont know the path you use but
is this the right path to the sound "~/Felswourne/client/ui/Sounds/select.wav" ?

and does GuiBitmapButtonTextProfile exist in common/ui/defaultprofiles.cs or somewhere else ?
#11
06/20/2006 (6:52 am)
Starting and including your post above Billy, count up 7 posts and you will find the answer to both your questions is yes.

Sorry if that comes across rude and almighty, it's not meant to be =)
#12
06/20/2006 (8:02 am)
@Tim say I'm stupid ,but i don't see any clear answer when i comes to path or how the GuiBitmapButtonTextProfile is defined.
I can see how you suggest it , but not how he did it !
2 different things.

I try to help if i dont find the information, then i ask ,what is wrong with that ?
#13
06/20/2006 (9:30 am)
Hey Billy, I don't think you're stupid.

I'm not following your comments,

Quote:
I can see how you suggest it , but not how he did it !
2 different things.

The author of this thread has posted his code and where he placed it. Did you look at the afore mentioned post by Kyle Cook?

Quote:
I try to help if i dont find the information, then i ask ,what is wrong with that ?

Nothing man, I think you mistakenly took my comment personally. The fact is the information you asked for is already in this thread & I was merely pointing that out... and you still haven't read it.

Sorry if I offended you.

-Peace.
#14
06/20/2006 (11:09 am)
I dont know if you got this work but try your code out with my gui button, it work good. I try seven sound with it. I did not try your gui button but i try it with my gui button and Torque default it work good. I change this
from
filename = "~/Felswourne/data/sound/Crossbow_explosion.ogg";

to
filename = "~/data/sound/Crossbow_explosion.ogg";

Did you delete your dso for audioProfiles and defaultGameProfiles?
#15
06/20/2006 (12:41 pm)
@ Michael : apparently that was what was wrong, the path. Works like a charm! Thanks mate!