# DSP Nodes showing 0 inputs and 0 outputs

**URL:** <https://qa.fmod.com/t/dsp-nodes-showing-0-inputs-and-0-outputs/20509>\
**Category:** FMOD Engine\
**Created:** [August 8, 2023, 6:00am UTC](https://qa.fmod.com/t/dsp-nodes-showing-0-inputs-and-0-outputs/20509 "2023-08-08T06:00:47Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![heavisideresearch](https://avatars.discourse-cdn.com/v4/letter/h/a88e4f/32.png) [@heavisideresearch](https://qa.fmod.com/u/heavisideresearch)\
**Post date:** [August 8, 2023, 6:00am UTC](https://qa.fmod.com/t/dsp-nodes-showing-0-inputs-and-0-outputs/20509/1 "2023-08-08T06:00:47Z")

</div>

I’m using the Core FMOD API within Unity, but not using the unity integration. When I create a new DSP node, it doesn’t have any input or output channels, even after calling `setChannelFormat`. I’ve created a minimal example that shows the problem:

```auto
using UnityEngine;

public class FMODTest : MonoBehaviour
{
    public FMOD.System FMODSystem;
    // Start is called before the first frame update
    void Start()
    {
        CheckResult(FMOD.Factory.System_Create(out FMODSystem));
        CheckResult(FMODSystem.init(
	        512,
	        FMOD.INITFLAGS.NORMAL | FMOD.INITFLAGS.PROFILE_ENABLE,
	        (System.IntPtr)null));
        Debug.Log("FMOD Core Initialized");

        FMOD.ChannelGroup nullCG = new FMOD.ChannelGroup(System.IntPtr.Zero);

		CheckResult(FMODSystem.getMasterChannelGroup(out FMOD.ChannelGroup masterCG));
        CheckResult(masterCG.getDSP(0, out FMOD.DSP masterFader));
        CheckResult(FMODSystem.createDSPByType(FMOD.DSP_TYPE.MIXER, out FMOD.DSP mixer));
        masterFader.addInput(mixer, out FMOD.DSPConnection conn);
        mixer.setActive(true);
        mixer.setChannelFormat(0, 2, FMOD.SPEAKERMODE.STEREO);
        conn.getMixMatrix(null, out int outChans, out int inChans);
        Debug.LogFormat("Got {0} input channels and {1} output channels", inChans, outChans);
        // always shows 0 inputs and 0 outputs
    }

    // Update is called once per frame
    void Update()
    {
        FMODSystem.update();
    }

	private void OnDestroy()
	{
        CheckResult(FMODSystem.release());
	}

	public static void CheckResult(FMOD.RESULT res) { 
        if(res != FMOD.RESULT.OK) {
            Debug.LogErrorFormat("FMOD Error: {0}", res);
        }
    }
}

```

---

<div class="post-metadata">

**Author:** ![heavisideresearch](https://avatars.discourse-cdn.com/v4/letter/h/a88e4f/32.png) [@heavisideresearch](https://qa.fmod.com/u/heavisideresearch)\
**Post date:** [August 8, 2023, 7:08am UTC](https://qa.fmod.com/t/dsp-nodes-showing-0-inputs-and-0-outputs/20509/2 "2023-08-08T07:08:25Z")

</div>

it looks like I can get nonzero input and output channels by first calling `setMixMatrix`, but it doesn’t look like I can set them arbitrarily. For instance, after calling `conn.setMixMatrix(new float[32], 16, 2);`, I end up with 16 input and 16 output channels, instead of 16 output and 2 input, as I expected. It’s also not clear to me how `setChannelFormat` fits in.

My goal here is to have 8 different mix nodes, where each one takes 2 channels as input, and sends to a pair of outputs in my 16-channel audio interface.

So mixer #1 would take its stereo input and route to channels 1+2, mixer #2 would take its stereo input and route to 3+4, etc. What’s the right sequence of channel configurations to set that up?

---

<div class="post-metadata">

**Author:** ![Connor\_FMOD](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/connor_fmod/32/3685_2.png) [@Connor\_FMOD](https://qa.fmod.com/u/Connor_FMOD)\
**Post date:** [August 13, 2023, 11:02pm UTC](https://qa.fmod.com/t/dsp-nodes-showing-0-inputs-and-0-outputs/20509/3 "2023-08-13T23:02:23Z")

</div>

Hi,

> [@heavisideresearch](#):
>
> When I create a new DSP node, it doesn’t have any input or output channels

Here the issue is `setChannelFormat` is being called on the `DSP` while the `DSPConnection` is being checked for its outputs/inputs while it hasn’t been set.

> [@heavisideresearch](#):
>
> `setMixMatrix`, but it doesn’t look like I can set them arbitrarily.

This is a bit confusing, while the mix matrix is being set using the input and output you provide it has to use the greatest of those two values to create the matrix thus it returns `16,16` in this situation. This is confusing and I will make a note to improve this in our documentation. However, the mix matrix will be constructed with the values you provide.

> [@heavisideresearch](#):
>
> So mixer #1 would take its stereo input and route to channels 1+2, mixer #2 would take its stereo input and route to 3+4, etc. What’s the right sequence of channel configurations to set that up?

So you were heading in the right direction using the `DSPConnections` and setting their mix matrices. How you set the matrix is what we will use to control where the output is going. Rather than using `new float[32]` when setting the matrix we will need to explicitly initialize it:

```auto
float[] matrix = {
	1,0,
	0,1,
	0,0,
	0,0,
	0,0,
	0,0,
	0,0,
	0,0,
	0,0,
	0,0,
	0,0,
	0,0,
	0,0,
	0,0,
	0,0,
	0,0
};

```

Here we are closing all channels except `FL` and `FR`, you will continue this for all the other `DSPConnections` essentially using them to block all the audio you do not wish to pass through and passing the audio only to the desired channels.

Hope this helps!

---

<div class="post-metadata">

**Author:** ![heavisideresearch](https://avatars.discourse-cdn.com/v4/letter/h/a88e4f/32.png) [@heavisideresearch](https://qa.fmod.com/u/heavisideresearch)\
**Post date:** [August 14, 2023, 4:37am UTC](https://qa.fmod.com/t/dsp-nodes-showing-0-inputs-and-0-outputs/20509/4 "2023-08-14T04:37:39Z")

</div>

> Here the issue is `setChannelFormat` is being called on the `DSP` while the `DSPConnection` is being checked for its outputs/inputs while it hasn’t been set.

The inputs/outputs haven’t been set, but I thought that was what `setChannelFormat` is supposed to be doing. Maybe I’m misunderstanding what `setChannelFormat` does - I thought it would force the number of input channels for a `DSP`, and their format. So once I’ve called `mixer.setChannelFormat(0, 0, FMOD.SPEAKERMODE.STEREO)`, the `mixer` DSP node should always have 2 input channels, right?

> This is a bit confusing, while the mix matrix is being set using the input and output you provide it has to use the greatest of those two values to create the matrix thus it returns `16,16` in this situation. This is confusing and I will make a note to improve this in our documentation. However, the mix matrix will be constructed with the values you provide.

To make sure I understand here, you’re saying that `getMixMatrix` will always return a square matrix, even if the actual mix matrix for the connection is not square? Is there a way to find out how many input and output channels a connection actually has?

---

<div class="post-metadata">

**Author:** ![Connor\_FMOD](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/connor_fmod/32/3685_2.png) [@Connor\_FMOD](https://qa.fmod.com/u/Connor_FMOD)\
**Post date:** [August 17, 2023, 4:32am UTC](https://qa.fmod.com/t/dsp-nodes-showing-0-inputs-and-0-outputs/20509/5 "2023-08-17T04:32:31Z")

</div>

Hi,

> [@heavisideresearch](#):
>
> The inputs/outputs haven’t been set, but I thought that was what `setChannelFormat` is supposed to be doing.

This is for setting the channels on the [FMOD Engine | Core API Reference - DSP](https://fmod.com/docs/2.02/api/core-api-dsp.html) not on the [FMOD Engine | Core API Reference - DSPConnections](https://fmod.com/docs/2.02/api/core-api-dspconnection.html) which have different requirements for setthing them up.

> [@heavisideresearch](#):
>
> Is there a way to find out how many input and output channels a connection actually has?

Yes, I would suggest adding the [FMOD Engine | Core API Reference - FMOD\_INITFLAGS\_PROFILE\_METER\_ALL](https://fmod.com/docs/2.02/api/core-api-system.html#fmod_initflags:~:text=FMOD_INIT_PROFILE_METER_ALL) which will allow you to see the channels on each DSP.

I will also suggest calling[FMOD Engine | Core API Reference - System::setSoftwareFormat](https://fmod.com/docs/2.02/api/core-api-system.html#system_setsoftwareformat) with the values: `setSoftwareFormat(48000, 16, FMOD_SPEAKERMODE_RAW)`. [FMOD Engine | Core API Reference - FMOD\_SPEAKERMODE\_RAW](https://fmod.com/docs/2.02/api/core-api-common.html#fmod_speakermode:~:text=System%3A%3Ainit.-,FMOD_SPEAKERMODE_RAW,-Assume%20there%20is) will allow the fmod system to accommodate the 16 channels you are looking for.

Hope this helps!
