简体   繁体   English

FMOD Designer C#API崩溃

[英]FMOD designer C# api crash

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. 我试图将C#API用于FMOD Designer并运行交互式音乐系统,但是当我调用musicSystem.getCues(...)时,我的应用程序崩溃了。

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. 但是我可以使用prepareCue并通过直接使用提示ID来触发提示。

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. 当我检查C#包装器类时,我发现可疑的是ref直接将FMOD.MUSIC_ITERATOR传递给C api,FMOD.MUSIC_ITERATOR内还有另一个类型def,它将用本机代码填充。 This question also asked in FMOD forum but no response. 在FMOD论坛上也提出了这个问题,但没有答复。

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 : 找到我的解决方案后,我正在遍历包含音乐提示名称的通用字符串列表,以获取提示迭代器,一个musicCueNames列表,如下所示:

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. 现在一切正常,但是不知道为什么。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM