New and Improved TGB AudioManager
by Joe Rossi · 01/20/2008 (5:12 pm) · 8 comments
I just want to let TGB users know about the updated AudioManager resource on TDN. I've modded Phillip OShea's awesome AudioManager resource and I've found a way to make audioProfiles created with the resource selectable within behaviors! I've had this on my TGB wishlist for awhile now, it's something that I felt should've been in TGB from the start. It only took me a week or two, very part time...starting with Phillips code ;). I've learned a great deal about how behaviors work internally, and as a bonus I stumbled upon the undocumented ColorPicker for behaviors.
Without further ado...Here's how to install it.
Grab the file resource from the new TGB resource page on TDN:tdn.garagegames.com/wiki/TGB/Resources/AudioManager
Unzip it to your resources folder, and (optionally) add the included icon to your tools\levelEditor\gui\images folder.
For the next part you will need a "pro" version of TGB.
Add this code at the bottom of your tools\behaviorEditor\Scripts\fieldTypes.ed.cs editor script
With this in place you can allow selection of audioProfiles created with the AudioManager like so:
I'd love to see this system or something like it become part of stock TGB in the future. It's incredibly useful. Hopefully the Tools and Tech team will take notice. With this out of the way, they can focus on other areas of TGB :)
Many thanks to Phillip OShea for writing the bulk of this code and making it available to the community.
Without further ado...Here's how to install it.
Grab the file resource from the new TGB resource page on TDN:tdn.garagegames.com/wiki/TGB/Resources/AudioManager
Unzip it to your resources folder, and (optionally) add the included icon to your tools\levelEditor\gui\images folder.
For the next part you will need a "pro" version of TGB.
Add this code at the bottom of your tools\behaviorEditor\Scripts\fieldTypes.ed.cs editor script
BehaviorEditor::registerFieldType("audioProfile", "createaudioProfileGui");
function BehaviorFieldStack::createaudioProfileGui(%this, %behavior, %fieldIndex)
{
%fieldInfo = %behavior.template.getBehaviorField(%fieldIndex);
%name = getField( %fieldInfo, 0 );
%description = %behavior.template.getBehaviorFieldDescription(%fieldIndex);
%objectType = %behavior.template.getBehaviorFieldUserData(%fieldIndex);
%scenegraph = ToolManager.getLastWindow().getSceneGraph();
%list = "None";
%count = $managedDatablockSet.getCount();
for( %i = 0; %i < %count; %i++ ){
%object = $managedDatablockSet.getObject( %i );
if( !%object.isMemberOfClass( %objectType ) ) continue;
if( %object.getName() $= "" ) continue;
if( %object.ObjectType !$= "AudioProfile" ) continue;
%list = %list TAB %object.getName();
}
%control = %this.createDropDownList(%name, %name, "", %list, %description, true, true);
%listCtrl = %control.findObjectByInternalName(%name @ "DropDown");
%listCtrl.object = %behavior;
}With this in place you can allow selection of audioProfiles created with the AudioManager like so:
%template.addBehaviorField( mySound, "The sound we want to play", audioProfile, "", ScriptObject );
I'd love to see this system or something like it become part of stock TGB in the future. It's incredibly useful. Hopefully the Tools and Tech team will take notice. With this out of the way, they can focus on other areas of TGB :)
Many thanks to Phillip OShea for writing the bulk of this code and making it available to the community.
About the author
#2
01/21/2008 (3:20 am)
Can wait to check this. Great job Joe!
#3
01/21/2008 (9:58 am)
Nice one Joe!
#4
I unzipped the AudioManagerTool directory to "TorqueGameBuilder-1.7.2\tgb\resources\AudioManagerTool". I copied the AudioManagerIcon.png to "TorqueGameBuilder-1.7.2\tgb\tools\levelEditor\gui\images" and the audioManagerInterfact.gui to "TorqueGameBuilder-1.7.2\tgb\tools\levelEditor\gui\images". I then modified the fieldTypes.ed.cs script.
I can add audio profiles to behaviors, but I think I missed something somewhere. The only selection I have under the behavior field drop down is "none" and I can't find anything added to TGB to actually let me add audio files to the project. I'm assuming that since there is a gui and an icon, I should see something added to TGB somewhere, right? Is this resource incompatible with TGB 1.7.2 or did I miss something?
02/16/2008 (6:42 pm)
I'm using TGB 1.7.2. I'm not sure I've added this resource correctly.I unzipped the AudioManagerTool directory to "TorqueGameBuilder-1.7.2\tgb\resources\AudioManagerTool". I copied the AudioManagerIcon.png to "TorqueGameBuilder-1.7.2\tgb\tools\levelEditor\gui\images" and the audioManagerInterfact.gui to "TorqueGameBuilder-1.7.2\tgb\tools\levelEditor\gui\images". I then modified the fieldTypes.ed.cs script.
I can add audio profiles to behaviors, but I think I missed something somewhere. The only selection I have under the behavior field drop down is "none" and I can't find anything added to TGB to actually let me add audio files to the project. I'm assuming that since there is a gui and an icon, I should see something added to TGB somewhere, right? Is this resource incompatible with TGB 1.7.2 or did I miss something?
#5
03/07/2008 (7:38 pm)
Very nice, I will take a look at this - thanks.
#6
["DescriptionName1" = name put in description & "ProfilesName1" = name put in profiles if there's any confusion]
Could the original poster or someone else shed light on how to fix this.
P.S... In case people had an issue with it like I did, the three files need to be put into a folder called "AudioManager" or something similar to show up in the RESOURCES folder in the following path:
"C:\Program Files\GageGames\TorqueGameBuilder-1.7.4\tgb\tools\resources"
to be accessible through the PROJECT>RESOURCES... menu in the editor.
01/19/2009 (8:32 pm)
Everything looks fine from inside the AudioManager. I can get all the info put in & get the sound to play. But when I go to test the game I get the following error message:Namespace::unlinkClass - cannot unlink namespace parent linkage for DescriptionName1 for ScriptObject. Error: cannot change namespace parent linkage of DescriptionName1 from ScriptObject to AudioDescription. LoadSoundData ProfilesName1 Namespace::unlinkClass - cannot unlink namespace parent linkage for ProfilesName1 for ScriptObject. Error: cannot change namespace parent linkage of ProfilesName1 from ScriptObject to AudioProfile.
["DescriptionName1" = name put in description & "ProfilesName1" = name put in profiles if there's any confusion]
Could the original poster or someone else shed light on how to fix this.
P.S... In case people had an issue with it like I did, the three files need to be put into a folder called "AudioManager" or something similar to show up in the RESOURCES folder in the following path:
"C:\Program Files\GageGames\TorqueGameBuilder-1.7.4\tgb\tools\resources"
to be accessible through the PROJECT>RESOURCES... menu in the editor.
#7
have added the three files to the ~\tgb\tools\resources in a folder called AudioManager
edited the .cs file and put that code on the end and saved it.
have added the png to the right place.
Now what?
Restarted tgb, and there is nothing new and I can't find it in the project>resources area..
What am I looking for, how do you add it? hellllp!
06/28/2009 (2:17 am)
What am I doing wrong?!have added the three files to the ~\tgb\tools\resources in a folder called AudioManager
edited the .cs file and put that code on the end and saved it.
have added the png to the right place.
Now what?
Restarted tgb, and there is nothing new and I can't find it in the project>resources area..
What am I looking for, how do you add it? hellllp!
#8
* following the OP's instructions strangely adds two icons to the TGB interface once the Audio Manager Tool is installed. they both do the same thing
* the Audio Manager Tool appears to be completely blank even though I have plenty of AudioProfiles already set up in my project. I really don't know what this is meant to do
* and probably related to the above, adding that field to a Behavior doesn't display a list of AudioProfiles, just a dropdown with "None"
Can anyone confirm this or help out? I'm really just looking for a way of adding AudioProfiles to a behavior dropdown and stumbled upon this thread through Google. Thanks.
12/15/2012 (10:51 pm)
I'm guessing this is old and outdated but as of TGB 1.7.6* following the OP's instructions strangely adds two icons to the TGB interface once the Audio Manager Tool is installed. they both do the same thing
* the Audio Manager Tool appears to be completely blank even though I have plenty of AudioProfiles already set up in my project. I really don't know what this is meant to do
* and probably related to the above, adding that field to a Behavior doesn't display a list of AudioProfiles, just a dropdown with "None"
Can anyone confirm this or help out? I'm really just looking for a way of adding AudioProfiles to a behavior dropdown and stumbled upon this thread through Google. Thanks.

Associate Phillip O'Shea
Violent Tulip