diff options
-rw-r--r-- | Alc/ALc.c | 8 | ||||
-rw-r--r-- | OpenAL32/Include/alMain.h | 6 |
2 files changed, 10 insertions, 4 deletions
@@ -2885,11 +2885,11 @@ ALC_API ALCcontext* ALC_APIENTRY alcCreateContext(ALCdevice *device, const ALCin return NULL; } - ALContext = calloc(1, sizeof(ALCcontext)+15+sizeof(ALlistener)); + ALContext = calloc(1, sizeof(ALCcontext)+sizeof(ALlistener)); if(ALContext) { ALContext->ref = 1; - ALContext->Listener = (ALlistener*)(((ALintptrEXT)(ALContext+1)+15)&~15); + ALContext->Listener = (ALlistener*)ALContext->_listener_mem; ALContext->MaxActiveSources = 256; ALContext->ActiveSources = calloc(ALContext->MaxActiveSources, @@ -3067,7 +3067,7 @@ ALC_API ALCdevice* ALC_APIENTRY alcOpenDevice(const ALCchar *deviceName) if(deviceName && (!deviceName[0] || strcasecmp(deviceName, alcDefaultName) == 0 || strcasecmp(deviceName, "openal-soft") == 0)) deviceName = NULL; - device = al_calloc(16, sizeof(ALCdevice)+15+sizeof(ALeffectslot)); + device = al_calloc(16, sizeof(ALCdevice)+sizeof(ALeffectslot)); if(!device) { alcSetError(NULL, ALC_OUT_OF_MEMORY); @@ -3280,7 +3280,7 @@ ALC_API ALCdevice* ALC_APIENTRY alcOpenDevice(const ALCchar *deviceName) if(DefaultEffect.type != AL_EFFECT_NULL) { - device->DefaultSlot = (ALeffectslot*)(((ALintptrEXT)(device+1)+15)&~15); + device->DefaultSlot = (ALeffectslot*)device->_slot_mem; if(InitEffectSlot(device->DefaultSlot) != AL_NO_ERROR) { device->DefaultSlot = NULL; diff --git a/OpenAL32/Include/alMain.h b/OpenAL32/Include/alMain.h index b62ad9c7..a00f2d4c 100644 --- a/OpenAL32/Include/alMain.h +++ b/OpenAL32/Include/alMain.h @@ -686,6 +686,9 @@ struct ALCdevice_struct void *ExtraData; // For the backend's use ALCdevice *volatile next; + + /* Memory space used by the default slot (Playback devices only) */ + ALIGN(16) ALCbyte _slot_mem[]; }; // Frequency was requested by the app or config file @@ -752,6 +755,9 @@ struct ALCcontext_struct const ALCchar *ExtensionList; ALCcontext *volatile next; + + /* Memory space used by the listener */ + ALIGN(16) ALCbyte _listener_mem[]; }; ALCcontext *GetContextRef(void); |