Problem with Audio
by Anthony Rosenbaum · in Torque Game Engine · 07/20/2003 (6:28 pm) · 4 replies
In common/clients/audio.cs
we were doing some tests on the channels to make sure things get set we put into OpenAlInit()
so I checked the hard code and noticed this in audioFunctions.cc
we were doing some tests on the channels to make sure things get set we put into OpenAlInit()
for (%channel=1; %channel <= 8; %channel++)
{
%volume = $pref::Audio::channelVolume[%channel];
alxSetChannelVolume(%channel, %volume);
echo("Audio Volume Init. Channel " @ %channel @ " set to " @ %volume);
echo("Actual channel volume is now: " @ alxGetChannelVolume(%channel));
}but the console readsQuote:
Audio Volume Init. Channel 1 set to 0.8
Actual channel volume is now: 0
Audio Volume Init. Channel 2 set to 0.8
Actual channel volume is now: 0
Audio Volume Init. Channel 3 set to 0.8
Actual channel volume is now: 0
Audio Volume Init. Channel 4 set to 0.8
Actual channel volume is now: 0
Audio Volume Init. Channel 5 set to 0.8
Actual channel volume is now: 0
Audio Volume Init. Channel 6 set to 0.8
Actual channel volume is now: 0
Audio Volume Init. Channel 7 set to 0.8
Actual channel volume is now: 0
Audio Volume Init. Channel 8 set to 0.8
Actual channel volume is now: 0
so I checked the hard code and noticed this in audioFunctions.cc
//--------------------------------------------------------------------------
// Channel Volumes
//--------------------------------------------------------------------------
ConsoleFunction(alxGetChannelVolume, S32, 2, 2, "alxGetChannelVolume(channel_id)")
{
U32 type = dAtoi(argv[1]);
if(type >= Audio::NumAudioTypes)
{
Con::errorf(ConsoleLogEntry::General, "alxGetChannelVolume: invalid channel '%d'", dAtoi(argv[1]));
return(0.f);
}
return(mAudioTypeVolume[type]);
}
//-----------------------------------------------
ConsoleFunction(alxSetChannelVolume, bool, 3, 3, "alxGetChannelVolume(channel_id, volume 0.0-1.0)")
{
U32 type = dAtoi(argv[1]);
F32 volume = mClampF(dAtof(argv[2]), 0.f, 1.f);
if(type >= Audio::NumAudioTypes)
{
Con::errorf(ConsoleLogEntry::General, "alxSetChannelVolume: channel '%d' out of range [0, %d]", dAtoi(argv[1]), Audio::NumAudioTypes);
return false;
}
mAudioTypeVolume[type] = volume;
alxUpdateTypeGain(type);
return true;
} this second Console function , alxSetChannelVolume() seems to have a typo, but if I correct it (by changing the alxGetChannelVolume to alxSetChannelVolume) nothing happens. If I try in it's origial state and call the alxSetChannelVolume() by actually calling alxGetChannelVolume() with 2 augments I get and error. Needless to say the console functions confuse me can anyone help? IS THIS A BUG?About the author
Torque Owner DNADMG
OptAudioUpdateChannelVolume(%channel, %volume);
valid channels are 1-8.
the starter mods use 1,2, and 3 for gui,sim, and message channel volumes.