Forums > Dev

accessing FTM data from your external?

September 18, 2007 | 10:53 pm

Hi,

I am trying to access ftm data to use in my externals. For instance I would like to have access to the data inside an fmat. How can I do that?
I have included the ftmlib framework in my external and bounded the "ftm.obj" to a function that does nothing for now.

Thanks


September 19, 2007 | 9:54 am

Am 19.09.2007 um 00:53 schrieb tirilo:

>
>
> Hi,
>
> I am trying to access ftm data to use in my externals. For instance
> I would like to have access to the data inside an fmat. How can I
> do that?
> I have included the ftmlib framework in my external and bounded
> the "ftm.obj" to a function that does nothing for now.

If you want to access FTM data you have to write your external using
the FTM API. You should download the FTM source code (from
sourceforge) and see how it is done. Also, joining the FTM developers
mailing list (also on sourceforge) and asking your questions there
might help since there is really no documentation apart from the
source code itself.

Olaf


September 20, 2007 | 3:18 pm

Hello, and thank you for your answer.
So using the ftm api is what i was trying to do. I actually linked my external against the ftmlib library and I am at the point where I pass a reference to an fmat into my external’s inlet and get the "ftm.obj" message. To test if I could get any info about the fmat I was trying to do something like:

class_addmethod(c, (method)myext_testftm, "ftm.obj", A_GIMME, 0L);

and

void myext_testftm(t_myext *x, t_symbol *s, short argc, t_atom *argv)
{
short i;
int j =0;
char str[256];
fmat_t* fmat = 0;

int n = 0;
int m = 0;

fmat = &argv[i].a_w;

/*to test if I can get m and n which I assume are the fmat sizes*/
m = fmat_get_m(fmat);
n = fmat_get_n(fmat);

cpost("m = %d n = %dn" , m , n);
}

This was to see if just casting to an fmat would work.
No luck.
I have browsed in the ftm source code briefly but it will probably take me ages to actually get the jist of it. In particular I have tried to mimick what I understand from the ftm.print.c file to see how they do it but still no luck. So I have come up with a "dirty" alternative right now where I just use ftm.iter in my patch and feed the results to my external via an additional inlet. It is not ideal but works so far.

Thanks for pointing me to the ftm list though. I will definetly join when I have more time to spend on actually understanding ftm code.

Cheers.


September 20, 2007 | 9:11 pm

Am 20.09.2007 um 17:18 schrieb tirilo:

>
> Hello, and thanks you for your answer.
> So using the ftm api is what i was trying to do. I actually linked
> my external against the ftmlib library and I am at the point where
> I pass a reference to an fmat into my external’s inlet to get the
> "ftm.obj" message. To test if I could get any info about the fmat I
> was trying to do something like:
>
> class_addmethod(c, (method)myext_testftm, "ftm.obj", A_GIMME, 0L);

This is the recommended way:

class_addmethod(c, (method)myext_testftm, ftm_str_obj, A_GIMME, 0);

Actually the FTM developers recommend to use the strange and un
documented FTM MACROS instead of the native Max API code because that
will make your externals compilable under PD in the future, in case
you care about that. Additionally, some more advanced stuff (like
reading from a track containing fmats) can only be done using these
macros.

> fmat = &argv[i].a_w;

Should be:

fmat = (fmat_t *)fts_get_object(argv);

> I have browsed in the ftm source code briefly

Chack ftm.midiunparse.c, that will help you a lot I guess.

Olaf


September 20, 2007 | 10:53 pm

It works thanks!


Viewing 5 posts - 1 through 5 (of 5 total)