I am trying to write a program which dynamically sets the 2D speaker levels for an event. I am trying to use the Event.getPropertyByIndex() and Event.setPropertyByIndex(). In c++ the second argument is a void* with the value to get or set. In C# this is an IntPtr. I am unsure how to correctly pass in an IntPtr which can then give me the value I need. I’ve tried many things and they either return an error Result or give back garbage. Any help is appreciated.
- JohnnyUtah asked 10 years ago
Well, I found out I was just using an int instead of a float. Here’s what worked, however:
(Imagine event is an Event you’ve got from your eventsystem)
float val = -1f;
IntPtr valPtr = new IntPtr(&val);
result = event.getPropertyByIndex((int)FMOD.EVENTPROPERTY.SPEAKER_R, valPtr, false);
val = -1f;
result = event.getPropertyByIndex((int)FMOD.EVENTPROPERTY.SPEAKER_L, valPtr, false);
I was just testing with this and stepped through it with a debugger to watch the values of val change. They did.
Please login first to submit.