Audio script (solved, commands included)
by Drew -Gaiiden- Sikora · in Torque Game Builder · 07/02/2005 (11:53 pm) · 9 replies
I'm feeling like a moron right now, but where the heck can I find info on the audio scripting? All I know how to do so far is set up audio profiles and play the file (thx to Philip's game source). I'd hate to have to keep trolling through source in order to pick up all these audio commands, like stopping (I think I stumbled upon that already), changing the volume, pan, fading in and out, and all that stuff. Where's the repository for that? been looking around the resources for almost half an hour now.
#2
alxIsPlaying(handle) - returns true/false to tell you if clip is playing or not
alxGetChannelVolume(channel) - returns the volume of a given channel (the "type" field in AudioDescription datablocks)
alxSetChannelVolume(channel, volume) - sets volume of given channel linearly
alxStop(handle) - stops the given clip
alxStopAll() - stops all clips playing
Additionally, the alxSetChannelVolume command needs a bit of explaining. If you defined the audio as having a volume of 1.0 in the AudioDescription datablock, then all volume settings are based off that as max. So half volume would be 0.5.
07/13/2005 (9:08 pm)
Okay I stopped by Borders and looked it up in 3D Game Programming All In One. For anyone else who needs em:alxIsPlaying(handle) - returns true/false to tell you if clip is playing or not
alxGetChannelVolume(channel) - returns the volume of a given channel (the "type" field in AudioDescription datablocks)
alxSetChannelVolume(channel, volume) - sets volume of given channel linearly
alxStop(handle) - stops the given clip
alxStopAll() - stops all clips playing
Additionally, the alxSetChannelVolume command needs a bit of explaining. If you defined the audio as having a volume of 1.0 in the AudioDescription datablock, then all volume settings are based off that as max. So half volume would be 0.5.
#3
//-----what goes here?-----
Put audio track1 in channel 1
Put audio track2 in channel 2
//-------------------------------
alxSetChannelVolume( 1, volume );
alxSetChannelVolume( 2, volume );
I'm using beta 1.1, THanks!!
04/18/2006 (1:34 pm)
How does one put 2 different audio tracks in 2 different channels, so that we change the volume of each channel individually. //-----what goes here?-----
Put audio track1 in channel 1
Put audio track2 in channel 2
//-------------------------------
alxSetChannelVolume( 1, volume );
alxSetChannelVolume( 2, volume );
I'm using beta 1.1, THanks!!
#4
AudioDescriptions let you set the volume, looping, 3D/2D sound, streaming/non-streaming, and 'type'. Type really means 'channel'. So define the following:
When you define your music, make their descriptions equal 'MusicLooping', and for sound effects use 'AudioNonLooping' and they will be on channels 1 and 2 respectively.
04/18/2006 (2:01 pm)
Look in your sound AudioProfile definitions, you'll see a 'description' field. This references an AudioDescription you've defined elsewhere. AudioDescriptions let you set the volume, looping, 3D/2D sound, streaming/non-streaming, and 'type'. Type really means 'channel'. So define the following:
new AudioDescription(MusicLooping)
{
volume = 1.0;
isLooping = true;
is3D = false;
isStreaming = false;
type = 1;
};
new AudioDescription(AudioNonLooping)
{
volume = 1.0;
isLooping = false;
is3D = false;
type = 2;
};When you define your music, make their descriptions equal 'MusicLooping', and for sound effects use 'AudioNonLooping' and they will be on channels 1 and 2 respectively.
#5
Credit given to the author Ed Maurina and also Anthony Fullmer who is formating it to work on TDN.
04/20/2006 (8:34 am)
Check out this new TDN Article that a new intern here (Anthony Fullmer) is porting to the site. This is some of the reference from GPGT (Game Programmer's Guide to Torque)... Credit given to the author Ed Maurina and also Anthony Fullmer who is formating it to work on TDN.
#6
I tried using the type property to separate the audio channels, but it doesn't work. When I turn down the volume of channel 1, channel 2 also goes down.
How can this be done correctly?
Thanks
03/24/2007 (1:53 pm)
@Luke,I tried using the type property to separate the audio channels, but it doesn't work. When I turn down the volume of channel 1, channel 2 also goes down.
How can this be done correctly?
Thanks
#7
03/24/2007 (2:38 pm)
@Kevin, how are you changing the volume for the specific channel? Sounds like you may be adjusting the master volume by mistake. The common/gameScripts/options.cs file has the 'stock' volume control functions and are a good reference for this.
#8
03/24/2007 (7:34 pm)
Thanks Luke! You are exactly right!
#9
03/27/2007 (12:12 am)
Not sure if you guys have seen this yet or not but it's a real useful resource. VMPlayer. You do need to edit some C++ code and recompile (the files are included so you can just copy-over) but it's well worth it (includes code fixes and stuff, too). Further, if you're looking to figure out how to access volumes and what-not, you could scan through the vmplayer.cs file and see how Rob did it.
Torque Owner Drew -Gaiiden- Sikora