TGB Audio Question
by Nate Lujan · in Torque Game Builder · 04/20/2009 (6:24 pm) · 4 replies
Yeah, I understand that there are alot of Audio questions going around these forums, and I have been taking a few hours searching what I was trying to look for, but I don't think anyone asked this question.
I set up my Audio Definitions, and my Profiles, everything is flat out smooth, as I basically just read the tutorial for Audio in the documentation. I test the sounds using the ALX play method, and the sounds work perfectly. However, the question is, how do I get it into the game?
A few months ago, I tried using the Audio Profile and Definition behaviors instead of manually scripting them, but those didn't work for some odd reason; and no sound came about. I set them in the beginning of the object tree; and still, no sound. I didnt set any paths like what the thing was telling me to do, and I only set the files name, (.wav, .ogg, etc.) but that didn't make any difference.
So anyways, is there any way of getting the sounds into the actual game without going into the console and playing them by hand? Thank you.
I set up my Audio Definitions, and my Profiles, everything is flat out smooth, as I basically just read the tutorial for Audio in the documentation. I test the sounds using the ALX play method, and the sounds work perfectly. However, the question is, how do I get it into the game?
A few months ago, I tried using the Audio Profile and Definition behaviors instead of manually scripting them, but those didn't work for some odd reason; and no sound came about. I set them in the beginning of the object tree; and still, no sound. I didnt set any paths like what the thing was telling me to do, and I only set the files name, (.wav, .ogg, etc.) but that didn't make any difference.
So anyways, is there any way of getting the sounds into the actual game without going into the console and playing them by hand? Thank you.
#2
As for the sounds that play when you press a button, such as for jumping, or shooting, or maybe clicking buttons in the menu, how do you set the alx command to make that work? I have a hard time understanding the definitions of the script in the reference pages. Thank you so much for the behaviors, your a great help.
Edit: Um, sorry to bother, however, is there a way to remove all sounds when transitioning to another scene? Such as having menu music playing, but when starting the game, the old existing music transitions into the game music?
04/21/2009 (1:47 pm)
I set up the profiles and definitions correctly, but what I totally forgot was to add the collision on sound! Thank you so much!As for the sounds that play when you press a button, such as for jumping, or shooting, or maybe clicking buttons in the menu, how do you set the alx command to make that work? I have a hard time understanding the definitions of the script in the reference pages. Thank you so much for the behaviors, your a great help.
Edit: Um, sorry to bother, however, is there a way to remove all sounds when transitioning to another scene? Such as having menu music playing, but when starting the game, the old existing music transitions into the game music?
#3
04/25/2009 (1:25 pm)
Bump, sorry. Im still trying to figure this out a bit more, any help provided?
#4
04/25/2009 (2:08 pm)
Yes you can stop all music with alxStopAll(). As for setting up music when you press a button you will need to define each description to use then a profile. Then in your command you add the alxplay command for the sound. There is really good tutorial that came with the documentation for TGB. Open up the documentation and search for audio. There is a tutorial that lists everything you need for sound.
Torque Owner Pubily
The answer really depends. You can use the behaviors that you were talking about but there are a few things you have to do. Add the behaviors to anything, off your scene. The most important part is that the description must be listed first, then the profile.
After you have both set up correctly you then can add the on collision or remove behavior to the object that will have the sound, calling the audio profile that you created. Should work just fine as long as you have it setup correctly. I tested these behaviors the other day and they worked just fine.
If you are going to add them into your script you need to add it to what you want the sounds to do. So if you are shooting, you would add the alx command in that loop or function for shooting.
The biggest thing to remember is that the description must be setup first, then the profile. You then use the alx command on the profile name. The profile has to reference the description to play the sound.
So in short, the command you are using to test your sound via the console needs to be in your code. If you want the music to start on load, put it into you load game function. It is that simple. If this does not make sense, let me know and I will try to explain it better.