lebedec / libfmod

A library wrapper for integrating FMOD Engine in Rust applications.
MIT License
42 stars 4 forks source link

Separate crate for FMOD plugins development #15

Open lebedec opened 4 months ago

lebedec commented 4 months ago

based on #14

We probably need a separate crate without linking that will contain everything we need for FMOD DSP plugins development.

Probable solution:

A new crate libfmod-dsp-plugin based on fmod_dsp.h header which contains only definitions for DSP plugins development. Version and backward compatibility based on FMOD_PLUGIN_SDK_VERSION (provided by FMOD team). No linking. No FMOD context bindings.

Blocker:

Need more docs except white papers or any FMOD developer expertise to be sure that this solution correct

lebedec commented 4 months ago

There are 3 plugin types:

In application runtime they can be provided all the ways

In SDK each plugin has separate header with its own version FMOD_xxx_PLUGIN_VERSION:

All these definitions must be provided in common FMOD library (included in fmod_common.h which included in fmod.h)

Also, I think there is no much sense to provide Rust safe wrappers for plugin definitions because. Almost all definitions of plugin is callbacks with C FFI interfaces. Maybe we need separate libfmod-sys crate (this is also recommended by the Rust FFI guidelines).

Draft, new libfmod crates hierarchy:

Screenshot 2024-07-30 at 09 26 10
Speak2Erase commented 4 months ago

Feel free to use fmod-audio-sys!

lebedec commented 1 month ago

About wrappers for plugin API.

There are issues for short period of time. All occured becuase of "safe" conversion:

Also, working with plugin API in any case leads to raw FFI: specific pointers defintion, byte buffers, C unions, C callbacks, etc

I am becoming more and more confident that FMOD plugins API structures like FMOD_DSP_DESCRIPTION must be raw FFI without wrappers.