Changeset - r14267:7c0610071c99
[Not reviewed]
master
0 1 0
peter1138 - 14 years ago 2010-01-16 17:47:26
peter1138@openttd.org
(svn r18829) -Codechange: Don't free memory from within audio mixer callback handler as it may be required to be real-time safe.
1 file changed with 3 insertions and 4 deletions:
0 comments (0 inline, 0 general)
src/mixer.cpp
Show inline comments
 
@@ -141,9 +141,7 @@ static void mix_int8_to_int16(MixerChann
 

	
 
static void MxCloseChannel(MixerChannel *mc)
 
{
 
	free(mc->memory);
 
	mc->active = false;
 
	mc->memory = NULL;
 
}
 

	
 
void MxMixSamples(void *buffer, uint samples)
 
@@ -170,8 +168,9 @@ MixerChannel *MxAllocateChannel()
 
{
 
	MixerChannel *mc;
 
	for (mc = _channels; mc != endof(_channels); mc++)
 
		if (mc->memory == NULL) {
 
			mc->active = false;
 
		if (!mc->active) {
 
			free(mc->memory);
 
			mc->memory = NULL;
 
			return mc;
 
		}
 
	return NULL;
0 comments (0 inline, 0 general)