Fixes audio thread scheduling issue, where it gets always preempted by a tight sound-wait loop and gets no running time (on OpenBSD)
git-svn-id: svn://svn.code.sf.net/p/sc2/code/trunk@731 8092fc87-c524-0410-9efc-e669fe64eaf9
This commit is contained in:
@@ -718,8 +718,7 @@ EncounterBattle (void)
|
||||
|
||||
// FreeSC2Data ();
|
||||
// DestroyFont (ReleaseFont (MicroFont));
|
||||
while (SoundPlaying ())
|
||||
;
|
||||
WaitForSoundEnd (TFBSOUND_WAIT_ALL);
|
||||
// DestroySound (ReleaseSound (MenuSounds));
|
||||
|
||||
if (GLOBAL (glob_flags) & CYBORG_ENABLED)
|
||||
|
||||
@@ -72,6 +72,9 @@ extern void SetChannelRate (COUNT Channel, DWORD Rate, BYTE Priority);
|
||||
extern void StopSound (void);
|
||||
extern BOOLEAN SoundPlaying (void);
|
||||
|
||||
extern void WaitForSoundEnd (COUNT Channel);
|
||||
#define TFBSOUND_WAIT_ALL ((COUNT)~0)
|
||||
|
||||
extern BOOLEAN AllocHardwareSample (PBYTE lpSnd, DWORD SampleRate, COUNT
|
||||
SampleLength, COUNT LoopBegin, COUNT LoopLen);
|
||||
extern BOOLEAN FreeHardwareSample (PBYTE lpSnd, COUNT SampleLength);
|
||||
|
||||
@@ -1694,8 +1694,7 @@ DoMelee (INPUT_STATE InputState, PMELEE_STATE pMS)
|
||||
BuildAndDrawShipList (pMS);
|
||||
ClearSemaphore (GraphicsSem);
|
||||
|
||||
while (SoundPlaying ())
|
||||
;
|
||||
WaitForSoundEnd (TFBSOUND_WAIT_ALL);
|
||||
|
||||
SeedRandomNumbers ();
|
||||
load_gravity_well ((BYTE)((COUNT)TFB_Random () % NUMBER_OF_PLANET_TYPES));
|
||||
@@ -1895,8 +1894,7 @@ Melee (void)
|
||||
MenuState.star_bucks[1] = GetTeamValue (&MenuState.TeamImage[1]);
|
||||
DoInput ((PVOID)&MenuState);
|
||||
|
||||
while (SoundPlaying ())
|
||||
;
|
||||
WaitForSoundEnd (TFBSOUND_WAIT_ALL);
|
||||
|
||||
{
|
||||
FILE *save_fp;
|
||||
|
||||
@@ -313,8 +313,7 @@ ChangeSelection:
|
||||
|
||||
PlaySoundEffect (SetAbsSoundIndex (MenuSounds, 1), 0, 0);
|
||||
|
||||
while (ChannelPlaying (0))
|
||||
;
|
||||
WaitForSoundEnd (0);
|
||||
}
|
||||
|
||||
return (hBattleShip);
|
||||
|
||||
@@ -257,8 +257,7 @@ OldContext = SetContext (SpaceContext);
|
||||
if (hBattleShip == GetTailLink (&race_q[0]))
|
||||
battle_counter = MAKE_WORD (1, HIBYTE (battle_counter));
|
||||
|
||||
while (ChannelPlaying (0))
|
||||
;
|
||||
WaitForSoundEnd (0);
|
||||
}
|
||||
|
||||
// DestroySound (ReleaseSound (MenuSounds));
|
||||
|
||||
@@ -239,7 +239,7 @@ LastActivity = WON_LAST_BATTLE;
|
||||
#ifdef TESTING
|
||||
if (GLOBAL (CurrentActivity) & CHECK_ABORT)
|
||||
{
|
||||
while (SoundPlaying ());
|
||||
WaitForSoundEnd (WAIT_ALL_SOUNDS);
|
||||
StopSound ();
|
||||
|
||||
FreeSC2Data ();
|
||||
|
||||
Reference in New Issue
Block a user