I am trying to get the GUIDs of events in a .fev file. I’m using FMOD_Event_GetInfo with an instance of FMOD_EVENT_INFO which has a pointer to an initialized FMOD_GUID set. If I understand the documentation correctly, this should suffice for the GetInfo function to set the GUID. However the GUID is unchanged after the function is called. The GetInfo call sets the event name correctly, and sets other attributes of the FMOD_EVENT_INFO instance, but not the GUID’s attributes.
Any help would be appreciated.
Code is as follows:

#include <stdio.h>
#include <stdlib.h>
#include "fmod_event.h"
#include "fmod_errors.h"

    if (result != FMOD_OK) {
        printf("FMOD error! (%d) %s\n", result, FMOD_ErrorString(result));

int main()
    FMOD_EVENTSYSTEM* eventsystem;
    FMOD_EVENTGROUP* eventgroup;
    FMOD_EVENT* event = 0;
    ERRCHECK(FMOD_EventSystem_Init(eventsystem, 64, FMOD_INIT_NORMAL, 0, FMOD_EVENT_INIT_NORMAL));
    ERRCHECK(FMOD_EventSystem_SetMediaPath(eventsystem, "..\\fmod\\"));
    FMOD_EVENT_LOADINFO info = {};
    info.size = sizeof(FMOD_EVENT_LOADINFO);
    ERRCHECK(FMOD_EventSystem_Load(eventsystem, "examples.fev", &info, 0));

    int num = 0;
    ERRCHECK(FMOD_EventSystem_GetNumEvents(eventsystem, &num));
    printf("%i events\n", num);
    for (int i = 0; i < num; i++) {
        int mode = FMOD_EVENT_DEFAULT;
        ERRCHECK(FMOD_EventSystem_GetEventBySystemID(eventsystem, i, mode, &event));
        unsigned char data[8] = {1};
        FMOD_GUID guid = {};// {.Data1 = 1, .Data2 = 2, .Data3 = 3, .Data4 = {4}};
        FMOD_EVENT_INFO info = {};
        printf("%i\n", info.guid);
        info.guid = &guid;
        char* name;
        ERRCHECK(FMOD_Event_GetInfo(event, 0, &name, &info));
        printf("%s\n", name);
        printf("%i\n", info.lengthms);
        printf("{%.8x-%.4x-%.4x-%.12x}\n", info.guid->Data1, info.guid->Data2, info.guid->Data3, *info.guid->Data4);

    return 0;
  • You must to post comments
Best Answer

Sorry, this should be documented in FMOD_EVENT_INFO but you’re supposed to add FMOD_EVENT_INIT_USE_GUIDS to the init call to get this feature to work.

Note that getting the event will load the sound data associated with it, to avoid allocation and loading for every event, use FMOD_EVENT_INFOONLY in the getEvent call.

  • LC
    • LC
    • 1 year ago

    Thanks, this worked perfectly.

  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.