<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Apologies for hijacking this thread, but here's another idea that might simplify the initialization problem.</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Suppose that [savestate] could take any arguments and then output them as a list when the object is loaded but its contents are empty. So for instance [savestate 1 2] would output "1 2" when it is loaded, unless it has some other contents to output. That way,
 you could specify a default setting for the abstraction without having to use [loadbang], as in Miller's patch.<br>
</div>
<hr style="display:inline-block;width:98%" tabindex="-1">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>From:</b> Pd-list <pd-list-bounces@lists.iem.at> on behalf of Liam Goodacre <liamg_uw@hotmail.com><br>
<b>Sent:</b> 13 October 2018 09:07<br>
<b>To:</b> pd-list@lists.iem.at<br>
<b>Subject:</b> Re: [PD] save state. race condition?</font>
<div> </div>
</div>
<meta content="text/html; charset=us-ascii">
<style type="text/css" style="display:none">
<!--
p
        {margin-top:0;
        margin-bottom:0}
-->
</style>
<div dir="ltr">
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
Since you mentioned that [savestate] fires before [loadbang], I tested it and it seems that it functions as a solution for [initbang] also (great!). Ie. if you use [savestate] to dynamically create an inlet inside the abstraction, the connection will not be
 broken if you save and re-open the parent patch.</div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
Should this be documented also?<br>
</div>
<hr tabindex="-1" style="display:inline-block; width:98%">
<div id="x_divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" color="#000000" style="font-size:11pt"><b>From:</b> Pd-list <pd-list-bounces@lists.iem.at> on behalf of Miller Puckette <msp@ucsd.edu><br>
<b>Sent:</b> 12 October 2018 16:58<br>
<b>To:</b> Atte<br>
<b>Cc:</b> pd-list@lists.iem.at<br>
<b>Subject:</b> Re: [PD] save state. race condition?</font>
<div> </div>
</div>
<div class="x_BodyFragment"><font size="2"><span style="font-size:11pt">
<div class="x_PlainText">One thing that's potentially troublesome is combining savestate and loadbang<br>
(and loadbang-like behavior built into GUIs as well.)  The savestate<br>
output arrives before any loadbangs.  So there's extra work to do if<br>
you want an object to initialize itself but also to use savestate.  Here's<br>
an example:<br>
<br>
#N canvas 29 70 469 394 16;<br>
#X floatatom 103 123 7 0 0 1 high - -;<br>
#X obj 24 313 outlet~;<br>
#X obj 103 5 loadbang;<br>
#X obj 24 48 inlet~;<br>
#X floatatom 103 146 7 0 0 1 low - -;<br>
#X msg 103 67 1;<br>
#X obj 25 275 clip~;<br>
#X obj 375 209 f;<br>
#X obj 375 238 pack;<br>
#X obj 288 145 savestate;<br>
#X obj 288 249 unpack;<br>
#X obj 103 34 spigot 1;<br>
#X msg 194 34 0;<br>
#X connect 0 0 6 2;<br>
#X connect 0 0 7 1;<br>
#X connect 2 0 11 0;<br>
#X connect 3 0 6 0;<br>
#X connect 4 0 6 1;<br>
#X connect 4 0 8 1;<br>
#X connect 5 0 0 0;<br>
#X connect 6 0 1 0;<br>
#X connect 7 0 8 0;<br>
#X connect 8 0 9 0;<br>
#X connect 9 0 10 0;<br>
#X connect 9 0 12 0;<br>
#X connect 9 1 7 0;<br>
#X connect 10 0 0 0;<br>
#X connect 10 1 4 0;<br>
#X connect 11 0 5 0;<br>
#X connect 12 0 11 1;<br>
#X coords 0 -1 1 1 130 70 1 100 100;<br>
<br>
I badly need to update the documentation with better examples of how to use<br>
feaures like this...<br>
<br>
cheers<br>
Miller<br>
<br>
On Fri, Oct 12, 2018 at 04:56:39PM +0200, Atte via Pd-list wrote:<br>
> Hi<br>
> <br>
> I just simply flat out love the new savestate mechanism!<br>
> <br>
> I normally start from the example in the help, add sends/receives, I use it alot with number boxes and toggles.<br>
> <br>
> I found that in larger patches, sometimes the states doesn't always "get to" all receives, the gui elements seems to always work, but if I use a restored value, I need to add a [pipe 0.0001] after the [r $0-somevalue] and where I want to use it.<br>
> <br>
> I tried comming up with a simple example that shows this behavious, but it needs a patch of a certain complexity, so I'll have to continue on the bug-example.<br>
> <br>
> Anyone one else been bitten by this? Any tips on avoiding it?<br>
> <br>
> If it matters I'm on linux, pd version "0.49.0-2~bpo9+1" from debian backports...<br>
> <br>
> Cheers<br>
> -- <br>
> Atte<br>
> <br>
> <a href="http://atte.dk">http://atte.dk</a>   <a href="http://a773.dk">http://a773.dk</a><br>
> <br>
> <br>
> <br>
> _______________________________________________<br>
> Pd-list@lists.iem.at mailing list<br>
> UNSUBSCRIBE and account-management -> <a href="https://lists.puredata.info/listinfo/pd-list">
https://lists.puredata.info/listinfo/pd-list</a><br>
<br>
<br>
<br>
_______________________________________________<br>
Pd-list@lists.iem.at mailing list<br>
UNSUBSCRIBE and account-management -> <a href="https://lists.puredata.info/listinfo/pd-list">
https://lists.puredata.info/listinfo/pd-list</a><br>
</div>
</span></font></div>
</div>
</body>
</html>