mirror of
https://github.com/OpenDriver2/REDRIVER2.git
synced 2024-11-22 10:22:48 +01:00
- [Psy-X] exit flow changes
This commit is contained in:
parent
d50eb36a37
commit
2d0242fda7
@ -162,7 +162,7 @@ int intrThreadMain(void* data)
|
|||||||
{
|
{
|
||||||
Util_InitHPCTimer(&g_vblTimer);
|
Util_InitHPCTimer(&g_vblTimer);
|
||||||
|
|
||||||
do
|
while (!g_stopIntrThread)
|
||||||
{
|
{
|
||||||
// step counters
|
// step counters
|
||||||
{
|
{
|
||||||
@ -185,10 +185,7 @@ int intrThreadMain(void* data)
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
// TODO:...
|
|
||||||
|
|
||||||
} while (!g_stopIntrThread);
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -957,22 +954,19 @@ void PsyX_Shutdown()
|
|||||||
|
|
||||||
int returnValue;
|
int returnValue;
|
||||||
SDL_WaitThread(g_intrThread, &returnValue);
|
SDL_WaitThread(g_intrThread, &returnValue);
|
||||||
}
|
|
||||||
|
|
||||||
if (g_intrMutex)
|
|
||||||
SDL_DestroyMutex(g_intrMutex);
|
SDL_DestroyMutex(g_intrMutex);
|
||||||
|
}
|
||||||
GR_Shutdown();
|
|
||||||
SpuQuit();
|
|
||||||
|
|
||||||
SDL_QuitSubSystem(SDL_INIT_GAMECONTROLLER);
|
|
||||||
|
|
||||||
SDL_DestroyWindow(g_window);
|
SDL_DestroyWindow(g_window);
|
||||||
g_window = NULL;
|
g_window = NULL;
|
||||||
|
|
||||||
|
GR_Shutdown();
|
||||||
|
SDL_QuitSubSystem(SDL_INIT_GAMECONTROLLER);
|
||||||
|
|
||||||
SDL_Quit();
|
SDL_Quit();
|
||||||
|
|
||||||
PsyX_Log_Finalise();
|
|
||||||
|
|
||||||
UnInstallExceptionHandler();
|
UnInstallExceptionHandler();
|
||||||
|
|
||||||
|
PsyX_Log_Finalise();
|
||||||
}
|
}
|
||||||
|
@ -76,6 +76,7 @@ typedef struct
|
|||||||
|
|
||||||
static SPUMemory s_SpuMemory;
|
static SPUMemory s_SpuMemory;
|
||||||
SDL_mutex* g_SpuMutex = NULL;
|
SDL_mutex* g_SpuMutex = NULL;
|
||||||
|
int g_spuInit = 0;
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
@ -105,8 +106,7 @@ LPALGENAUXILIARYEFFECTSLOTS alGenAuxiliaryEffectSlots = NULL;
|
|||||||
LPALDELETEAUXILIARYEFFECTSLOTS alDeleteAuxiliaryEffectSlots = NULL;
|
LPALDELETEAUXILIARYEFFECTSLOTS alDeleteAuxiliaryEffectSlots = NULL;
|
||||||
LPALAUXILIARYEFFECTSLOTI alAuxiliaryEffectSloti = NULL;
|
LPALAUXILIARYEFFECTSLOTI alAuxiliaryEffectSloti = NULL;
|
||||||
|
|
||||||
|
void PsyX_SPU_InitOpenAlEffects()
|
||||||
void InitOpenAlEffects()
|
|
||||||
{
|
{
|
||||||
g_ALEffectsSupported = 0;
|
g_ALEffectsSupported = 0;
|
||||||
|
|
||||||
@ -153,7 +153,7 @@ void InitOpenAlEffects()
|
|||||||
alAuxiliaryEffectSloti(g_ALEffectSlots[g_currEffectSlotIdx], AL_EFFECTSLOT_EFFECT, g_nAlReverbEffect);
|
alAuxiliaryEffectSloti(g_ALEffectSlots[g_currEffectSlotIdx], AL_EFFECTSLOT_EFFECT, g_nAlReverbEffect);
|
||||||
}
|
}
|
||||||
|
|
||||||
int PsyX_InitSound()
|
int PsyX_SPU_InitSound()
|
||||||
{
|
{
|
||||||
int numDevices, alErr, i;
|
int numDevices, alErr, i;
|
||||||
const char* devices;
|
const char* devices;
|
||||||
@ -241,14 +241,14 @@ int PsyX_InitSound()
|
|||||||
|
|
||||||
memset(&s_SpuMemory, 0, sizeof(s_SpuMemory));
|
memset(&s_SpuMemory, 0, sizeof(s_SpuMemory));
|
||||||
|
|
||||||
InitOpenAlEffects();
|
PsyX_SPU_InitOpenAlEffects();
|
||||||
|
|
||||||
g_SpuMutex = SDL_CreateMutex();
|
g_SpuMutex = SDL_CreateMutex();
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void PsyX_ShutdownSound()
|
void PsyX_SPU_ShutdownSound()
|
||||||
{
|
{
|
||||||
if (!g_ALCcontext)
|
if (!g_ALCcontext)
|
||||||
return;
|
return;
|
||||||
@ -475,7 +475,7 @@ long SpuIsTransferCompleted(long flag)
|
|||||||
|
|
||||||
void SpuStart()
|
void SpuStart()
|
||||||
{
|
{
|
||||||
PsyX_InitSound();
|
PsyX_SPU_InitSound();
|
||||||
}
|
}
|
||||||
|
|
||||||
void _SpuInit(int a0)
|
void _SpuInit(int a0)
|
||||||
@ -489,6 +489,7 @@ void _SpuInit(int a0)
|
|||||||
}
|
}
|
||||||
|
|
||||||
SpuStart();
|
SpuStart();
|
||||||
|
g_spuInit = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SpuInit(void)
|
void SpuInit(void)
|
||||||
@ -498,8 +499,8 @@ void SpuInit(void)
|
|||||||
|
|
||||||
void SpuQuit(void)
|
void SpuQuit(void)
|
||||||
{
|
{
|
||||||
// do nothing!
|
g_spuInit = 0;
|
||||||
PsyX_ShutdownSound();
|
PsyX_SPU_ShutdownSound();
|
||||||
}
|
}
|
||||||
|
|
||||||
void UpdateVoiceSample(SPUVoice* voice)
|
void UpdateVoiceSample(SPUVoice* voice)
|
||||||
@ -590,6 +591,11 @@ void SpuSetVoiceAttr(SpuVoiceAttr *arg)
|
|||||||
ALuint alSource;
|
ALuint alSource;
|
||||||
float pitch, left_gain, right_gain, pan;
|
float pitch, left_gain, right_gain, pan;
|
||||||
|
|
||||||
|
if (!g_spuInit)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
SDL_LockMutex(g_SpuMutex);
|
SDL_LockMutex(g_SpuMutex);
|
||||||
|
|
||||||
for (int i = 0; i < SPU_VOICES; i++)
|
for (int i = 0; i < SPU_VOICES; i++)
|
||||||
@ -675,6 +681,11 @@ void SpuSetKey(long on_off, unsigned long voice_bit)
|
|||||||
SPUVoice* voice;
|
SPUVoice* voice;
|
||||||
ALuint alSource;
|
ALuint alSource;
|
||||||
|
|
||||||
|
if (!g_spuInit)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
SDL_LockMutex(g_SpuMutex);
|
SDL_LockMutex(g_SpuMutex);
|
||||||
for (int i = 0; i < SPU_VOICES; i++)
|
for (int i = 0; i < SPU_VOICES; i++)
|
||||||
{
|
{
|
||||||
@ -777,6 +788,11 @@ long SpuSetReverb(long on_off)
|
|||||||
long old_state = g_enableSPUReverb;
|
long old_state = g_enableSPUReverb;
|
||||||
g_enableSPUReverb = on_off;
|
g_enableSPUReverb = on_off;
|
||||||
|
|
||||||
|
if (!g_spuInit)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// switch if needed
|
// switch if needed
|
||||||
if (g_ALEffectsSupported && old_state != g_enableSPUReverb)
|
if (g_ALEffectsSupported && old_state != g_enableSPUReverb)
|
||||||
{
|
{
|
||||||
@ -846,6 +862,11 @@ unsigned long SpuSetReverbVoice(long on_off, unsigned long voice_bit)
|
|||||||
SPUVoice* voice;
|
SPUVoice* voice;
|
||||||
ALuint alSource;
|
ALuint alSource;
|
||||||
|
|
||||||
|
if (!g_spuInit)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if(!g_ALEffectsSupported)
|
if(!g_ALEffectsSupported)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user