0
0

Hi,

I have replaced this code with the working program under Borland. Below the request to not read three comments, they concern to an old code which contained mistakes. For beginners to study under Borland: the Projectfolder should is there, where examples
C:\Programme\FMOD SoundSystem\FMOD Programmers API Win32\fmoddesignerapi\examples
.

[code:h0fhtfwh]

include "../../api/inc/fmod_event.hpp"

include "../../api/inc/fmod_errors.h"

include <windows.h>

include <stdio.h>

include <stdlib.h>

include <conio.h>

const float UPDATE_INTERVAL = 100.0f;

//——————————————————————————
void ERRCHECK(FMOD_RESULT result)
{
//printf("FMOD ok! (%d) %s\n", result, FMOD_ErrorString(result));
if (result != FMOD_OK)
{
printf("FMOD error! (%d) %s\n", result, FMOD_ErrorString(result));
getchar();
exit(-1);
}
}
//——————————————————————————
int main(int argc, char *argv[])
{
FMOD_EVENTSYSTEM *eventsystem;
FMOD_EVENTGROUP *eventgroup;
FMOD_EVENTCATEGORY *mastercategory;
FMOD_EVENT *car;
FMOD_EVENTPARAMETER *rpm;
FMOD_EVENTPARAMETER *load;
FMOD_RESULT result;

int                  key;
float                rpm_val, rpm_min, rpm_max, rpm_increment, load_val, load_min, load_max, load_increment;

result = FMOD_EventSystem_Create(&amp;eventsystem);
result = FMOD_EventSystem_Init(eventsystem, 64, FMOD_INIT_NORMAL, 0, FMOD_EVENT_INIT_NORMAL);
result = FMOD_EventSystem_SetMediaPath(eventsystem, &quot;..\\media\\&quot;);
result = FMOD_EventSystem_Load(eventsystem,&quot;examples.fev&quot;, 0, 0);
result = FMOD_EventSystem_GetGroup(eventsystem, &quot;examples/AdvancedTechniques&quot;, FMOD_EVENT_DEFAULT, &amp;eventgroup);

// result = FMOD_EventGroup_GetEvent(eventgroup, "car", FMOD_EVENT_DEFAULT, &car);
result = FMOD_EventGroup_GetEvent(eventgroup, "car", 0, &car);
result = FMOD_EventSystem_GetCategory(eventsystem, "master", &mastercategory);

result = FMOD_Event_GetParameter(car, &quot;load&quot;, &amp;load);
result = FMOD_EventParameter_GetRange(load, &amp;load_min, &amp;load_max);
result = FMOD_EventParameter_SetValue(load, load_max);
result = FMOD_Event_GetParameterByIndex(car, 0, &amp;rpm);
result = FMOD_EventParameter_GetRange(rpm,&amp;rpm_min, &amp;rpm_max);
result = FMOD_EventParameter_SetValue(rpm, 800.0f);

result = FMOD_Event_Start(car);

rpm_increment = (rpm_max - rpm_min) / UPDATE_INTERVAL;
FMOD_EventParameter_GetValue(rpm, &amp;rpm_val);
load_increment = (load_max - load_min) / UPDATE_INTERVAL;
FMOD_EventParameter_GetValue(load, &amp;load_val);


key = 0;
do
{
    if (kbhit())
    {
        key = getch();

        if (key == '1' || key == ',')
        {
            rpm_val -= rpm_increment;
            if (rpm_val &lt; rpm_min)
            {
                rpm_val = rpm_min;
            }
            result = FMOD_EventParameter_SetValue(rpm, rpm_val);
            ERRCHECK(result);
        }
        else if (key == '2' || key == '.')
        {
            rpm_val += rpm_increment;
            if (rpm_val &gt; rpm_max)
            {
                rpm_val = rpm_max;
            }
            result = FMOD_EventParameter_SetValue(rpm, rpm_val);
            ERRCHECK(result);
        }
        if (key == '-' || key == '_')
        {
            load_val -= load_increment;
            if (load_val &lt; load_min)
            {
                load_val = load_min;
            }
            result = FMOD_EventParameter_SetValue(load, load_val);
            ERRCHECK(result);
        }
        else if (key == '+' || key == '=')
        {
            load_val += load_increment;
            if (load_val &gt; load_max)
            {
                load_val = load_max;
            }
            result = FMOD_EventParameter_SetValue(load, load_val);
            ERRCHECK(result);
        }

/* else if (key == ‘ ‘)
{
bool paused;
result = FMOD_EventCategory_GetPaused(mastercategory, &paused);
paused != paused;
result = FMOD_EventCategory_SetPaused(mastercategory, paused);
}
*/
}

    result = FMOD_EventSystem_Update(eventsystem);
    ERRCHECK(result);
    Sleep(15);

    printf(&quot;RPM = %.4f, load = %.4f     \r&quot;, rpm_val, load_val);

} while (key != 27);

result = FMOD_EventSystem_Release(eventsystem);
ERRCHECK(result);

return 0;
}
[/code:h0fhtfwh]

Thanks und best Regaurds,

Alex

  • You must to post comments
0
0

Hi,

Why have you commented out all of the error checks? One of the functions is probably returning an error, this would give you a clue as to what is going wrong.

  • You must to post comments
0
0

i have to changed. I can not hear a music. i have to made an example. It is a nofunctionality. Why?

  • You must to post comments
0
0

You are constantly starting the event it seems, is that it?

  • You must to post comments
0
0

hi, i have to made an example under Borland. Please und Thanks.
FMOD is really good!

  • You must to post comments
0
0

you have to check the error codes

  • You must to post comments
Showing 5 results
Your Answer

Please first to submit.