Sounds get mixed up
by Eric Hartman · in Torque Game Engine · 06/18/2004 (8:22 pm) · 48 replies
Surely theres a thread about this but I cant seem to find it.
When you join or host a game, disconnect, then re-join or re-host, the sounds get mixed up. In starter.fps all the different crossbow sounds become the explosion sound or in my game when you run the footstep sound is the thunder sound. It happens every single time.
When you join or host a game, disconnect, then re-join or re-host, the sounds get mixed up. In starter.fps all the different crossbow sounds become the explosion sound or in my game when you run the footstep sound is the thunder sound. It happens every single time.
About the author
#42
for the second one, do you not still need the resmanager->load called after you add it ? I haven't looked at it close enough to tell yet.
04/03/2005 (9:59 am)
Akio, thanks for the malbuffer 0 find..for the second one, do you not still need the resmanager->load called after you add it ? I haven't looked at it close enough to tell yet.
#43
Yes, very good find. I left that out when removing some debug dumps. Let me edit the above comment.
04/03/2005 (10:11 am)
Clint,Yes, very good find. I left that out when removing some debug dumps. Let me edit the above comment.
#45
here:
that ResourceManager->load should be using f2
then you don't have to do your buffer checks inside that loop I think as it'll never get there more than once for a given file.
6 in one hand, half a dozen in the other :)
04/03/2005 (10:33 am)
Ahh ok. I see right above that chunk of code. it looks like it thinks it's trying to load the ogg, but just tries to load the wav again..here:
if (bool(buffer) == false)
{
// wav file doesn't exist, try ogg file instead
S32 len = dStrlen(filename);
if (len>3 && !dStricmp(filename+len-4,".wav"))
{
f2 = (char*)FrameAllocator::alloc(len+1);
dStrcpy(f2,filename);
f2[len-3] = 'o';
f2[len-2] = 'g';
f2[len-1] = 'g';
buffer = ResourceManager->load(filename);
}
}that ResourceManager->load should be using f2
then you don't have to do your buffer checks inside that loop I think as it'll never get there more than once for a given file.
6 in one hand, half a dozen in the other :)
#46
Yes, I see what you're talking about. If you change the load to
Good find, again:)
04/03/2005 (10:41 am)
Clint,Yes, I see what you're talking about. If you change the load to
if (bool(buffer) == false)
{
// wav file doesn't exist, try ogg file instead
S32 len = dStrlen(filename);
if (len>3 && !dStricmp(filename+len-4,".wav"))
{
f2 = (char*)FrameAllocator::alloc(len+1);
dStrcpy(f2,filename);
f2[len-3] = 'o';
f2[len-2] = 'g';
f2[len-1] = 'g';
buffer = ResourceManager->load(f2);
}
}Then my original fix in this routine can be removed.Good find, again:)
#47
04/03/2005 (2:18 pm)
On my list to review this for 1.4
#48
this thread explains it alot better than I ever could. I definitely think Torque needs a major overhaul in the sound department. glad to hear you are working on that in 1.4 Ben :).
04/08/2005 (12:39 pm)
There is also an issue with sounds and 4x4 vehicles. www.garagegames.com/mg/forums/result.thread.php?qt=21938this thread explains it alot better than I ever could. I definitely think Torque needs a major overhaul in the sound department. glad to hear you are working on that in 1.4 Ben :).
Torque 3D Owner Kage
engine/audio/audioBuffer.cc
ALuint AudioBuffer::getALBuffer() { . . . // before exiting the function and right after alDeleteBuffers(1, &malBuffer); // (add this) clear the tag malBuffer = 0; return 0; }What was happening was that when reading a .wav or .ogg file fails (above the instructions, not shown) the malBuffer is released but the tag is not cleared. So, in subsequent entries to this function another audio file would actually allocate the same buffer then a previously failed attempt will reenter the function and validate a false malBuffer tag with this instructionif (alIsBuffer(malBuffer)) { return malBuffer; }Second bug is not related to "sound getting mixed up", but prevents a memory leak.
Resource<AudioBuffer> AudioBuffer::find(const char *filename) { . . . // replace the existing [i]else if[/i] statement with this else if (f2 && ResourceManager->getPathOf(f2)) { buffer = ResourceManager->load(f2); if (bool(buffer) == false) { AudioBuffer *temp = new AudioBuffer(StringTable->insert(f2)); ResourceManager->add(f2, temp); buffer = ResourceManager->load(f2); } } . . . }This eliminates new AudoBuffer being created on every entry to this condition.edit: corrected typos
edit: added the second load(f2)
edit: corrected some verbage