tesselode / kira

Library for expressive game audio.
https://crates.io/crates/kira
Apache License 2.0
836 stars 42 forks source link

Effect macros not exported #94

Closed GitGhillie closed 1 month ago

GitGhillie commented 1 month ago

With Kira 0.8 I had a custom Effect implemented in my library, mirroring how Kira effects were implemented. However, trying out 0.9/main it looks like this is not possible anymore due to the following macros not being exported: handle_param_setters read_commands_into_parameters As well as frame being private.

I also checked the changelog if there is any information on how to migrate, but let me know if I missed anything! It does look like there will be less boilerplate with these changes.

GitGhillie commented 1 month ago

Also got the following error when I added #[macro_export] on my fork:

error[E0433]: failed to resolve: use of undeclared crate or module `paste`
  --> crates\phonon-kira\src\direct_effect\mod.rs:15:1
   |
15 | / command_writers_and_readers!(
16 | |   set_parameters: DirectEffectParameters,
17 | |     set_panning: PanningEffectParameters,
18 | | );
   | |_^ use of undeclared crate or module `paste`
   |
   = note: this error originates in the macro `command_writers_and_readers` (in Nightly builds, run with -Z macro-backtrace for more info)

Which I was able to work around by simply adding paste to the dependencies of my library. But I don't think that's really the solution.

tesselode commented 1 month ago

handle_param_setters and read_commands_into_parameters are not necessary for implementing Kira's traits; they're just there to reduce some boilerplate in Kira's code. They're deeply tied to the naming conventions in Kira, so I'm not confident in their design as general-purpose macros, hence why they're not part of the public API. You can use Rust Analyzer to expand those macros to see what they're doing - everything you need is publicly available.

Frame isn't private, it's just been moved to the crate root.

GitGhillie commented 1 month ago

In that case would it be worth it to create an example on how to implement a custom Effect? Because these would be extra barriers for new users.

Frame isn't private but the module frame is not, so I don't think I can use it.

GitGhillie commented 1 month ago

Ah nevermind I missed the export of Frame below it