@@ -181,8 +181,12 @@ AL_API ALvoid AL_APIENTRY alAuxiliaryEffectSloti(ALuint effectslot, ALenum param
181
181
if (iValue == 0 ||
182
182
(effect = LookupEffect (Device , iValue )) != NULL )
183
183
{
184
- InitializeEffect (Context , EffectSlot , effect );
185
- Context -> UpdateSources = AL_TRUE ;
184
+ ALenum err ;
185
+ err = InitializeEffect (Device , EffectSlot , effect );
186
+ if (err != AL_NO_ERROR )
187
+ alSetError (Context , err );
188
+ else
189
+ Context -> UpdateSources = AL_TRUE ;
186
190
}
187
191
else
188
192
alSetError (Context , AL_INVALID_VALUE );
@@ -497,13 +501,13 @@ static ALenum ResizeEffectSlotArray(ALCcontext *Context, ALsizei count)
497
501
return AL_NO_ERROR ;
498
502
}
499
503
500
- ALvoid InitializeEffect (ALCcontext * Context , ALeffectslot * EffectSlot , ALeffect * effect )
504
+ ALenum InitializeEffect (ALCdevice * Device , ALeffectslot * EffectSlot , ALeffect * effect )
501
505
{
502
506
ALenum newtype = (effect ? effect -> type : AL_EFFECT_NULL );
503
507
ALeffectState * State = NULL ;
504
508
ALenum err = AL_NO_ERROR ;
505
509
506
- LockContext ( Context );
510
+ LockDevice ( Device );
507
511
if (newtype == AL_EFFECT_NULL && EffectSlot -> effect .type != AL_EFFECT_NULL )
508
512
{
509
513
State = NoneCreate ();
@@ -538,23 +542,21 @@ ALvoid InitializeEffect(ALCcontext *Context, ALeffectslot *EffectSlot, ALeffect
538
542
539
543
if (err != AL_NO_ERROR )
540
544
{
541
- UnlockContext (Context );
542
- alSetError (Context , err );
543
- return ;
545
+ UnlockDevice (Device );
546
+ return err ;
544
547
}
545
548
546
549
if (State )
547
550
{
548
551
int oldMode ;
549
552
oldMode = SetMixerFPUMode ();
550
553
551
- if (ALeffectState_DeviceUpdate (State , Context -> Device ) == AL_FALSE )
554
+ if (ALeffectState_DeviceUpdate (State , Device ) == AL_FALSE )
552
555
{
553
556
RestoreFPUMode (oldMode );
554
- UnlockContext ( Context );
557
+ UnlockDevice ( Device );
555
558
ALeffectState_Destroy (State );
556
- alSetError (Context , AL_OUT_OF_MEMORY );
557
- return ;
559
+ return AL_OUT_OF_MEMORY ;
558
560
}
559
561
State = ExchangePtr ((XchgPtr * )& EffectSlot -> EffectState , State );
560
562
@@ -566,8 +568,8 @@ ALvoid InitializeEffect(ALCcontext *Context, ALeffectslot *EffectSlot, ALeffect
566
568
* object was changed, it needs an update before its Process method can
567
569
* be called. */
568
570
EffectSlot -> NeedsUpdate = AL_FALSE ;
569
- ALeffectState_Update (EffectSlot -> EffectState , Context -> Device , EffectSlot );
570
- UnlockContext ( Context );
571
+ ALeffectState_Update (EffectSlot -> EffectState , Device , EffectSlot );
572
+ UnlockDevice ( Device );
571
573
572
574
RestoreFPUMode (oldMode );
573
575
@@ -580,9 +582,11 @@ ALvoid InitializeEffect(ALCcontext *Context, ALeffectslot *EffectSlot, ALeffect
580
582
memset (& EffectSlot -> effect , 0 , sizeof (EffectSlot -> effect ));
581
583
else
582
584
memcpy (& EffectSlot -> effect , effect , sizeof (* effect ));
583
- UnlockContext ( Context );
585
+ UnlockDevice ( Device );
584
586
EffectSlot -> NeedsUpdate = AL_TRUE ;
585
587
}
588
+
589
+ return AL_NO_ERROR ;
586
590
}
587
591
588
592
0 commit comments