0
0

Hi,

I’ve created a custom DSP node (based almost exactly on the C# custom DSP example), but when I add that node to my network the profile stops working, reporting "Corrupt packet detected, ignoring packet" as the status, and the node graph doesn’t get updated to show any changes.

Any thoughts as to why this would be happening?

Thanks,

Craig.

  • You must to post comments
0
0

Can you post the code you are using to create the custom DSP, or perhaps a snippit of it that reproduces the bad behavior?

  • You must to post comments
0
0

Hi Mathew,

Here’s the construction (adapted from the sample code)

[code:396lwy55]
private FMOD.DSP CreateDSP(FMOD.System system)
{
FMOD.DSP thisdsp = new FMOD.DSP();
FMOD.DSP_DESCRIPTION dspdesc = new FMOD.DSP_DESCRIPTION();
String dspname = "custom dsp "; // pad this to 32 characters
FMOD.DSP_READCALLBACK dspreadcallback = new FMOD.DSP_READCALLBACK(customCallback);
IntPtr name;

        dspdesc.name     = dspname.ToCharArray(0, 32);
        dspdesc.channels = 0;
        dspdesc.read     = dspreadcallback;

        dspDescriptions.Add(dspdesc);       // keep hold of the pointer to avoid garbage collection
        FMOD.RESULT result;
        result = system.createDSP(ref dspdesc, ref thisdsp);
        ERRCHECK(result, "Creating custom DSP");
        result = thisdsp.setActive(true);
        ERRCHECK(result, "Activating custom DSP");

        return thisdsp;

    }

[/code:396lwy55]

The callback routine just copies the input straight to the output (for debugging) and is being called fine and does what it’s supposed to do (at least I think it does :)

Anything you can see out of order with this?

Thanks!

Craig.

  • You must to post comments
0
0

The issue is dspdesc.name isn’t null terminated, it has a heap of spaces up to the array length which FMOD reads as an invalid packet.

I’m certainly no C# pro, there may be better ways to do this but this will work:
[code:2xaqhbhn]private String dspname = "My first DSP Unit";
...
char[] nameArray = new char[32];
dspname.ToCharArray().CopyTo(nameArray, 0);
dspdesc.name = nameArray;
[/code:2xaqhbhn]

  • You must to post comments
0
0

Hi Mathew,

Yep, that fixes it.

Interestingly, that code is copied directly from the C# sample that comes with FMOD, and it doesn’t terminate the string either. I noticed it, but decided to follow the example so you might want to update that to do the right thing :)

(from the sample)
[code:2gytgt4u]
private String dspname = "My first DSP unit ";

   [snip... code later on]
        /*
            Create DSP unit
        */
        dspdesc.name     = dspname.ToCharArray(0, 32);
        dspdesc.channels = 0;
        dspdesc.read     = dspreadcallback;


        result = system.createDSP(ref dspdesc, ref mydsp);
        ERRCHECK(result);

[/code:2gytgt4u]

Thanks,

Craig.

  • You must to post comments
0
0

Yes, I noticed that too :p

The code I provided is now in that example for our next release.

  • You must to post comments
Showing 5 results
Your Answer

Please first to submit.