Closed monkeyswarm closed 8 years ago
This is on purpose as the inits are sent in the pd patch itself when it's loaded. I changed the Widget sendInitValue: method to a stub and it's overridden in objects that don't send by default, one of them is [mknob].
I noticed when refactoring that my test init patch was receiving double inits for all those objects, so ...
Are you proposing returning the sending behavior to Widget and overriding sendInitValue:to an empty method in those objects that don't need to send? That would be another option.
Also, my test patch is res/patches/tests/gui/inits.pd
Just double checking:
Current prints when loading inits.pd:
2016-01-19 22:21:58:103 PdParty[2251:70b] Pd: bng: bang
2016-01-19 22:21:58:103 PdParty[2251:70b] Pd: tgl: 1
2016-01-19 22:21:58:103 PdParty[2251:70b] Pd: hsl: 34
2016-01-19 22:21:58:103 PdParty[2251:70b] Pd: hradio: 2
2016-01-19 22:21:58:103 PdParty[2251:70b] Pd: vsl: 77
2016-01-19 22:21:58:103 PdParty[2251:70b] Pd: mknob: 42.3333
Old behavior. Note double prints when sending float in Widget sendInitValue:
2016-01-19 22:25:12:056 PdParty[2294:70b] Pd: bng: bang
2016-01-19 22:25:12:056 PdParty[2294:70b] Pd: tgl: 1
2016-01-19 22:25:12:056 PdParty[2294:70b] Pd: hsl: 34
2016-01-19 22:25:12:056 PdParty[2294:70b] Pd: hradio: 2
2016-01-19 22:25:12:056 PdParty[2294:70b] Pd: vsl: 77
2016-01-19 22:25:12:056 PdParty[2294:70b] Pd: bng: bang
2016-01-19 22:25:12:056 PdParty[2294:70b] Pd: tgl: 1
2016-01-19 22:25:12:056 PdParty[2294:70b] Pd: hsl: 34
2016-01-19 22:25:12:056 PdParty[2294:70b] Pd: hradio: 2
2016-01-19 22:25:12:056 PdParty[2294:70b] Pd: vsl: 77
2016-01-19 22:25:12:056 PdParty[2294:70b] Pd: mknob: 42.3333
mknob doesn't seem to send by default in libpd, unlike the iem guis.
Also, plenty of widgets do not have any value to send, so it makes sense to me that you need to override and implement sending in each subclass explicitly, as the docs say: https://github.com/danomatika/PdParty/blob/master/src/gui/Widget.h#L107
I could have worded it better: "this is done automatically by built in pd objects (number, slider, etc)," actually means "this happens automatically for iem guis in libpd so it doesn't need to happen in Obj-C"
Hi Dan, thanks for the detail, that all makes perfect sense. (I'm actually dealing with this very similar issue of double-sends right now in other parts of MobMuPlat). I'll retract the pull request.
By that logic, though, there's another question: doesn't that mean that this double-message-sending issue exists whenever a gui object receives a message that triggers an output. E.g. if you have a patch with a bang object, and then that bang receives a bang message, then two bangs will be triggered to its output: one by the bang in the pd patch, and one by the iOS GUI object...?
Not that I've experienced. So far, this is only the case with inits, otherwise we'd see lots of obvious double prints from pd.
Also, note the new Widget setup: & cleanup: methods which are used for any specially-needed resource creation/destruction (see Menubang).
Closing for now.
It looks like some of the initialization behavior (when widget.inits is true) has changed within the last few months, yielding behavior different than PureData on other platforms.