Audio/Profiles

From TDN

This page is a Work In Progress.



Contents

Introduction

All audio in the engine must be put into audioDescriptions and audioProfiles before they can be played.






AudioDescriptions

Every sound used in the engine must have some properties defined before you'll hear any noise. The common properties are defined in the AudioDescription datablock. Audio description datablocks have a volume, normally set at 1.0, or full volume. The range on this is 0.0 - 1.0 with the default of 1.0. They also contain a variable specifying whether or not it will be looped when called. For audio that is not part of the GUI, including button noises, or opening sequences, the is3D variable defines whether or not the position in the world affects how the audio sound.

All of the server side audioDescriptions default in Torque when you first download it will have the type variable set at "$SimAudioType". This is for the simulation type sounds. The other defined audio types are "$GuiAudioType" and "$MessageAudioType". You can define up to 32 different types of audio in the engine. (see ~\engine\platform\platformAudio.h)

For audio descriptions that have is3D set to true, the referenceDistance and maxDistance also need to be set. They define how close and far away you must be from the audio source in order to hear it. You can also set ConeInsideAngle, ConeOutsideAngle, ConeOutsideVolume and ConeVector to give a directional feel to the sound.

An example of an audiodescription is:

datablock AudioDescription(AudioDefault3d)
{
   volume   = 1.0;
   isLooping= false;

   is3D     = true;
   ReferenceDistance= 20.0;
   MaxDistance= 100.0;
   type     = $SimAudioType;
};






AudioProfiles

An audio profile datablock in Torquescript contains the path to the actual audio file, in either OGG Vorbis format or WAV format. It then includes the audioDescription , and whether or not the audio is preloaded.

An example of an audioprofile is:

datablock AudioProfile(audioName)
{
   filename = "~/data/sound/Audio.wav";
   description = "myaudioDescription";
   preload = false;
};






Audioprofiles.cs

Most of the audio profiles are placed in the "~\server\scripts\audioprofiles.cs" script file, along with the audio descriptions. The are some already placed in the Starter.fps mod, so they are great examples of the different audio types that you might be needing to use.






External Links

Ogg Vorbis Website - http://www.vorbis.com/
OpenAL Website - http://www.openal.org/