Beispiel #1
0
    void Start()
    {
        lineRenderer = gameObject.AddComponent <LineRenderer>();
        lineRenderer.SetVertexCount(WindowSize);
        lineRenderer.SetWidth(.1f, .1f);

        //musicInstance = FMODUnity.RuntimeManager.CreateInstance("event:/Music/Basic/Random Layered");

        //int instanceID = emitter.GetInstanceID();
        //musicInstance = FMODUnity.RuntimeManager.StudioSystem.getEventByID(instanceID);

        if (emitter == null)
        {
            emitter = GameObject.Find("Music Emitter").GetComponent <FMODUnity.StudioEventEmitter> ();
        }

        musicInstance = emitter.GetInstance();

        FMODUnity.RuntimeManager.LowlevelSystem.createDSPByType(FMOD.DSP_TYPE.FFT, out fft);
        fft.setParameterInt((int)FMOD.DSP_FFT.WINDOWTYPE, (int)FMOD.DSP_FFT_WINDOW.HANNING);
        fft.setParameterInt((int)FMOD.DSP_FFT.WINDOWSIZE, WindowSize * 2);

        FMOD.ChannelGroup channelGroup;
        FMODUnity.RuntimeManager.LowlevelSystem.getMasterChannelGroup(out channelGroup);
        channelGroup.addDSP(FMOD.CHANNELCONTROL_DSP_INDEX.HEAD, fft);

        musicInstance.start();
    }