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:
avolkov
2003-02-11 11:00:24 +00:00
parent 8fdf5c85d7
commit 6938c61ed6
6 changed files with 9 additions and 11 deletions
+1 -2
View File
@@ -718,8 +718,7 @@ EncounterBattle (void)
// FreeSC2Data (); // FreeSC2Data ();
// DestroyFont (ReleaseFont (MicroFont)); // DestroyFont (ReleaseFont (MicroFont));
while (SoundPlaying ()) WaitForSoundEnd (TFBSOUND_WAIT_ALL);
;
// DestroySound (ReleaseSound (MenuSounds)); // DestroySound (ReleaseSound (MenuSounds));
if (GLOBAL (glob_flags) & CYBORG_ENABLED) if (GLOBAL (glob_flags) & CYBORG_ENABLED)
+3
View File
@@ -72,6 +72,9 @@ extern void SetChannelRate (COUNT Channel, DWORD Rate, BYTE Priority);
extern void StopSound (void); extern void StopSound (void);
extern BOOLEAN SoundPlaying (void); extern BOOLEAN SoundPlaying (void);
extern void WaitForSoundEnd (COUNT Channel);
#define TFBSOUND_WAIT_ALL ((COUNT)~0)
extern BOOLEAN AllocHardwareSample (PBYTE lpSnd, DWORD SampleRate, COUNT extern BOOLEAN AllocHardwareSample (PBYTE lpSnd, DWORD SampleRate, COUNT
SampleLength, COUNT LoopBegin, COUNT LoopLen); SampleLength, COUNT LoopBegin, COUNT LoopLen);
extern BOOLEAN FreeHardwareSample (PBYTE lpSnd, COUNT SampleLength); extern BOOLEAN FreeHardwareSample (PBYTE lpSnd, COUNT SampleLength);
+2 -4
View File
@@ -1694,8 +1694,7 @@ DoMelee (INPUT_STATE InputState, PMELEE_STATE pMS)
BuildAndDrawShipList (pMS); BuildAndDrawShipList (pMS);
ClearSemaphore (GraphicsSem); ClearSemaphore (GraphicsSem);
while (SoundPlaying ()) WaitForSoundEnd (TFBSOUND_WAIT_ALL);
;
SeedRandomNumbers (); SeedRandomNumbers ();
load_gravity_well ((BYTE)((COUNT)TFB_Random () % NUMBER_OF_PLANET_TYPES)); 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]); MenuState.star_bucks[1] = GetTeamValue (&MenuState.TeamImage[1]);
DoInput ((PVOID)&MenuState); DoInput ((PVOID)&MenuState);
while (SoundPlaying ()) WaitForSoundEnd (TFBSOUND_WAIT_ALL);
;
{ {
FILE *save_fp; FILE *save_fp;
+1 -2
View File
@@ -313,8 +313,7 @@ ChangeSelection:
PlaySoundEffect (SetAbsSoundIndex (MenuSounds, 1), 0, 0); PlaySoundEffect (SetAbsSoundIndex (MenuSounds, 1), 0, 0);
while (ChannelPlaying (0)) WaitForSoundEnd (0);
;
} }
return (hBattleShip); return (hBattleShip);
+1 -2
View File
@@ -257,8 +257,7 @@ OldContext = SetContext (SpaceContext);
if (hBattleShip == GetTailLink (&race_q[0])) if (hBattleShip == GetTailLink (&race_q[0]))
battle_counter = MAKE_WORD (1, HIBYTE (battle_counter)); battle_counter = MAKE_WORD (1, HIBYTE (battle_counter));
while (ChannelPlaying (0)) WaitForSoundEnd (0);
;
} }
// DestroySound (ReleaseSound (MenuSounds)); // DestroySound (ReleaseSound (MenuSounds));
+1 -1
View File
@@ -239,7 +239,7 @@ LastActivity = WON_LAST_BATTLE;
#ifdef TESTING #ifdef TESTING
if (GLOBAL (CurrentActivity) & CHECK_ABORT) if (GLOBAL (CurrentActivity) & CHECK_ABORT)
{ {
while (SoundPlaying ()); WaitForSoundEnd (WAIT_ALL_SOUNDS);
StopSound (); StopSound ();
FreeSC2Data (); FreeSC2Data ();