Changing S_TestSoundCallback() back to what it was before revision 1490 since calling into MultiVoc from the DirectSound buffer worker thread can cause deadlocks. TODO: make the callback value accurately point to the sound instance. Maybe change the type to intptr_t and directly pass a pointer?

git-svn-id: https://svn.eduke32.com/eduke32@1580 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
plagman 2010-01-05 04:57:51 +00:00
parent 102b702fc0
commit fb85ae604f

View file

@ -766,38 +766,47 @@ void S_Pan3D(void)
while (j--);
}
void S_TestSoundCallback(uint32_t num)
{
if ((int32_t)num == MUSIC_ID)
return;
if ((int32_t)num < 0)
{
if (lumplockbyte[-(int32_t)num] >= 200)
lumplockbyte[-(int32_t)num]--;
return;
}
{
int32_t j = 0;
while (j < g_sounds[num].num)
{
if (!FX_SoundActive(g_sounds[num].SoundOwner[j].voice))
{
int32_t i = g_sounds[num].SoundOwner[j].i;
g_sounds[num].num--;
// OSD_Printf("removing sound %d from spr %d\n",num,i);
if (sprite[i].picnum == MUSICANDSFX && sector[sprite[i].sectnum].lotag < 3 && sprite[i].lotag < 999)
ActorExtra[i].temp_data[0] = 0;
Bmemmove(&g_sounds[num].SoundOwner[j], &g_sounds[num].SoundOwner[j+1], sizeof(SOUNDOWNER) * (SOUNDMAX-j-1));
break;
}
j++;
}
}
g_soundlocks[num]--;
void S_TestSoundCallback(uint32_t num)
{
int32_t tempi,tempj,tempk;
if ((int32_t) num == MUSIC_ID)
{
return;
}
if((int32_t)num < 0)
{
if(lumplockbyte[-(int32_t)num] >= 200)
lumplockbyte[-(int32_t)num]--;
return;
}
tempk = g_sounds[num].num;
if (tempk > 0)
{
if ((g_sounds[num].m&16) == 0)
for (tempj=0; tempj<tempk; tempj++)
{
tempi = g_sounds[num].SoundOwner[tempj].i;
if (sprite[tempi].picnum == MUSICANDSFX && sector[sprite[tempi].sectnum].lotag < 3 && sprite[tempi].lotag < 999)
{
ActorExtra[tempi].temp_data[0] = 0;
if ((tempj + 1) < tempk)
{
g_sounds[num].SoundOwner[tempj].voice = g_sounds[num].SoundOwner[tempk-1].voice;
g_sounds[num].SoundOwner[tempj].i = g_sounds[num].SoundOwner[tempk-1].i;
}
break;
}
}
g_sounds[num].num--;
g_sounds[num].SoundOwner[tempk-1].i = -1;
}
g_soundlocks[num]--;
}
void S_ClearSoundLocks(void)