0
0

Hi,
I get an error when trying to use the event system.
normal fmodex system seems to work fine.
I’m just basing my coed on the c# designer api which i can compile and run with visual studio. When I try it in my game engine I get the following error:
FMOD error! ERR_INITIALIZED – Cannot call this command after System::init.

Seems to be from the line :
[code:vv4nyq4s]result = FMOD.Event_Factory.EventSystem_Create(ref eventsystem);[/code:vv4nyq4s]

code snippet:

[code:vv4nyq4s]public class PlayExEvent : MonoBehaviour {
private FMOD.EventSystem eventsystem = null;
private FMOD.EventGroup eventgroup = null;
private FMOD.EventCategory mastercategory = null;
private FMOD.Event car = null;
private FMOD.EventParameter rpm = null;
private FMOD.EventParameter load = null;
float rangemin, rangemax;
public FMOD.RESULT result;

// Use this for initialization
void Start () {
        uint            version = 0;

        /*
            Create a System object and initialize.
        */

result = FMOD.Event_Factory.EventSystem_Create(ref eventsystem);
ERRCHECK(result);

result = eventsystem.init(64, FMOD.INITFLAG.NORMAL, (IntPtr)null, FMOD.EVENT_INIT.NORMAL);
        ERRCHECK(result);
        if (result == FMOD.RESULT.OK)
        {
            Debug.Log("FMOD init! " + result );
        }

    result = eventsystem.setMediaPath("Assets/FMOD/media/");
    ERRCHECK(result);

    result = eventsystem.load("examples.fev");
    ERRCHECK(result);

        result = eventsystem.getGroup("examples/AdvancedTechniques", false, ref eventgroup);
    ERRCHECK(result);
    result = eventgroup.getEvent("car", FMOD.EVENT_MODE.DEFAULT, ref car);
    ERRCHECK(result);

    result = eventsystem.getCategory("master", ref mastercategory);
    ERRCHECK(result);

    result = car.getParameter("load", ref load);
    ERRCHECK(result);
    result = load.getRange(ref rangemin, ref rangemax);
    ERRCHECK(result);
    result = load.setValue(rangemax);
    ERRCHECK(result);

    result = car.getParameterByIndex(0, ref rpm);
    ERRCHECK(result);
    result = rpm.getRange(ref rangemin, ref rangemax);
    ERRCHECK(result);
    result = rpm.setValue(1000.0f);
    ERRCHECK(result);


    result = car.start();
    ERRCHECK(result);       


}[/code:vv4nyq4s]

Thanks for any help

  • You must to post comments
0
0

I cant see anything wrong with the code you posted.

However, if you have already initialized the fmodex system elsewhere then that is problem. To use the Event system and FMOD Ex low level system at the same time, initialise the EventSystem then use EventSystem::getSystemObject to get an FMOD::System object for use with the low level.

Hope this helps,

-Pete

  • You must to post comments
0
0

Thanks,
thought i might have been doing something obviously dumb.
But it is working ok now.
I had some other examples that might not have released properly, and / or visual studio might have been using resources.
works fine now.
fmod designer fun to follow.

  • You must to post comments
Showing 2 results
Your Answer

Please first to submit.