Pregunta

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 :

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);
}

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. This question also asked in FMOD forum but no response.

¿Fue útil?

Solución

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

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

I changed it to something like this :

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

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

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top