Answered
0
0

Hi
I’m trying to move my project from Fmod Ex to Unity. The code was worked fine in Ex, but not in Unity. The code looks like:

using UnityEngine;
using System.Collections;
using FMOD;

public class _Oscillators : MonoBehaviour {

    FMOD.RESULT Fresult; 
    FMOD.System Fsystem; 
    FMOD.DSP Fdsp;
    FMOD.Channel Fchannel;
    FMOD.ChannelGroup Fchannelgroup;
    System.IntPtr ptr;

    // Use this for initialization
    void Start () {

        ptr = new System.IntPtr();
        Fsystem = new FMOD.System(ptr);
        Fresult = new FMOD.RESULT();

        FMOD_Initialize();

        Fchannel = new FMOD.Channel(ptr);
        Fdsp = new FMOD.DSP(ptr);

        Fresult = Fsystem.createDSPByType(DSP_TYPE.OSCILLATOR, out Fdsp);

        Fresult = Fdsp.setParameterInt((int)DSP_OSCILLATOR.TYPE, 0);
        Fresult = Fdsp.setParameterInt((int)DSP_OSCILLATOR.RATE, 220);

        Fresult = Fsystem.playDSP(Fdsp, null, false, out Fchannel);

        Fresult = Fchannel.setVolume(1.0f);

        Fsystem.update();
    }

    private void FMOD_Initialize()
    {
        Fresult = FMOD.Factory.System_Create(out Fsystem);
        ERRCHECK(Fresult, "create system");

    }

    private void FMOD_DeInitialize()
    {
        Fresult = Fsystem.close();
        ERRCHECK(Fresult, "close");
    }

    private void ERRCHECK(FMOD.RESULT Fresult, string comment)
    {
        if (Fresult != FMOD.RESULT.OK)
        {
            UnityEngine.Debug.Log ("FMOD error in " + comment + ": " + Fresult + "-" + FMOD.Error.String(Fresult));
        }
    }
}

Unfortunately, at FMOD.Factory.System_Create(out Fsystem) it gives an ‘ERR_MEMORY-not enough memory or resources’ message. What am I doing wrong?

  • You must to post comments
Best Answer
0
0

There is a maximum of 8 system objects that can be created. After you’ve hit that limit FMOD.Factory.System_Create() will return ERR_MEMORY.

  • You must to post comments
0
0

The problem is that even if I just add FMOD_Listener (FMOD native script), the error message still has appeared. It seems that I can’t use FMOD in Unity (mine is 4.5.4 Pro) at all? By the way, when I use a SquareTangle implementation, all works fine. Unfortunately, I need some features from the original asset. Any suggestions?

  • You must to post comments
Showing 2 results
Your Answer

Please first to submit.