Interface EffectManager

All Known Implementing Classes:
EffectManager.CppProxy

public interface EffectManager
  • Method Details

    • addErrorListener

      void addErrorListener(@Nullable ErrorListener errorListener)
      Add callback to receive errors messages from Effect Player. Thread-safe. May be called from any thread
    • removeErrorListener

      void removeErrorListener(@Nullable ErrorListener errorListener)
      Remove callback to receive errors messages from Effect Player. Thread-safe. May be called from any thread
    • addHintListener

      void addHintListener(@Nullable HintListener hintListener)
      Add callback to receive user-visible messages from effects. You should display them on UI. Thread-safe. May be called from any thread
    • removeHintListener

      void removeHintListener(@Nullable HintListener hintListener)
      Remove callback to receive user-visible messages from effects. Thread-safe. May be called from any thread
    • addEffectEventListener

      void addEffectEventListener(@Nullable EffectEventListener effectEventListener)
      Add callback to receive events from effect. Thread-safe. May be called from any thread
    • removeEffectEventListener

      void removeEffectEventListener(@Nullable EffectEventListener effectEventListener)
      Remove callback to receive events from effect. Thread-safe. May be called from any thread
    • addEffectActivatedListener

      void addEffectActivatedListener(@Nullable EffectActivatedListener effectActivatedListener)
      Add callback to receive notifications on effect change. Thread-safe. May be called from any thread
    • removeEffectActivatedListener

      void removeEffectActivatedListener(@Nullable EffectActivatedListener effectActivatedListener)
      Remove callback to receive notifications on effect change. Thread-safe. May be called from any thread
    • createEffect

      @Nullable Effect createEffect(@NonNull String workDir)
      Create empty effect. If working directory path is empty string then effect assumed as an in-memory effect.
    • setCurrentEffect

      void setCurrentEffect(@Nullable Effect effect)
      Set current effect. Thread-safe. May be called from any thread
    • load

      @Nullable Effect load(@NonNull String url)
      Load and activate effect sync. MUST be called from the render thread.
    • loadAsync

      @Nullable Effect loadAsync(@NonNull String url)
      Load effect async, activate in the draw() call when it will be ready. Thread-safe. May be called from any thread.
    • reloadConfig

      @Nullable ReloadResult reloadConfig(@NonNull String config)
      Reload current effect config from the string provided. If this reload is possible without effect recreation, this method will return `hot_reload == true`, otherwise `current` effect will be replaced and the method will return `hot_reload == false`. Thread-safe. May be called from any thread.
    • unload

      void unload(@Nullable Effect effect)
      Unload effect from cache. if no currently loading effect - works the same way as load(""); launches empty effect loading. MUST be called from the render thread
    • current

      @Nullable Effect current()
      Get active effect Thread-safe. May be called from any thread
    • update

      void update(boolean sync)
      Update effect loading state
      Parameters:
      sync - syncronize effect manager, block until effect loaded MUST be called from the render thread
    • effectSize

      @NonNull Size effectSize()
      Get current effect size Thread-safe. May be called from any thread
    • surfaceSize

      @NonNull Size surfaceSize()
      Get current surface size Thread-safe. May be called from any thread
    • effectVolume

      float effectVolume()
      Get effect audio volume. Thread-safe. May be called from any thread
      Returns:
      A volume in range `[0, 1]`, where `1` means maximum volume.
    • setEffectVolume

      void setEffectVolume(float volume)
      Set effect audio volume. Thread-safe. May be called from any thread
      Parameters:
      volume - A value in range `[0, 1]`, where `1` means maximum volume.
    • setEffectSize

      void setEffectSize(int fxWidth, int fxHeight)
      Changes effect player render size, should be called on render thread. MUST be called from the render thread
    • setRenderSurface

      void setRenderSurface(@NonNull SurfaceData data)
      set different render surfaces. Can be treated as void*
    • disableSurfacePresentation

      void disableSurfacePresentation()
      disable surface presentation. Needed for offscreen rendering
    • getEffectInfo

      @NonNull static EffectInfo getEffectInfo(@NonNull String url)
      Get effect info. May be called before loading effect "render type" and "recognizer features" fields won't be filled Thread-safe. May be called from any thread