2013-05-23 18:50:07 -07:00
|
|
|
#include "config.h"
|
|
|
|
|
|
|
|
#include <stdlib.h>
|
|
|
|
|
|
|
|
#include "AL/al.h"
|
|
|
|
#include "AL/alc.h"
|
2018-11-17 23:02:27 -08:00
|
|
|
|
2013-05-23 18:50:07 -07:00
|
|
|
#include "alMain.h"
|
2018-11-17 23:02:27 -08:00
|
|
|
#include "alcontext.h"
|
2013-05-23 18:50:07 -07:00
|
|
|
#include "alAuxEffectSlot.h"
|
|
|
|
#include "alError.h"
|
|
|
|
|
|
|
|
|
2018-11-19 22:34:26 -08:00
|
|
|
struct ALnullState final : public EffectState {
|
|
|
|
ALnullState();
|
|
|
|
~ALnullState() override;
|
2016-08-25 03:42:43 -07:00
|
|
|
|
2018-12-22 18:43:34 -08:00
|
|
|
ALboolean deviceUpdate(const ALCdevice *device) override;
|
2018-11-19 22:34:26 -08:00
|
|
|
void update(const ALCcontext *context, const ALeffectslot *slot, const ALeffectProps *props) override;
|
|
|
|
void process(ALsizei samplesToDo, const ALfloat (*RESTRICT samplesIn)[BUFFERSIZE], ALfloat (*RESTRICT samplesOut)[BUFFERSIZE], ALsizei numChannels) override;
|
2016-08-25 03:42:43 -07:00
|
|
|
|
2018-11-19 22:34:26 -08:00
|
|
|
DEF_NEWDEL(ALnullState)
|
|
|
|
};
|
2016-08-25 03:42:43 -07:00
|
|
|
|
|
|
|
/* This constructs the effect state. It's called when the object is first
|
2018-11-19 22:34:26 -08:00
|
|
|
* created.
|
2016-08-25 03:42:43 -07:00
|
|
|
*/
|
2018-11-19 22:34:26 -08:00
|
|
|
ALnullState::ALnullState()
|
2016-08-25 03:42:43 -07:00
|
|
|
{
|
|
|
|
}
|
2013-05-25 17:42:34 -07:00
|
|
|
|
2018-11-19 22:34:26 -08:00
|
|
|
/* This destructs the effect state. It's called only when the effect slot is no
|
|
|
|
* longer used prior to being freed.
|
2013-05-25 17:42:34 -07:00
|
|
|
*/
|
2018-11-19 22:34:26 -08:00
|
|
|
ALnullState::~ALnullState()
|
2013-05-23 18:50:07 -07:00
|
|
|
{
|
|
|
|
}
|
2013-05-25 17:42:34 -07:00
|
|
|
|
|
|
|
/* This updates the device-dependant effect state. This is called on
|
|
|
|
* initialization and any time the device parameters (eg. playback frequency,
|
|
|
|
* format) have been changed.
|
|
|
|
*/
|
2018-12-22 18:43:34 -08:00
|
|
|
ALboolean ALnullState::deviceUpdate(const ALCdevice* UNUSED(device))
|
2013-05-23 18:50:07 -07:00
|
|
|
{
|
|
|
|
return AL_TRUE;
|
|
|
|
}
|
2013-05-25 17:42:34 -07:00
|
|
|
|
|
|
|
/* This updates the effect state. This is called any time the effect is
|
|
|
|
* (re)loaded into a slot.
|
|
|
|
*/
|
2018-11-19 22:34:26 -08:00
|
|
|
void ALnullState::update(const ALCcontext* UNUSED(context), const ALeffectslot* UNUSED(slot), const ALeffectProps* UNUSED(props))
|
2013-05-23 18:50:07 -07:00
|
|
|
{
|
|
|
|
}
|
2013-05-25 17:42:34 -07:00
|
|
|
|
|
|
|
/* This processes the effect state, for the given number of samples from the
|
|
|
|
* input to the output buffer. The result should be added to the output buffer,
|
|
|
|
* not replace it.
|
|
|
|
*/
|
2018-11-19 22:34:26 -08:00
|
|
|
void ALnullState::process(ALsizei UNUSED(samplesToDo), const ALfloat (*RESTRICT UNUSED(samplesIn))[BUFFERSIZE], ALfloat (*RESTRICT UNUSED(samplesOut))[BUFFERSIZE], ALsizei UNUSED(numChannels))
|
2013-05-23 18:50:07 -07:00
|
|
|
{
|
|
|
|
}
|
2013-05-25 17:42:34 -07:00
|
|
|
|
2013-05-23 18:50:07 -07:00
|
|
|
|
2018-11-17 01:49:26 -08:00
|
|
|
struct NullStateFactory final : public EffectStateFactory {
|
2018-11-19 22:34:26 -08:00
|
|
|
EffectState *create() override;
|
2018-11-17 01:49:26 -08:00
|
|
|
};
|
2013-10-07 14:49:36 -07:00
|
|
|
|
2013-05-25 17:42:34 -07:00
|
|
|
/* Creates ALeffectState objects of the appropriate type. */
|
2018-11-19 22:34:26 -08:00
|
|
|
EffectState *NullStateFactory::create()
|
|
|
|
{ return new ALnullState{}; }
|
2013-05-23 18:50:07 -07:00
|
|
|
|
2018-02-28 19:37:12 -08:00
|
|
|
EffectStateFactory *NullStateFactory_getFactory(void)
|
2013-05-23 18:50:07 -07:00
|
|
|
{
|
2018-11-17 01:49:26 -08:00
|
|
|
static NullStateFactory NullFactory{};
|
2018-11-19 06:43:37 -08:00
|
|
|
return &NullFactory;
|
2013-05-23 18:50:07 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2018-01-25 15:59:59 -08:00
|
|
|
void ALnull_setParami(ALeffect *UNUSED(effect), ALCcontext *context, ALenum param, ALint UNUSED(val))
|
2013-05-25 17:42:34 -07:00
|
|
|
{
|
|
|
|
switch(param)
|
|
|
|
{
|
2018-01-25 15:59:59 -08:00
|
|
|
default:
|
|
|
|
alSetError(context, AL_INVALID_ENUM, "Invalid null effect integer property 0x%04x", param);
|
2013-05-25 17:42:34 -07:00
|
|
|
}
|
|
|
|
}
|
2018-01-25 15:59:59 -08:00
|
|
|
void ALnull_setParamiv(ALeffect *UNUSED(effect), ALCcontext *context, ALenum param, const ALint* UNUSED(vals))
|
2013-05-25 17:42:34 -07:00
|
|
|
{
|
|
|
|
switch(param)
|
|
|
|
{
|
2018-01-25 15:59:59 -08:00
|
|
|
default:
|
|
|
|
alSetError(context, AL_INVALID_ENUM, "Invalid null effect integer-vector property 0x%04x", param);
|
2013-05-25 17:42:34 -07:00
|
|
|
}
|
|
|
|
}
|
2018-01-25 15:59:59 -08:00
|
|
|
void ALnull_setParamf(ALeffect *UNUSED(effect), ALCcontext *context, ALenum param, ALfloat UNUSED(val))
|
2013-05-25 17:42:34 -07:00
|
|
|
{
|
|
|
|
switch(param)
|
|
|
|
{
|
2018-01-25 15:59:59 -08:00
|
|
|
default:
|
|
|
|
alSetError(context, AL_INVALID_ENUM, "Invalid null effect float property 0x%04x", param);
|
2013-05-25 17:42:34 -07:00
|
|
|
}
|
|
|
|
}
|
2018-01-25 15:59:59 -08:00
|
|
|
void ALnull_setParamfv(ALeffect *UNUSED(effect), ALCcontext *context, ALenum param, const ALfloat* UNUSED(vals))
|
2013-05-25 17:42:34 -07:00
|
|
|
{
|
|
|
|
switch(param)
|
|
|
|
{
|
2018-01-25 15:59:59 -08:00
|
|
|
default:
|
|
|
|
alSetError(context, AL_INVALID_ENUM, "Invalid null effect float-vector property 0x%04x", param);
|
2013-05-25 17:42:34 -07:00
|
|
|
}
|
|
|
|
}
|
2013-05-23 18:50:07 -07:00
|
|
|
|
2018-01-25 15:59:59 -08:00
|
|
|
void ALnull_getParami(const ALeffect *UNUSED(effect), ALCcontext *context, ALenum param, ALint* UNUSED(val))
|
2013-05-25 17:42:34 -07:00
|
|
|
{
|
|
|
|
switch(param)
|
|
|
|
{
|
2018-01-25 15:59:59 -08:00
|
|
|
default:
|
|
|
|
alSetError(context, AL_INVALID_ENUM, "Invalid null effect integer property 0x%04x", param);
|
2013-05-25 17:42:34 -07:00
|
|
|
}
|
|
|
|
}
|
2018-01-25 15:59:59 -08:00
|
|
|
void ALnull_getParamiv(const ALeffect *UNUSED(effect), ALCcontext *context, ALenum param, ALint* UNUSED(vals))
|
2013-05-25 17:42:34 -07:00
|
|
|
{
|
|
|
|
switch(param)
|
|
|
|
{
|
2018-01-25 15:59:59 -08:00
|
|
|
default:
|
|
|
|
alSetError(context, AL_INVALID_ENUM, "Invalid null effect integer-vector property 0x%04x", param);
|
2013-05-25 17:42:34 -07:00
|
|
|
}
|
|
|
|
}
|
2018-01-25 15:59:59 -08:00
|
|
|
void ALnull_getParamf(const ALeffect *UNUSED(effect), ALCcontext *context, ALenum param, ALfloat* UNUSED(val))
|
2013-05-25 17:42:34 -07:00
|
|
|
{
|
|
|
|
switch(param)
|
|
|
|
{
|
2018-01-25 15:59:59 -08:00
|
|
|
default:
|
|
|
|
alSetError(context, AL_INVALID_ENUM, "Invalid null effect float property 0x%04x", param);
|
2013-05-25 17:42:34 -07:00
|
|
|
}
|
|
|
|
}
|
2018-01-25 15:59:59 -08:00
|
|
|
void ALnull_getParamfv(const ALeffect *UNUSED(effect), ALCcontext *context, ALenum param, ALfloat* UNUSED(vals))
|
2013-05-25 17:42:34 -07:00
|
|
|
{
|
|
|
|
switch(param)
|
|
|
|
{
|
2018-01-25 15:59:59 -08:00
|
|
|
default:
|
|
|
|
alSetError(context, AL_INVALID_ENUM, "Invalid null effect float-vector property 0x%04x", param);
|
2013-05-25 17:42:34 -07:00
|
|
|
}
|
|
|
|
}
|
2013-05-24 23:26:59 -07:00
|
|
|
|
|
|
|
DEFINE_ALEFFECT_VTABLE(ALnull);
|