i create a EventInstance,then in EVENT_CALLBACK ，
where case FMOD.Studio.EVENT_CALLBACK_TYPE.CREATED:
FMOD.RESULT r = eventInstance.getChannelGroup(out group);
if (FMOD.RESULT.OK == eventInstance.getChannelGroup(out group))
get ChannelGroup success , then, i want to get channel,
int num = 0;
if (FMOD.RESULT.OK == group.getNumChannels(out num))
the num is always 0, i don’t know why.
i want to get channel, is want to setPosition，
i want to play sound from statPosition where i set, like
if (FMOD.RESULT.OK == group.getChannel(i, out channel))
is there anyone can help me to get the channel or get method to set the starPosition
At last I use a tick to self tick my playing sound, not use Fmod callback!
when PLAYBACK_STATE.STARTING I mark the time and setVolume(0)
in PLAYBACK_STATE.PLAYING i Judgment time interval
if time is over I set the StarMs, then setVolume(1.0f)…
The EventInstance has a function available, SetTimelinePosition. This will allow you to do the same thing from the EventInstance level instead of digging into the channel.
Hi, I want to know if you have solved the problem about the 0 number of channels on getNumChannels() function, and how to get the channel.
Just bumping this—I’m experiencing similar trouble trying to get getNumChannels to return anything but 0. Perhaps it’s similar to having to flush commands or wait a tick in the way that you need to wait for an event instance to create its corresponding channel group?
For reference, I’m trying to batch reassign a bunch of channels (or just one channelGroup) to a different bus at runtime and am trying to get a full list of a group’s channels and then swap them with a for loop which iterates through their indexes.
Currently adjusting Core API DSP / ChannelGroup structures under the Event System is not recommended. We have plans to add support for this in a later major version of FMOD, as it will likely require a lot of work and cause behavior changes.
I know this is an old thread and I’m sorry about that but I’m having the same issue and there is no resolution here. It would be great if we could add a resolution to this thread that either explains why the number of channels is zero or explains how to get a channel from a playing instance.
Even if I keep calling getNumChannels in an Update function, on a sound instance that I can currently hear playing, it still always returns zero.
I read elsewhere on the forum that you can play a sound backwards if you set the frequency on the channel, there is nowhere to set the frequency on the instance afaics and you cannot pass a number < 0 into setPitch.
Any help much appreciated!
I’m not aware of a reason that the number of channels would be zero, other than there are no channels playing, but checking the
FMOD.RESULT of any FMOD function could help point out any problems.
The reason getNumChannels returns 0 is because in the root ChannelGroup (fetched from the EventInstance) there are no Channels. An Event is comprised of a hierarchy of ChannelGroups, the leaves of that hierarchy contains the actual Channels. So to find the Channels you need to use getNumGroups and getGroup and recursively dig down through the hierarchy, checking at each layer (group) whether there are any Channels.
Reverse playback is possible, but very limited, the sounds must be completely decompressed into memory to support this feature. Usually Studio will use either streaming or load into memory, both of which don’t support reverse playback, hence there is no way to control this in Studio land. From a Core API perspective, you can create a sound using the FMOD_CREATESAMPLE flag, then set a negative frequency on the played Channel.
Thanks for your response, that makes a bit more sense. I’ve had to move on from this unfortunately. We have used reverse events for everything that needs to be played backwards which is a bit wasteful memory wise. However, I might come back to it and try searching through more groups for the channel, if memory use becomes an issue (I had assumed that the instance belonged to a group and therefore would only have one, I missed the getNumGroups method when searching the API).