1
0
mirror of synced 2024-11-27 22:50:47 +01:00

Make it slightly better

This commit is contained in:
Bobby Dilley 2022-08-02 12:12:27 +01:00
parent 2dab9f406f
commit 20599f5946

View File

@ -93,9 +93,9 @@ typedef struct
struct tsf_region *region;
} segaapiContext_t;
LPALBUFFERSAMPLESSOFT alBufferSamplesSOFT = NULL;
LPALBUFFERSUBSAMPLESSOFT alBufferSubSamplesSOFT = NULL;
LPALGETBUFFERSAMPLESSOFT alGetBufferSamplesSOFT = NULL;
// LPALBUFFERSAMPLESSOFT alBufferSamplesSOFT = NULL;
// LPALBUFFERSUBSAMPLESSOFT alBufferSubSamplesSOFT = NULL;
// LPALGETBUFFERSAMPLESSOFT alGetBufferSamplesSOFT = NULL;
#ifdef DEBUG_OUTPUT
void dbgPrint(const char *format, ...)
@ -292,14 +292,19 @@ static void updateBufferLoop(segaapiContext_t *context)
return;
}
void AL_APIENTRY wrap_BufferSamples(ALuint buffer, ALuint samplerate,
ALenum internalformat, ALsizei samples,
ALenum channels, ALenum type,
const ALvoid *data)
void AL_APIENTRY alBufferSamplesSOFT(ALuint buffer, ALuint samplerate, ALenum internalformat, ALsizei samples, ALenum channels, ALenum type, const ALvoid *data)
{
alBufferData(buffer, internalformat, data,
FramesToBytes(samples, channels, type),
samplerate);
alBufferData(buffer, internalformat, data, FramesToBytes(samples, channels, type), samplerate);
}
AL_API void AL_APIENTRY alBufferSubSamplesSOFT(ALuint buffer, ALsizei offset, ALsizei samples, ALenum channels, ALenum type, const ALvoid *data, ALuint samplerate, ALenum internalformat)
{
ALsizei FrameSize = FramesToBytes(samples, channels, type);
offset *= FrameSize;
alBufferData(buffer + offset, internalformat, data, FrameSize, samplerate);
}
static void updateBufferData(segaapiContext_t *context, unsigned int offset, size_t length)
@ -359,11 +364,8 @@ static void updateBufferData(segaapiContext_t *context, unsigned int offset, siz
// CHECK();
if (offset != -1)
{
// printf("CANNOT DO IT\n");
// exit(1);
wrap_BufferSamples(context->alBuffer, context->sampleRate, alFormat, context->size / bufferSampleSize(context), alChannels, alType, &(context->data[offset]));
// alBufferSubSamplesSOFT(context->alBuffer, offset / bufferSampleSize(context), length / bufferSampleSize(context), alChannels, alType, &context->data[offset]);
alBufferSubSamplesSOFT(context->alBuffer, offset / bufferSampleSize(context), length / bufferSampleSize(context), alChannels, alType, &context->data[offset], context->sampleRate, alFormat);
// CHECK();
dbgPrint("Soft update in buffer %X at %u (%u bytes) - buffer playing at %u, unsafe region is %u to %u\n", (uintptr_t)context, offset, length, position, unsafe[0], unsafe[1]);
}
@ -372,7 +374,7 @@ static void updateBufferData(segaapiContext_t *context, unsigned int offset, siz
alSourcei(context->alSource, AL_BUFFER, AL_NONE);
// CHECK();
wrap_BufferSamples(context->alBuffer, context->sampleRate, alFormat, context->size / bufferSampleSize(context), alChannels, alType, context->data);
alBufferSamplesSOFT(context->alBuffer, context->sampleRate, alFormat, context->size / bufferSampleSize(context), alChannels, alType, context->data);
// CHECK();
alSourcei(context->alSource, AL_BUFFER, context->alBuffer);
// CHECK();
@ -1135,7 +1137,7 @@ int SEGAAPI_Init(void)
dbgPrint("SEGAAPI_Init() alutInit failed");
return SEGAERR_FAIL;
}
/*
alBufferSamplesSOFT = alGetProcAddress("alBufferSamplesSOFT");
if (alBufferSamplesSOFT == NULL)
{
@ -1155,7 +1157,7 @@ int SEGAAPI_Init(void)
dbgPrint("Warning: Could not resolve AL extension!\n");
// exit(1);
}
*/
SEGAAPI_SetGlobalEAXProperty((GUID *)&EAXPROPERTYID_EAX40_FXSlot2, 0, (void *)&EAX_NULL_GUID, 16);
SEGAAPI_SetSPDIFOutChannelRouting(0, 0);