0
0

Hi,
I’m trying to use C# api for FMOD Designer and run an interactive music system, but when I call musicSystem.getCues(…) my app crashes.

I call it like this :

[code:1hwp2894]
FMOD.MUSIC_ITERATOR iter = new FMOD.MUSIC_ITERATOR();
ERRCHECK(musicSystem.getCues(ref iter, musicCueName)); // Crash!

if (iter.value != null) // iter.value will be null if the cue was not found
{
FMOD.MusicPrompt prompt = null;
ERRCHECK(musicSystem.prepareCue((uint)iter.value.ToInt32(), ref prompt));
musicCues.Add(prompt);
}
[/code:1hwp2894]

but I can use prepareCue and trigger the cue by directly using cue IDs.

When I checked the C# wrapper classes I saw something suspicious that the FMOD.MUSIC_ITERATOR passed by a ref directly to C api, the FMOD.MUSIC_ITERATOR has another type def inside it that will be filled in the native code.

  • You must to post comments
0
0

Found my solution, I was iterating through a generic List of string containing music cue names to get cue iterator, a List<string> musicCueNames, like this :

[code:39i36juw]
ERRCHECK(musicSystem.getCues(ref iter, musicCueNames[i])); // Crash!
[/code:39i36juw]

I changed it to something like this :

[code:39i36juw]
string cueName = musicCueNames[i];
ERRCHECK(musicSystem.getCues(ref iter, cueName)); // Works!
[/code:39i36juw]

and now everything works properly, but don’t know exactly why.

  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.