🛠️🐜 Antkeeper superbuild with dependencies included https://antkeeper.com
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

84 lines
2.3 KiB

  1. #include "config.h"
  2. #include <stddef.h>
  3. #include "almalloc.h"
  4. #include "alspan.h"
  5. #include "base.h"
  6. #include "core/bufferline.h"
  7. #include "intrusive_ptr.h"
  8. struct ContextBase;
  9. struct DeviceBase;
  10. struct EffectSlot;
  11. namespace {
  12. struct NullState final : public EffectState {
  13. NullState();
  14. ~NullState() override;
  15. void deviceUpdate(const DeviceBase *device, const Buffer &buffer) override;
  16. void update(const ContextBase *context, const EffectSlot *slot, const EffectProps *props,
  17. const EffectTarget target) override;
  18. void process(const size_t samplesToDo, const al::span<const FloatBufferLine> samplesIn,
  19. const al::span<FloatBufferLine> samplesOut) override;
  20. DEF_NEWDEL(NullState)
  21. };
  22. /* This constructs the effect state. It's called when the object is first
  23. * created.
  24. */
  25. NullState::NullState() = default;
  26. /* This destructs the effect state. It's called only when the effect instance
  27. * is no longer used.
  28. */
  29. NullState::~NullState() = default;
  30. /* This updates the device-dependant effect state. This is called on state
  31. * initialization and any time the device parameters (e.g. playback frequency,
  32. * format) have been changed. Will always be followed by a call to the update
  33. * method, if successful.
  34. */
  35. void NullState::deviceUpdate(const DeviceBase* /*device*/, const Buffer& /*buffer*/)
  36. {
  37. }
  38. /* This updates the effect state with new properties. This is called any time
  39. * the effect is (re)loaded into a slot.
  40. */
  41. void NullState::update(const ContextBase* /*context*/, const EffectSlot* /*slot*/,
  42. const EffectProps* /*props*/, const EffectTarget /*target*/)
  43. {
  44. }
  45. /* This processes the effect state, for the given number of samples from the
  46. * input to the output buffer. The result should be added to the output buffer,
  47. * not replace it.
  48. */
  49. void NullState::process(const size_t/*samplesToDo*/,
  50. const al::span<const FloatBufferLine> /*samplesIn*/,
  51. const al::span<FloatBufferLine> /*samplesOut*/)
  52. {
  53. }
  54. struct NullStateFactory final : public EffectStateFactory {
  55. al::intrusive_ptr<EffectState> create() override;
  56. };
  57. /* Creates EffectState objects of the appropriate type. */
  58. al::intrusive_ptr<EffectState> NullStateFactory::create()
  59. { return al::intrusive_ptr<EffectState>{new NullState{}}; }
  60. } // namespace
  61. EffectStateFactory *NullStateFactory_getFactory()
  62. {
  63. static NullStateFactory NullFactory{};
  64. return &NullFactory;
  65. }