Skip to content

Conversation

@utgarda
Copy link

@utgarda utgarda commented Sep 28, 2025

Summary

Migrates libfmod from FMOD 2.02.22 to 2.03.09 and adds comprehensive test harnesses for validating the migration and
demonstrating FMOD Studio features.

Changes

Migration (09dc708)

  • Updated to FMOD Engine 2.03.09
  • Fixed breaking API changes (System::getVersion, FMOD_ADVANCEDSETTINGS)
  • Added compatibility layer for new SDK structure

Test Infrastructure (e5b1983, 3f4acc6, 33e31d2)

  • harness_demo - Automated demos of 3D spatial audio, event parameters, footsteps
  • interactive_harness - Interactive keyboard-controlled 3D audio testing
  • run_fmod.sh - Helper script for running examples with correct library paths

Testing

All examples tested on Linux x86_64 with FMOD 2.03.09. Run with:

cd libfmod
./run_fmod.sh harness_demo
./run_fmod.sh interactive_harness

Breaking Changes

- Requires FMOD SDK 2.03.09
- Not ABI compatible with FMOD 2.02.x

utgarda and others added 4 commits September 25, 2025 11:37
BREAKING CHANGE: System::getVersion returns (version, buildnumber)
BREAKING CHANGE: FMOD_ADVANCEDSETTINGS.commandQueueSize removed

- Add examples: verify_203, play_sound, run_fmod.sh
- Add field filtering for 2.03 API changes
- Audio playback confirmed working

#1
- Bank loading and management (files/memory)
- Event playback with sound variations
- Real-time parameter control (RPM, surfaces, volume/pitch)
- Uses FMOD 2.03.09 SDK example banks
- All Studio features confirmed working

#1
for file in "$PROCESSED_PATH"/api/core/inc/*.h "$PROCESSED_PATH"/api/studio/inc/*.h; do
if [ -f "$file" ]; then
# Comment out lines containing ##__VA_ARGS__ (these are just logging macros)
sed -i 's/^\(.*##__VA_ARGS__.*\)$/\/\/ FMOD_2_03_VARIADIC_MACRO: \1/' "$file"
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is key change I see to support FMOD API 2.03

It can't be merged because it's difficult to maintain bash scripts with regexp. By design it should be implemented at the parser level in libfmod-gen/src/grammars.

use libfmod::{Studio, StudioInit, Init, LoadBank, StopMode, Vector, Attributes3d};
use std::{thread, time::Duration};

fn main() -> Result<(), Box<dyn std::error::Error>> {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks cool. But I can't accept and maintain 1,000+ lines of code that isn't directly related to the library or unit tests. I'd prefer it to be a separate project like libfmod-harness-demo, which we can link to in the library's README.

@@ -0,0 +1,84 @@
#!/bin/bash
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not ready to accept any of the proposed bash scripts for security reasons (I have no way to validate that they don't do anything extra =)

}
};
}
macro_rules! move_string_to_c {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

F: FnMut(T) -> O,
{
let mut values = values.into_iter().map(map).collect::<Vec<O>>();
let pointer = values.as_mut_ptr();
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

😮


impl Api {
// FMOD 2.03.09: Filter out removed/renamed fields
pub fn should_skip_field(&self, structure: &str, field: &str) -> bool {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is an incorrect implementation. If fields are removed from the API, they simply won't be generated.


assert_eq!(FMOD_VERSION, "2.03.09");
assert_eq!(EXPECTED_VERSION, 0x00020309);
println!("✓ Version constants updated to 2.03.09");
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see a lot of useless code generated by AI, I can’t accept it.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NP, thanks for the review! I'll take care of it.

- Replace Unicode with ASCII characters for terminal compatibility
- Fix line endings with \r\n
- Add RPM parameter to vehicles
- Handle one-shot events properly (footsteps, explosions)
- Set surface parameter for footsteps
std::mem::forget(values);
pointer
let values = values.into_iter().map(map).collect::<Vec<O>>();
Box::into_raw(values.into_boxed_slice()) as *mut _

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Both of these are "wrong"

should be Box::leak(values.into_boxed_slice()) as *mut _

- vec_as_mut_ptr, ASIO lists, CString fields, DSP paramdesc
- Regenerate lib.rs with fixes

Per PR lebedec#23 feedback
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants