Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[C api / Rust bindings] Crash upon calling iplSimulatorRunReflections in minimal setup (status access violation) #335

Open
GitGhillie opened this issue Mar 25, 2024 · 2 comments

Comments

@GitGhillie
Copy link

GitGhillie commented Mar 25, 2024

System Information

  • Steam Audio version: 4.5.2 and master (commit bbf020a)
  • Operating System and version: W10

Issue Description
I'm trying to integrate the FMOD plugin into a Rust game engine which has been working great with direct effects, but now I'm trying to add support for reflections/reverb and ran into a crash when calling iplSimulatorRunReflections. So I tried to recreate the issue with just the C api and the rust bindings that I'm using and ran into the same issue.

I expect debugging Rust bindings is out of scope for Valve, but I wonder if in general my approach is correct? The setup can be seen here, including the settings for the simulator, listener and the source: https://gist.github.com/GitGhillie/b8b56c077e73e77ae16a3b81619c8c33

Let me know if I missed any information or if there is anything I can do to help debug this.

Crash Dump
I do get some warnings before the crash, but if I understand correctly they are not relevant for the setup I have so far.

2024-03-25T20:41:13.713212Z  WARN steamaudio::context: Warning: createSimulator: invalid IPLint32: settings->numVisSamples = 0
2024-03-25T20:41:13.720854Z  WARN steamaudio::context: Warning: setInputs: invalid IPLfloat32: inputs->reverbScale[iBand] = 0.000000
2024-03-25T20:41:13.721199Z  WARN steamaudio::context: Warning: setInputs: invalid IPLfloat32: inputs->reverbScale[iBand] = 0.000000
2024-03-25T20:41:13.721547Z  WARN steamaudio::context: Warning: setInputs: invalid IPLfloat32: inputs->reverbScale[iBand] = 0.000000
2024-03-25T20:41:13.721902Z  WARN steamaudio::context: Warning: setInputs: invalid IPLfloat32: inputs->hybridReverbTransitionTime = 0.000000
2024-03-25T20:41:13.722209Z  WARN steamaudio::context: Warning: setInputs: invalid IPLfloat32: inputs->hybridReverbOverlapPercent = 0.000000
error: process didn't exit successfully: `target\debug\examples\direct_effect.exe` (exit code: 0xc0000005, STATUS_ACCESS_VIOLATION)
@GitGhillie
Copy link
Author

So far it looks like source->reflectionState.accumEnergyField.get() returns a nullptr in this line:

mRealTimeEnergyFields.push_back(source->reflectionState.accumEnergyField.get());

So when it tries to access that element in energyFields it results in a violation here:

energyFields[i]->reset();

Not sure yet why source->reflectionState.accumEnergyField.get() is returning a nullptr.

@GitGhillie
Copy link
Author

Looks like it's necessary to pass IPL_SIMULATIONFLAGS_REFLECTIONS when creating the source, even though the Programmer's Guide only suggests setting the inputs with iplSourceSetInputs(source, IPL_SIMULATIONFLAGS_REFLECTIONS, &inputs);. Is this the intended behavior or is it just the docs that need updating?

lakulish added a commit that referenced this issue Apr 26, 2024
Add a note indicating that IPLSource objects should be initialized with
IPL_SIMULATIONFLAGS_REFLECTIONS in order to be used for reflection
simulation.

See also: #335
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

No branches or pull requests

1 participant