alnitak / flutter_soloud

Flutter low-level audio plugin using SoLoud C++ library and FFI
MIT License
209 stars 21 forks source link

fix: Wrong error reported when trying to add a filter twice #62

Closed filiph closed 6 months ago

filiph commented 6 months ago

Description

When accidentally trying to add a filter that has already been added, the exception thrown is SoLoudFilterNotFoundException.

This is because SoLoudController().soLoudFFI.addGlobalFilter(filterType.index) returns PlayerErrors.filterNotFound (12).

This could lead developers on a wild goose chase ("why is that filter not found?").

Steps To Reproduce

  1. Make a button that runs something like SoLoud.instance.addGlobalFilter(FilterType.freeverbFilter);
  2. Click it twice
  3. See error

Expected Behavior

A SoLoudFilterAlreadyAddedException is thrown. Or something similar.

Additional Context

This is not a high priority and not urgent.