Game Development Community

AudioStreamSource alxStop Bug Fix

by Kirk Haynes · in Torque Game Engine · 12/15/2006 (9:00 am) · 2 replies

If you have created an audio stream source derived class and found that you were receiving the "alxStop: failed to find inactive looping source" fatal assert dialog, here's the fix.

// fails in audio.cc, on line 1000, with AssertFatal(tmp, "alxStop: failed to find inactive looping source");

change lines around line 1000 to:


//culled?
	StreamingList::iterator tmp = mStreamingCulledList.findImage(handle);
	if ( tmp )
		mStreamingCulledList.erase_fast(tmp);
 	//AssertFatal(tmp, "alxStop: failed to find inactive looping source");


Of course, commenting out the AssertFatal doesn't seem like a 'fix' but it is. Closing of audio stream sources now works properly with these changes and no errors are received.
The issue is that the stream source is not added to either the culled or inactive list, and at the end of alxStop the stream source is properly removed from the stream source list. The AssertFatal never let it get to that point.

#1
12/15/2006 (9:01 am)
Good one, thank you Kirk.
#2
12/15/2006 (10:08 am)
I remember looking at that code a while back, and it looked like spaghetti.
I would suggest that you merge the looped & streaming sound classes so that they both work off the same code, rather than being duplicated twice (and thus having more chance of crapping up).

As for the cause of the problem, sounds to me like bad design :)