notify question

Jul 31, 2013 at 1:21pm

notify question

CLASS_ATTR_SYM((t_class *)MAX_DeviceIO::m_class, “device_type”, 0, MAX_DeviceIO, m_p_device_type );
CLASS_ATTR_ENUM((t_class *)MAX_DeviceIO::m_class, “device_type”, 0, “Launchpad Quneo Push Lemur TouchOSC Mira” );
class_addmethod((t_class *)MAX_DeviceIO::m_class, (method)MAX_DeviceIO::notify, “notify”, A_CANT, 0);

Hi, I have the above code..

The attribute appears in the inspector as required, with the required enumeration, but I have a couple of issues:
1) instantiating … ‘@device_type Launchpad’ doesn’t have any effect – the autocomplete doesn’t show “device_type” as an option as I would expect it to. The inspector shows device_type along with the enumerations I’ve supplied
2) the notify() method is not called if I send a “device_type Launchpad” into the object

thx for any helpers!

#257719
Jul 31, 2013 at 11:03pm

1) Why would you expect the autocomplete to show device_type as an option? You are declaring an attribute (and an attribute of an attribute) for your object. Unless I misunderstand your question, the autocomplete has nothing to do with it.

2) If this is not an UI object you need to attach the object to itself in order to receive notifications. Please, check this thread: http://cycling74.com/forums/topic/notify-when-attribute-changes/

Hope this helps

- Luigi

#257746
Jul 31, 2013 at 11:39pm

Hi,

1. You need to call ‘attr_args_process’ also ( https://github.com/nicolasdanet/Flop/blob/master/Sources/Flop/flopAttributes.c#L110 ).

@Luigi : i didn’t know the “attach to itself trick” ; thanks. Is it supposed to be detached from itself in the free method? I guess not.

#257747
Aug 1, 2013 at 3:44am

thanks for the help guys, will check out later…

@Luigi, I was just thinking maybe that when you registered the attributes that MAX might add them to it’s DB for autocomplete…

#257760
Aug 1, 2013 at 4:45am

@Lee, I can tell you that’s not the case. However affecting the autocomplete DB might be possible by editing some files in the Cycling74 folder. Obviously you gotta ask C74 for the details on those files because I am pretty much clueless about them.

Cheers

- Luigi

#257765
Aug 1, 2013 at 5:09am

Hey – not really that bothered, if it happend automatically that’d be great, otherwise np :)

Lee

#257766
Aug 1, 2013 at 5:36am

The database culls its information from the refpages (the ones ending in .maxref.xml). At the moment there isn’t really an official model for this, but you can look at TapTools to see an example ( e.g. https://github.com/tap/TapTools/blob/master/TapTools/docs/tap.comb~.maxref.xml ).

- .. –

#257771
Aug 2, 2013 at 6:00am

Thanks Tim

#257850

You must be logged in to reply to this topic.