PeriodicWave.h 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. /*
  2. * Copyright (c) 2024, Shannon Booth <shannon@serenityos.org>
  3. *
  4. * SPDX-License-Identifier: BSD-2-Clause
  5. */
  6. #pragma once
  7. #include <AK/Vector.h>
  8. #include <LibJS/Forward.h>
  9. #include <LibWeb/Bindings/PlatformObject.h>
  10. namespace Web::WebAudio {
  11. // https://webaudio.github.io/web-audio-api/#PeriodicWaveConstraints
  12. struct PeriodicWaveConstraints {
  13. bool disable_normalization { false };
  14. };
  15. // https://webaudio.github.io/web-audio-api/#PeriodicWaveOptions
  16. struct PeriodicWaveOptions : PeriodicWaveConstraints {
  17. Optional<Vector<float>> real;
  18. Optional<Vector<float>> imag;
  19. };
  20. // https://webaudio.github.io/web-audio-api/#PeriodicWave
  21. class PeriodicWave : public Bindings::PlatformObject {
  22. WEB_PLATFORM_OBJECT(PeriodicWave, Bindings::PlatformObject);
  23. JS_DECLARE_ALLOCATOR(PeriodicWave);
  24. public:
  25. static WebIDL::ExceptionOr<JS::NonnullGCPtr<PeriodicWave>> construct_impl(JS::Realm&, JS::NonnullGCPtr<BaseAudioContext>, PeriodicWaveOptions const&);
  26. virtual ~PeriodicWave() override;
  27. protected:
  28. virtual void initialize(JS::Realm&) override;
  29. virtual void visit_edges(Cell::Visitor&) override;
  30. };
  31. }