简体   繁体   English

FMOD :: System *系统; 它有什么作用?

[英]FMOD::System *system; What does it do?

Gotta learn FMOD For school project. 必须为学校项目学习FMOD。

In the code (copied from the documentation): 在代码中(从文档中复制):

FMOD_RESULT result;
FMOD::System *system;
result = FMOD::System_Create(&system);      // Create the main system object.
if (result != FMOD_OK)
{
    printf("FMOD error! (%d) %s\n", result, FMOD_ErrorString(result));
    exit(-1);
}
result = system->init(100, FMOD_INIT_NORMAL, 0);    // Initialize FMOD.
if (result != FMOD_OK)
{
    printf("FMOD error! (%d) %s\n", result, FMOD_ErrorString(result));
    exit(-1);
}

What does the second line do (FMOD::System *system;)? 第二行是做什么的(FMOD :: System * system;)? What does the next line do (result = FMOD::System_Create(&system);)? 下一行是做什么的(结果= FMOD :: System_Create(&system);)?

I think the line FMOD::System *system; 我认为这行FMOD :: System * system; creates a pointer and the other line creates the system and checks for errors. 创建一个指针,另一行创建系统并检查错误。 I just don't get the need for pointers. 我只是不需要指针。

Could someone please explain Thank-you 有人可以解释谢谢

You first declare a pointer of type FMOD::System* and then the function FMOD::System_Create will populate the pointer with the system object . 首先声明一个类型为FMOD::System*的指针,然后函数FMOD::System_Create将使用系统对象填充该指针。 So, if nothing failed, after the third line system will point to a valid object of type FMOD::System so that you can call system->init few lines below. 因此,如果一切顺利,第三行system将指向FMOD::System类型的有效对象,以便您可以在下面调用system->init几行。

Unfortunately the documentation for FMOD is not publicly available so I cannot tell much more. 不幸的是, FMOD的文档没有公开可用,所以我无法说更多。 But if you have been given access to it, you should find all the informations you need in there. 但是,如果已获得访问权限,则应在其中找到所需的所有信息。

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

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