public float getUnderlyingValue()
    {
        if (m_runtimeParam == null)
        {
            return(-42);
        }
        float ret = -42;

        FMOD.RESULT result = FMOD.RESULT.OK;
        result = m_runtimeParam.getValue(ref ret);
        ERRCHECK(result);
        m_underlyingValue = ret;
        return(ret);
    }
Beispiel #2
0
    public void Initialize(FMOD.EventParameter param, FmodEvent evt)
    {
        IntPtr paramName = new IntPtr(0);
        int    index     = 0;

        FMOD.RESULT result = FMOD.RESULT.OK;

        hideFlags = HideFlags.HideInHierarchy;
        result    = param.getInfo(ref index, ref paramName);
        ERRCHECK(result);
        m_name    = System.Runtime.InteropServices.Marshal.PtrToStringAnsi(paramName);
        this.name = m_name;
        result    = param.getRange(ref m_minRange, ref m_maxRange);
        ERRCHECK(result);
        result = param.getValue(ref m_value);
        ERRCHECK(result);
        result = param.getVelocity(ref m_velocity);
        ERRCHECK(result);
        result = param.getSeekSpeed(ref m_seekSpeed);
        ERRCHECK(result);
        m_event = evt;
    }
Beispiel #3
0
        private void timer1_Tick(object sender, System.EventArgs e)
        {
            if (!initialised)
            {
                ERRCHECK(result = FMOD.Event_Factory.EventSystem_Create(ref eventsystem));
                ERRCHECK(result = eventsystem.init(64, FMOD.INITFLAGS.NORMAL, (IntPtr)null, FMOD.EVENT_INITFLAGS.NORMAL));

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

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

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

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

                ERRCHECK(result = car.getParameter("load", ref load));
                ERRCHECK(result = load.getRange(ref load_min, ref load_max));
                ERRCHECK(result = load.setValue(load_max));

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

                trackBarRPM.Minimum = (int)rpm_min;
                trackBarRPM.Maximum = (int)rpm_max;

                trackBarLoad.Minimum = (int)load_min;
                trackBarLoad.Maximum = (int)load_max;

                trackBarRPM.Value  = 1000;
                trackBarLoad.Value = (int)load_max;

                ERRCHECK(result = car.start());

                initialised = true;
            }


            /*
             *  "Main Loop"
             */
            if (trackbarscroll)
            {
                ERRCHECK(result = rpm.setValue((float)trackBarRPM.Value));
                ERRCHECK(result = load.setValue((float)trackBarLoad.Value));

                trackbarscroll = false;
            }

            float rpmvalue = 0.0f;

            ERRCHECK(result = rpm.getValue(ref rpmvalue));

            statusBar.Text = "RPM Value = " + rpmvalue;

            ERRCHECK(result = eventsystem.update());

            /*
             *  Clean up and exit
             */
            if (exit)
            {
                ERRCHECK(result = eventgroup.freeEventData());
                ERRCHECK(result = eventsystem.release());

                Application.Exit();
            }
        }