C External and multichannel input - where are my samples?

Magnus Berendes's icon

Hi,

I want my external to use multichannel input but i cannot figure out how I can access the contents of the multichannel inlet. My external has 1 inlet with a connected MC patch cord, getnuminputchannels in _dsp64 returns the correct number of channels (8 in my case).

The documentation states "the numins parameter to the perform method will be the count of channels in the input" but in my _perform64 function my numins is only 1? Consequently ins[1] points into nowhere.

Sorry if this question is totally obvious but I couldn't find any resource to help me with this. Any pointer to the correct documentation or a solution would be greatly appreciated. Thanks!

👽'tW∆s ∆lienz👽's icon

i haven't tried the MC part of the SDK docs thoroughly enough yet, but just wanted to mention, if you ask 'external dev' questions(whether in C or C++) in the 'dev' specific part of the forums, you'll get quicker answers:

for anything involving the Max SDK(either the regular C SDK or the C++ min-devkit)

also(though i don't know the exact answer, in case it can help), sometimes when the SDK doesn't explain things thoroughly, i go to the example code, particularly the ones mentioned at the end here: https://cycling74.com/sdk/max-sdk-8.0.3/chapter_mc.html ...you could take the code from one of those examples and start from there... for example, i might try something like this which appears in both the gridmeter~ and the mc.rotate~ examples:
...long ch;
double *in, *out;

    for (ch = 0; ch < numins; ch++) { // for each input channel
        in = ins[ch];..........

Magnus Berendes's icon

Thanks for your answer. I didn't realize that dev would be the appropriate part. But anyhow, your referal to the examples helped me. mc.rotate contained a line that seemed suspicous:

x->m_obj.z_misc |= Z_NO_INPLACE | Z_MC_INLET
Searching for Z_MC_INLET brought me to the c75_msp.h which defined it:

static const int Z_MC_INLETS = 32; ///< object knows how to count channels of incoming multi-channel signals

After setting this in my code (funnily I'm probably using some outdated version of the header in the project, I had to add Z_MC_INLETS manually), it finally works. A bit weird that the documentation would omit this?