mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-12-25 11:10:47 +00:00
git-svn-id: https://svn.eduke32.com/eduke32@1474 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
71cc476cb8
commit
c9c02c2773
1 changed files with 12 additions and 8 deletions
|
@ -134,9 +134,11 @@ const char *SDLDrv_ErrorString( int32_t ErrorNumber )
|
||||||
|
|
||||||
int32_t SDLDrv_Init(int32_t mixrate, int32_t numchannels, int32_t samplebits, void * initdata)
|
int32_t SDLDrv_Init(int32_t mixrate, int32_t numchannels, int32_t samplebits, void * initdata)
|
||||||
{
|
{
|
||||||
Uint32 inited;
|
uint32_t inited;
|
||||||
int32_t err = 0;
|
int32_t err = 0;
|
||||||
|
int32_t chunksize;
|
||||||
|
|
||||||
|
UNREFERENCED_PARAMETER(numchannels);
|
||||||
UNREFERENCED_PARAMETER(initdata);
|
UNREFERENCED_PARAMETER(initdata);
|
||||||
|
|
||||||
if (Initialised) {
|
if (Initialised) {
|
||||||
|
@ -159,11 +161,13 @@ int32_t SDLDrv_Init(int32_t mixrate, int32_t numchannels, int32_t samplebits, vo
|
||||||
return SDLErr_Error;
|
return SDLErr_Error;
|
||||||
}
|
}
|
||||||
|
|
||||||
// same problem occurs here as in the icculus driver...
|
chunksize = 512;
|
||||||
// we need a dummy channel so we don't fuck up the music
|
|
||||||
// thus numchannels + 1 here
|
|
||||||
|
|
||||||
err = Mix_OpenAudio(mixrate, (samplebits == 8) ? AUDIO_U8 : AUDIO_S16SYS, numchannels + 1, 512);
|
if (mixrate >= 16000) chunksize *= 2;
|
||||||
|
if (mixrate >= 32000) chunksize *= 2;
|
||||||
|
|
||||||
|
// allocate 4 channels: 2 for the game's SFX, 1 for music, and 1 for fillData()
|
||||||
|
err = Mix_OpenAudio(mixrate, (samplebits == 8) ? AUDIO_U8 : AUDIO_S16SYS, 4, chunksize);
|
||||||
|
|
||||||
if (err < 0) {
|
if (err < 0) {
|
||||||
ErrorCode = SDLErr_OpenAudio;
|
ErrorCode = SDLErr_OpenAudio;
|
||||||
|
@ -176,10 +180,10 @@ int32_t SDLDrv_Init(int32_t mixrate, int32_t numchannels, int32_t samplebits, vo
|
||||||
// dummy channel 2 runs our fillData() callback as an effect
|
// dummy channel 2 runs our fillData() callback as an effect
|
||||||
Mix_RegisterEffect(2, fillData, NULL, NULL);
|
Mix_RegisterEffect(2, fillData, NULL, NULL);
|
||||||
|
|
||||||
DummyBuffer = (uint8_t *) malloc(sizeof(intptr_t));
|
DummyBuffer = (uint8_t *) malloc(chunksize);
|
||||||
memset(DummyBuffer, 0, sizeof(intptr_t));
|
memset(DummyBuffer, 0, chunksize);
|
||||||
|
|
||||||
DummyChunk = Mix_QuickLoad_RAW(DummyBuffer, sizeof(intptr_t));
|
DummyChunk = Mix_QuickLoad_RAW(DummyBuffer, chunksize);
|
||||||
|
|
||||||
Mix_PlayChannel(2, DummyChunk, -1);
|
Mix_PlayChannel(2, DummyChunk, -1);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue