mirror of
https://github.com/OpenDriver2/REDRIVER2.git
synced 2024-11-22 18:32:42 +01:00
- [Psy-X] Fix SPU-AL not working in emscripten
This commit is contained in:
parent
612b03f261
commit
6172b52ab8
@ -158,17 +158,26 @@ bool PsyX_InitSound()
|
|||||||
if (g_ALCdevice)
|
if (g_ALCdevice)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
int numDevices = 0;
|
||||||
|
|
||||||
// Init openAL
|
// Init openAL
|
||||||
// check devices list
|
// check devices list
|
||||||
char* devices = (char*)alcGetString(nullptr, ALC_DEVICE_SPECIFIER);
|
const char* devices;
|
||||||
|
|
||||||
|
const char* devStrptr = alcGetString(nullptr, ALC_DEVICE_SPECIFIER);
|
||||||
|
devices = devStrptr;
|
||||||
|
|
||||||
// go through device list (each device terminated with a single NULL, list terminated with double NULL)
|
// go through device list (each device terminated with a single NULL, list terminated with double NULL)
|
||||||
while ((*devices) != '\0')
|
while ((*devStrptr) != '\0')
|
||||||
{
|
{
|
||||||
eprintinfo("found sound device: %s\n", devices);
|
eprintinfo("found sound device: %s\n", devStrptr);
|
||||||
devices += strlen(devices) + 1;
|
devStrptr += strlen(devStrptr) + 1;
|
||||||
|
numDevices++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(numDevices == 0)
|
||||||
|
return false;
|
||||||
|
|
||||||
g_ALCdevice = alcOpenDevice(NULL);
|
g_ALCdevice = alcOpenDevice(NULL);
|
||||||
|
|
||||||
int alErr = AL_NO_ERROR;
|
int alErr = AL_NO_ERROR;
|
||||||
@ -180,6 +189,7 @@ bool PsyX_InitSound()
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef __EMSCRIPTEN__
|
||||||
// out_channel_formats snd_outputchannels
|
// out_channel_formats snd_outputchannels
|
||||||
int al_context_params[] =
|
int al_context_params[] =
|
||||||
{
|
{
|
||||||
@ -187,8 +197,10 @@ bool PsyX_InitSound()
|
|||||||
ALC_MAX_AUXILIARY_SENDS, 2,
|
ALC_MAX_AUXILIARY_SENDS, 2,
|
||||||
0
|
0
|
||||||
};
|
};
|
||||||
|
|
||||||
g_ALCcontext = alcCreateContext(g_ALCdevice, al_context_params);
|
g_ALCcontext = alcCreateContext(g_ALCdevice, al_context_params);
|
||||||
|
#else
|
||||||
|
g_ALCcontext = alcCreateContext(g_ALCdevice, NULL);
|
||||||
|
#endif
|
||||||
|
|
||||||
alErr = alcGetError(g_ALCdevice);
|
alErr = alcGetError(g_ALCdevice);
|
||||||
if (alErr != AL_NO_ERROR)
|
if (alErr != AL_NO_ERROR)
|
||||||
|
Loading…
Reference in New Issue
Block a user