Jitter external question (beginner)

MIB's icon

I was wondering if someone could help me out with a jitter external related question.
I am new to this and don't quite understand the jit.fill example in the SDK (which I am using as a template for my external).

This is how I understand it:

1) look for a named matrix in the patcher and if it exists use it to write my data to it:

matrix = jit_object_findregistered(x->matrix_name);
        if (matrix&&jit_object_method(matrix, _jit_sym_class_jit_matrix)) {
                }

2) lock the matrix and get info from the matrix:

savelock = (long) jit_object_method(matrix,_jit_sym_lock,1);
jit_object_method(matrix,_jit_sym_getinfo,&minfo);
jit_object_method(matrix,_jit_sym_getdata,&bp);

3) write your data to the referenced matrix:

if (minfo.type==_jit_sym_char) {
        bp += x->plane;
    for (i=0;i

4) unlock the matrix:

jit_object_method(matrix,_jit_sym_lock,savelock);

Here is what I am not understanding. It looks like p is where my data goes... but I don't understand how it is referencing the matrix or how it is connected to the matrix. It works in the external but only for the first matrix. If I try to have two referenced matrices it won't work. I have two video streams I am trying to send to a matrix. could someone explain this to me? In case it is relevant, this is a Max external and I am not using a MOP.

Thanks a bunch!!

MIB's icon

Thanks, I will have a look!!