Retrieve number of channels in Event in Unity

Hi,

How do I retrieve how many channels a StudioEvent has? i.e. Whether it is mono, stereo, or 6 channel etc?
The event in question is “2D” and has no 3D panner attached.

I can retrieve the ChannelGroup from the FMOD.Studio.EventInstance, and then call group.getMixMatrix(nulll, out outchannels, out inchannels, 0);
but it always return 6 and 6 for both inchannels and outchannels (because i’m working in 5.1 speaker mode).

So what is the correct way to retrieve the number of channels in the sound itself?

Thanks in advance,
MM

Hi,

Well, so far I have this…

    FMOD.Studio.EventInstance instance = e.Instance; // I made a public getter for instance

if (instance != null)
{
	FMOD.ChannelGroup group; instance.getChannelGroup(out group);
	if (group != null)
	{
		FMOD.DSP dsp;
		FMOD.CHANNELMASK channelmask; 
		int dspchannels;
		FMOD.SPEAKERMODE dspspeakermode;
		group.getDSP(0, out dsp);
		dsp.getChannelFormat(out channelmask, out dspchannels, out dspspeakermode);
	}
}

dspchannels now tells me whether I’m dealing with a mono, stereo or multi-channel event.

This seems a bit convoluted… and I have no idea if it is robust to all situations. Any one have a better suggestion?

A bigger problem, however, is that Event must be playing for it to work.
I’m writing code for setting the setMixMatrix from Unity, and I wold like the Unity Inspector to show the correct number of in/out channels BEFORE I press play.

It would seem to me that I should be able to get the number of channels from the Event before it is playing… from the FMOD.Studio.EventDescription would be ideal, but I don’t see how.

Any tips greatly appreciated!

MM

The way you have mentioned, using getChannelFormat, looks like the best way to get the number of channels on an event. Unfortunately the channelGroup will be null until the event has started playing.

You may be able to start and pause the event, before it becomes audible, long enough to get the channel format.

Cameron, I would like to make a feature request. Where is the correct place to do so?

Request:
Add output channel count to FMOD.Studio.EventDescription

Thanks,
MM

Here is fine, I will add the feature request to our tracker!