aboutsummaryrefslogtreecommitdiffstats
path: root/OpenAL32/alAuxEffectSlot.c
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2007-12-18 13:42:13 -0800
committerChris Robinson <[email protected]>2007-12-18 13:42:13 -0800
commitd4f556836aa434116d3e6384f4aa5465ff5d7ec3 (patch)
treec700443f63c19df73cacd3aeb1314c1ae929617c /OpenAL32/alAuxEffectSlot.c
parentebb30ec5b0e219fdf2b21fbfdd1be6e17cb31376 (diff)
Only allow one auxiliary effect slot
Diffstat (limited to 'OpenAL32/alAuxEffectSlot.c')
-rw-r--r--OpenAL32/alAuxEffectSlot.c46
1 files changed, 26 insertions, 20 deletions
diff --git a/OpenAL32/alAuxEffectSlot.c b/OpenAL32/alAuxEffectSlot.c
index 923c914d..697589ee 100644
--- a/OpenAL32/alAuxEffectSlot.c
+++ b/OpenAL32/alAuxEffectSlot.c
@@ -42,32 +42,38 @@ AL_API ALvoid AL_APIENTRY alGenAuxiliaryEffectSlots(ALsizei n, ALuint *effectslo
if (n > 0)
{
- // Check that enough memory has been allocted in the 'sources' array for n Sources
- if (!IsBadWritePtr((void*)effectslots, n * sizeof(ALuint)))
+ /* NOTE: We only support one slot currently */
+ if(n == 1 && g_AuxiliaryEffectSlotCount == 0)
{
- ALeffectslot **list = &g_AuxiliaryEffectSlotList;
- while(*list)
- list = &(*list)->next;
-
- i = 0;
- while(i < n)
+ // Check that enough memory has been allocted in the 'sources' array for n Sources
+ if (!IsBadWritePtr((void*)effectslots, n * sizeof(ALuint)))
{
- *list = calloc(1, sizeof(ALeffectslot));
- if(!(*list))
+ ALeffectslot **list = &g_AuxiliaryEffectSlotList;
+ while(*list)
+ list = &(*list)->next;
+
+ i = 0;
+ while(i < n)
{
- // We must have run out or memory
- alDeleteAuxiliaryEffectSlots(i, effectslots);
- alSetError(AL_OUT_OF_MEMORY);
- break;
+ *list = calloc(1, sizeof(ALeffectslot));
+ if(!(*list))
+ {
+ // We must have run out or memory
+ alDeleteAuxiliaryEffectSlots(i, effectslots);
+ alSetError(AL_OUT_OF_MEMORY);
+ break;
+ }
+
+ effectslots[i] = (ALuint)ALTHUNK_ADDENTRY(*list);
+ (*list)->effectslot = effectslots[i];
+
+ g_AuxiliaryEffectSlotCount++;
+ i++;
}
-
- effectslots[i] = (ALuint)ALTHUNK_ADDENTRY(*list);
- (*list)->effectslot = effectslots[i];
-
- g_AuxiliaryEffectSlotCount++;
- i++;
}
}
+ else
+ alSetError(AL_INVALID_OPERATION);
}
ProcessContext(Context);