stechyo / godot-steam-audio

Immersive spatial audio extension for Godot, using Valve's SteamAudio
MIT License
326 stars 7 forks source link

Add methods to recalculate and toggle static geometry #34

Closed levidavidmurray closed 8 months ago

levidavidmurray commented 8 months ago

SteamAudioGeometry wasn't working properly for my procedurally generated geometry as my actual geometry is being globally positioned after SteamAudioGeometry::_ready is called. So I needed a way to "recalculate" the static audio geometry.

I figured I'd also add an easy way to enable and disable the audio geometry.

https://github.com/stechyo/godot-steam-audio/assets/46084870/cb2d45b3-1ac6-40f1-848b-b6989899cd95

I had some issues getting the GDExtension to build properly on Windows (msvc). scons platform=windows target=template_debug dev_build=true built and worked fine. Omitting the dev_build=true flag builds fine, but the Godot project would instantly crash.

I did notice quite a size difference between my dll (~500KB) and the one provided in project/addons (~1.8MB). I tried building with use_mingw=true and after about 30-40 minutes it finally finished (subsequent builds weren't much faster). In any case, it did end up producing a dll around the same size and the GDExtension worked fine. The build time is quite the hindrance though. I'll probably find a solution with a fresh pair of eyes tomorrow (likely related: https://github.com/godotengine/godot/issues/30892).

stechyo commented 8 months ago

Hi, thanks for this! I hadn't thought of this use-case and your code looks good (just had some nitpicks).
I'll try to test your PR this week, but I'll only merge it after #33 and after releasing 0.1.0. I did not want to introduce any more changes in this release, hope you understand.

Semi-unrelated things: Omitting dev_build=true creates a different binary name, so it might be the reason for your crashing.
I'm building the Windows binary with mingw mostly because I don't use Windows except for testing this extension's releases. I wasn't aware that MSVC binaries were that much smaller, so I'll probably make a Windows/MSVC step when I get around to doing #31. Just a check, size and compilation time is the only difference between MSVC and MinGW builds, right?
Feel free to keep building on MSVC for now, since there doesn't seem to be a difference.

levidavidmurray commented 8 months ago

I did not want to introduce any more changes in this release, hope you understand

Totally fine! I'm more than okay with running my own builds for the time being.

Just a check, size and compilation time is the only difference between MSVC and MinGW builds, right?

I couldn't get MSVC builds to run without dev_build=true. I'm quite certain it's more than just naming as I did ensure the binary paths matched up in libgodot-steam-audio.gdextension.

stechyo commented 8 months ago

Is it possible that it has something to do with the fact that my fork of Godot is compiled on MinGW?

(Will test your changes this weekend and merge if all the review comments are solved and it looks good. Great contrib, thanks!)

levidavidmurray commented 8 months ago

(Will test your changes this weekend and merge if all the review comments are solved and it looks good. Great contrib, thanks!)

Did you leave review comments? Missing repo setting?

https://github.com/stechyo/godot-steam-audio/assets/46084870/f2216c23-0436-4fc1-a162-10c2d17a6715

stechyo commented 8 months ago

... sorry, new to having other people's PRs on my own repos. I think they should show up now.

levidavidmurray commented 8 months ago

All good! 😅 And yup, I see them now. I'm currently in the depths of trying to get pathing simulations working. I was having a hard time getting small closed off interiors to simulate how I want them to (I tried many different configurations).

In any case, I'll get around to the PR comments either when I get the bare minimum path sim working, or I give up.

stechyo commented 8 months ago

Just tested, works fine and no crashes. Merging, thanks!