I need to start event playback at an offset (in milliseconds) that’s determined at runtime, i.e. I need something along the lines of Event::setPosition.
And I would like to do this without adding and configuring parameters in FMOD Designer (I have hundreds of events), if parameters are indeed a way of achieving this.
So I have thought about calling Channel::setPosition for every channel in my event’s channel group, but have not done so because ChannelGroup::getNumChannels (returning FMOD_OK) is telling me my event has 0 channels, even though the event handle is valid and seems to play back fine.
Why isn’t there a direct method for setting the event playback position? Surely what I want to do is a simple task?
I realise that I am probably looking at events in the wrong way – clearly I could do with some direction here…
- telerad asked 10 years ago
I think they are only at the leaves, but I’m not 100% sure. It’s also the sort of thing that could change across different versions of FMOD, so I look for channels in all channel groups. The code is no more complex and it’s a negligable amount of additional computation, especially since most event trees are relatively shallow.
That did the trick, i.e. I can get and set channel properties.
I realise that this type of channel-level event manipulation only makes sense for simple events, e.g. talking about [i:b7s8pjln][b:b7s8pjln]the[/b:b7s8pjln][/i:b7s8pjln] position of an event is not always possible seeing as there can be many channels, each with a different position (unless one defines it to be the position of the first active channel in the tree, for example).
In my case, the events I’m fiddling with have only one channelgroup containing one channel, so I think this channel-level approach does make sense.
Awesome. Glad it worked for you.
I agree that this kind of manipulation is pretty dangerous. I’ve never been bitten by it, but we only do it when we know that the sound we’re doing it to will be ok with that type of manipulation. It’s also sometimes a good way to do something if there isn’t a corresponding effect in Desinger. For example, we used to use it to call setSpeakerSpread before that effect existed.
An event is really a channel group with a tree of channel groups below it. The real channels are in various places in that tree. If you write a simple function to recursively traverse the tree you can get at all the channels easily enough.
I try not to do it often myself, but I do it often enough that I wrote a little helper function called GetChannelsInEvent() which takes a channel group and returns an array of channels. That way I don’t dupe the traversal code all over the place.
Aha… So I should be traversing the channel groups belonging to the event’s channel group?
Do you know if events only reside in the tree leaves, i.e. those channel groups for which numGroups == 0?
I will give this a bash and get back to you…
Please login first to submit.