0
0

Hallo,
is it generally possible to define eventsystem-instances like parameters as vectors.if so, are there exceptions?

for example if i want to play more than one car und set the parameters in a loop like this:

for(i=0;i<N_Cars;i++){
result=FMOD_EventParameter(RPM[i], rpm(i));
ERRCHECK(result);}

Greetz
Chrissey

  • You must to post comments
0
0

Hi Chrissey,

Sure you can do that, the EventParameter is just a pointer, so you can store it in a vector, list, map or any other data structure.

If you’re using the C interface it would look something like this:
[code:322gzupp]
std::vector<FMOD_EVENTPARAMETER*> eventParameters;

// Add an Event Parameter to the vector
{
FMOD_EVENTPARAMETER* param = 0;
FMOD_Event_GetParameter( event, "rpm", &param );
eventParameters.push_back( param );
}[/code:322gzupp]

[code:322gzupp]
// Update all the Event Parameters
for(i=0;i<N_Cars;i++){
FMOD_EventParameter_SetValue( eventParameters[i], 1.0f );
}[/code:322gzupp]

  • You must to post comments
0
0

Thanks for your help.

I tried to do as you said, but there are problems with the fmod_vectors…
They are defined like this:

FMOD_VECTOR *position[N_Car];

I get the position from a class called Cockpit and want to set the positions as vectors like this but it gives me an Invalid Handle on writing the positions if N_Car>1:

for(int i=0;i<N_Car;i++){
position[i]->x = Cockpit->ObjektPosition_X(i);
position[i]->y = 0.0;
position[i]->z = Cockpit->ObjektPosition_Y(i);

result = FMOD_Event_Set3DAttributes(Engine[i],position[i],],(0,0,0),(

0,0,0));
ERRCHECK(result);
}

  • You must to post comments
0
0

I think there may be some confusion here regarding the ambiguous use of the term ‘vector’. In FMOD a FMOD_VECTOR is 3 floats representing a point in 3D space. In STL a std::vector is a contiguous (array-like) container. You can create an std::vector of FMOD object pointers, you cannot create an FMOD_VECTOR of FMOD object potiners

  • You must to post comments
0
0

Exactly…
I tried to create a std::vector of FMOD_Event and FMOD_Vector as well.that is what i meant by the initialization
FMOD_VECTOR *position[N_Car];

So i want to set the positions of N cars in 3d space.

but it doesnt work like in that example, there is an invalid handle in setting the 3d attributes, the other functons work correctly!

  • You must to post comments
0
0

Just to be clear,

When i do this in a loop and i have just one car, it works fine!
but theres an error, when i initialize more than one car!

i don´t think the float X,Y,Z have to be of type std::vector ,too?

  • You must to post comments
0
0

I don’t understand your question, can you post the code which you are having trouble with?

  • You must to post comments
0
0

I never played with event myself; never even looked at it… but should you not use the channel version instead?

  • You must to post comments
0
0

[quote:3a3ssq1j]I don’t understand your question, can you post the code which you are having trouble with?[/quote:3a3ssq1j]

Sure, here is the short version.I just want to get more than one engine and set multiple positions for there position.when N_Car=1 it works fine, but if it´s bigger than 1 it gives back an invalid handle.

[code:3a3ssq1j]
FMOD_VECTOR *position[N_Car];
FMOD_EVENT *Engine[N_Car];

result = FMOD_EventSystem_Create(&eventsystem);
ERRCHECK(result);
result = FMOD_EventSystem_Init(eventsystem, 64, FMOD_INIT_NORMAL, 0, FMOD_EVENT_INIT_NORMAL);
ERRCHECK(result);
result = FMOD_EventSystem_SetMediaPath(eventsystem,"..//media//");
ERRCHECK(result);

for(int i=0;i<N_Car;i++){
result = FMOD_EventGroup_GetEvent(eventgroup,"Engine",0,&Engine[i]);
ERRCHECK(result);}

position[i] = new FMOD_VECTOR;
velocity[i] = new FMOD_VECTOR;

for(int i=0;i<N_Car;i++){
position[i]->x = Cockpit->ObjektPosition_X(i);
position[i]->y = 0.0;
position[i]->z = Cockpit->ObjektPosition_Y(i);

result = FMOD_Event_Set3DAttributes(Engine[i],position[i],],(0,0,0),(
0,0,0));
ERRCHECK(result);
}[/code:3a3ssq1j]

  • You must to post comments
0
0

Ok i may have confused a dynamic vector and static array…
but both end in the same error…

[code:2ltasdkd]
std::vector<FMOD_EVENT*> Engines;
FMOD_EVENT *Engine[N_Car];
for(int i=0;i<N_FCar;i++){
result = FMOD_EventGroup_GetEvent(eventgroup,"Engine",0,&Engine[i]);
ERRCHECK(result);
Engines.push_back(Engine[i]);}[/code:2ltasdkd]

i set the positions correctly and it fails in this function
[code:2ltasdkd]
for(int j=0;j<N_Car;j++){
result = FMOD_Event_Set3DAttributes(Engines[j],position[j],velocity[j],(0,0,0));
ERRCHECK(result);
}[/code:2ltasdkd]

to be exact, i want to get the same events and parameters but play them multiple times…is that possible?

  • You must to post comments
0
0

What is the ‘max playbacks’ property for that event?

  • You must to post comments
Showing 10 results
Your Answer

Please first to submit.