Dear List,
This is my first time writing here so please be gentle. :-) I'm working on a state saving system in vanilla for multiple instances of the same abstraction. I've got a good system up and running where I'm writing and reading to textfile using numerical creation arguments for the abstractions to separate the textfiles from each other. However, it would be a lot easier if the unique four digit $0 digits of the abstraction was saved with the .pd-file and not given a new number on re-booting the patch. There is probably a million scenarios where this behaviour would be not desired that I'm unaware of. But it would be nice to be able to skip giving the abstraction an argument on creation.
All best / Johan
One solution is to give each abstraction instance its own ID number from within the patch, bypassing $0. Ie. if you do this:
[loadbang] | [value load] x [+ 1] | [s $0-my-number]
you will generate unique numbers (1, 2, 3...) for each instance, according to creation order.
Things get complicated here when you decide to delete one of the instances and then save the patch--all of the subsequent numbers will be off when you re-load. You can probably get around this by having them all re-calculate every time one is loaded.
From: monologx@gmail.com Date: Fri, 8 Apr 2016 16:36:54 +0200 To: pd-list@lists.iem.at Subject: [PD] $0-abstraction question
Dear List,
This is my first time writing here so please be gentle. :-) I'm working on a state saving system in vanilla for multiple instances of the same abstraction. I've got a good system up and running where I'm writing and reading to textfile using numerical creation arguments for the abstractions to separate the textfiles from each other. However, it would be a lot easier if the unique four digit $0 digits of the abstraction was saved with the .pd-file and not given a new number on re-booting the patch. There is probably a million scenarios where this behaviour would be not desired that I'm unaware of. But it would be nice to be able to skip giving the abstraction an argument on creation.
All best / Johan
Pd-list@lists.iem.at mailing list UNSUBSCRIBE and account-management -> https://lists.puredata.info/listinfo/pd-list
Thanks Liam! That sounds very promising. I'll give it a go! Cheers
Skickat från min iPhone
8 apr 2016 kl. 19:03 skrev Liam Goodacre liamg_uw@hotmail.com:
One solution is to give each abstraction instance its own ID number from within the patch, bypassing $0. Ie. if you do this:
[loadbang] | [value load] x [+ 1] | [s $0-my-number]
you will generate unique numbers (1, 2, 3...) for each instance, according to creation order.
Things get complicated here when you decide to delete one of the instances and then save the patch--all of the subsequent numbers will be off when you re-load. You can probably get around this by having them all re-calculate every time one is loaded.
From: monologx@gmail.com Date: Fri, 8 Apr 2016 16:36:54 +0200 To: pd-list@lists.iem.at Subject: [PD] $0-abstraction question
Dear List,
This is my first time writing here so please be gentle. :-) I'm working on a state saving system in vanilla for multiple instances of the same abstraction. I've got a good system up and running where I'm writing and reading to textfile using numerical creation arguments for the abstractions to separate the textfiles from each other. However, it would be a lot easier if the unique four digit $0 digits of the abstraction was saved with the .pd-file and not given a new number on re-booting the patch. There is probably a million scenarios where this behaviour would be not desired that I'm unaware of. But it would be nice to be able to skip giving the abstraction an argument on creation.
All best / Johan
Pd-list@lists.iem.at mailing list UNSUBSCRIBE and account-management -> https://lists.puredata.info/listinfo/pd-list
Quoth Johan Ericsson on 08/04/2016 15:36:
Dear List,
This is my first time writing here so please be gentle. :-) I'm working on a state saving system in vanilla for multiple instances of the same abstraction. I've got a good system up and running where I'm writing and reading to textfile using numerical creation arguments for the abstractions to separate the textfiles from each other. However, it would be a lot easier if the unique four digit $0 digits of the abstraction was saved with the .pd-file and not given a new number on re-booting the patch. There is probably a million scenarios where this behaviour would be not desired that I'm unaware of. But it would be nice to be able to skip giving the abstraction an argument on creation.
All best / Johan
I normally create my abstraction with a numerical index, eg [abstraction 1], [abstraction 2] etc. Then I save the specific abstraction variables in a file (or in the main patch) by sending a message like [1 float1 float2 float3( to the main patch where the first item in the list is the abstraction number. You can then parse this data when you load the abstractions, eg:
[route $1] | [unpack f f f]
Is this what you want?
James