i guess what I’m asking is what would be the most efficient way to do this.
Also i don't think that's a spot where you should worry too much about optimization, unless you initialize each object with thousands of creation arguments :-)
-----Ursprüngliche Nachricht----- Gesendet: Samstag, 23 Juli 2016 um 13:13:42 Uhr Von: christof.ressi@gmx.at An: "Ricky Graham" rickygrahammusic@gmail.com,Pd-List pd-list@lists.iem.at Betreff: Re: [PD] Pass External Argument as Output on Creation I guess objects always have to be first created to be connected, so sending something to an outlet in the new-method might actually never work...
-----Ursprüngliche Nachricht----- Gesendet: Samstag, 23 Juli 2016 um 12:26:48 Uhr Von: "Ricky Graham" rickygrahammusic@gmail.com An: christof.ressi@gmx.at Betreff: Re: [PD] Pass External Argument as Output on Creation Hi Christof,
Can you tell what do you want to achieve exactly? How do you know that the object you want to pass the data to already exists? Couldn't you use something like an 'init' method together with loadbang or initbang to pass the argument to other objects in a deterministic way? This would seem much safer to me…
Yes, your suggestion is safer but I’m I’m curious to know if it works. The scenario is unique and specific to my own patch where the object will definitely have a number atom connected to its outlet.
If you really want to do it on creation time, just pass the argument(s) to your outlet(s) right in the new-method. Again, not sure if that's a good idea at all!
Yes, I guess what I’m asking is what would be the most efficient way to do this. I can’t seem to get the arg to output to the float on creation. It may not even be possible...
Ricky
-----Ursprüngliche Nachricht----- Gesendet: Freitag, 22 Juli 2016 um 12:51:15 Uhr Von: "Ricky Graham" rickygrahammusic@gmail.com An: pd-list@lists.iem.at Betreff: [PD] Pass External Argument as Output on Creation Hi all,
Quick question for C folks: what’s the best way to pass an arg (e.g. [object 2]) to an outlet immediately on creation? Curious to know if I’m going about this in the most efficient way possible.
Cheers!
Ricky _______________________________________________ Pd-list@lists.iem.at mailing list UNSUBSCRIBE and account-management -> https://lists.puredata.info/listinfo/pd-list
Pd-list@lists.iem.at mailing list UNSUBSCRIBE and account-management -> https://lists.puredata.info/listinfo/pd-list
Not 100% sure this would work, but you could maybe give your class a "loadbang" method. Depending on how it's used with other objects, you might put the actual send in a clock with a delay of 0 so that it runs after your other loadbang initialization, for extra insurance.
So, if your class is graham_class...
In your graham_setup:
class_addmethod(graham_class, (t_method)graham_loadbang, gensym("loadbang"), 0);
In your graham_new:
x->x_clock = clock_new(x,(t_method)graham_wait);
In your graham_free:
clock_free(x->x_clock);
In your graham_loadbang:
clock_delay(x->x_clock, 0);
In your graham_wait, you call whatever function you normally use to output that float.
On Sat, Jul 23, 2016 at 7:20 AM, christof.ressi@gmx.at wrote:
i guess what I’m asking is what would be the most efficient way to do this.
Also i don't think that's a spot where you should worry too much about optimization, unless you initialize each object with thousands of creation arguments :-)
-----Ursprüngliche Nachricht----- Gesendet: Samstag, 23 Juli 2016 um 13:13:42 Uhr Von: christof.ressi@gmx.at An: "Ricky Graham" rickygrahammusic@gmail.com,Pd-List < pd-list@lists.iem.at> Betreff: Re: [PD] Pass External Argument as Output on Creation I guess objects always have to be first created to be connected, so sending something to an outlet in the new-method might actually never work...
-----Ursprüngliche Nachricht----- Gesendet: Samstag, 23 Juli 2016 um 12:26:48 Uhr Von: "Ricky Graham" rickygrahammusic@gmail.com An: christof.ressi@gmx.at Betreff: Re: [PD] Pass External Argument as Output on Creation Hi Christof,
Can you tell what do you want to achieve exactly? How do you know that
the object you want to pass the data to already exists? Couldn't you use something like an 'init' method together with loadbang or initbang to pass the argument to other objects in a deterministic way? This would seem much safer to me…
Yes, your suggestion is safer but I’m I’m curious to know if it works. The scenario is unique and specific to my own patch where the object will definitely have a number atom connected to its outlet.
If you really want to do it on creation time, just pass the argument(s)
to your outlet(s) right in the new-method. Again, not sure if that's a good idea at all!
Yes, I guess what I’m asking is what would be the most efficient way to do this. I can’t seem to get the arg to output to the float on creation. It may not even be possible...
Ricky
-----Ursprüngliche Nachricht----- Gesendet: Freitag, 22 Juli 2016 um 12:51:15 Uhr Von: "Ricky Graham" rickygrahammusic@gmail.com An: pd-list@lists.iem.at Betreff: [PD] Pass External Argument as Output on Creation Hi all,
Quick question for C folks: what’s the best way to pass an arg (e.g.
[object 2]) to an outlet immediately on creation? Curious to know if I’m going about this in the most efficient way possible.
Cheers!
Ricky _______________________________________________ Pd-list@lists.iem.at mailing list UNSUBSCRIBE and account-management ->
https://lists.puredata.info/listinfo/pd-list
Pd-list@lists.iem.at mailing list UNSUBSCRIBE and account-management -> https://lists.puredata.info/listinfo/pd-list
Pd-list@lists.iem.at mailing list UNSUBSCRIBE and account-management -> https://lists.puredata.info/listinfo/pd-list
I’ll give that a whirl… thanks, Matt.
On Jul 23, 2016, at 3:04 PM, Matt Barber brbrofsvl@gmail.com wrote:
Not 100% sure this would work, but you could maybe give your class a "loadbang" method. Depending on how it's used with other objects, you might put the actual send in a clock with a delay of 0 so that it runs after your other loadbang initialization, for extra insurance.
So, if your class is graham_class...
In your graham_setup:
class_addmethod(graham_class, (t_method)graham_loadbang, gensym("loadbang"), 0);
In your graham_new:
x->x_clock = clock_new(x,(t_method)graham_wait);
In your graham_free:
clock_free(x->x_clock);
In your graham_loadbang:
clock_delay(x->x_clock, 0);
Matt, this totally works. Thanks for your help! For anyone interested, here’s sample source code (where x->factor stores a return value from a function that does something useful with an init arg):
void factorial_wait(t_factorial *x) { float test = x->factor; outlet_float(x->factorial, test); }
void factorial_free(t_factorial *x) { clock_free(x->x_clock); }
void factorial_loadbang(t_factorial *x) { clock_delay(x->x_clock, 0); }
On Jul 23, 2016, at 3:04 PM, Matt Barber brbrofsvl@gmail.com wrote:
Not 100% sure this would work, but you could maybe give your class a "loadbang" method. Depending on how it's used with other objects, you might put the actual send in a clock with a delay of 0 so that it runs after your other loadbang initialization, for extra insurance.
So, if your class is graham_class...
In your graham_setup:
class_addmethod(graham_class, (t_method)graham_loadbang, gensym("loadbang"), 0);
In your graham_new:
x->x_clock = clock_new(x,(t_method)graham_wait);
In your graham_free:
clock_free(x->x_clock);
In your graham_loadbang:
clock_delay(x->x_clock, 0);
In your graham_wait, you call whatever function you normally use to output that float.
On Sat, Jul 23, 2016 at 7:20 AM, <christof.ressi@gmx.at mailto:christof.ressi@gmx.at> wrote:
i guess what I’m asking is what would be the most efficient way to do this.
Also i don't think that's a spot where you should worry too much about optimization, unless you initialize each object with thousands of creation arguments :-)
-----Ursprüngliche Nachricht----- Gesendet: Samstag, 23 Juli 2016 um 13:13:42 Uhr Von: christof.ressi@gmx.at mailto:christof.ressi@gmx.at An: "Ricky Graham" <rickygrahammusic@gmail.com mailto:rickygrahammusic@gmail.com>,Pd-List <pd-list@lists.iem.at mailto:pd-list@lists.iem.at> Betreff: Re: [PD] Pass External Argument as Output on Creation I guess objects always have to be first created to be connected, so sending something to an outlet in the new-method might actually never work...
-----Ursprüngliche Nachricht----- Gesendet: Samstag, 23 Juli 2016 um 12:26:48 Uhr Von: "Ricky Graham" <rickygrahammusic@gmail.com mailto:rickygrahammusic@gmail.com> An: christof.ressi@gmx.at mailto:christof.ressi@gmx.at Betreff: Re: [PD] Pass External Argument as Output on Creation Hi Christof,
Can you tell what do you want to achieve exactly? How do you know that the object you want to pass the data to already exists? Couldn't you use something like an 'init' method together with loadbang or initbang to pass the argument to other objects in a deterministic way? This would seem much safer to me…
Yes, your suggestion is safer but I’m I’m curious to know if it works. The scenario is unique and specific to my own patch where the object will definitely have a number atom connected to its outlet.
If you really want to do it on creation time, just pass the argument(s) to your outlet(s) right in the new-method. Again, not sure if that's a good idea at all!
Yes, I guess what I’m asking is what would be the most efficient way to do this. I can’t seem to get the arg to output to the float on creation. It may not even be possible...
Ricky
-----Ursprüngliche Nachricht----- Gesendet: Freitag, 22 Juli 2016 um 12:51:15 Uhr Von: "Ricky Graham" <rickygrahammusic@gmail.com mailto:rickygrahammusic@gmail.com> An: pd-list@lists.iem.at mailto:pd-list@lists.iem.at Betreff: [PD] Pass External Argument as Output on Creation Hi all,
Quick question for C folks: what’s the best way to pass an arg (e.g. [object 2]) to an outlet immediately on creation? Curious to know if I’m going about this in the most efficient way possible.
Cheers!
Ricky _______________________________________________ Pd-list@lists.iem.at mailto:Pd-list@lists.iem.at mailing list UNSUBSCRIBE and account-management -> https://lists.puredata.info/listinfo/pd-list https://lists.puredata.info/listinfo/pd-list
Pd-list@lists.iem.at mailto:Pd-list@lists.iem.at mailing list UNSUBSCRIBE and account-management -> https://lists.puredata.info/listinfo/pd-list https://lists.puredata.info/listinfo/pd-list
Pd-list@lists.iem.at mailto:Pd-list@lists.iem.at mailing list UNSUBSCRIBE and account-management -> https://lists.puredata.info/listinfo/pd-list https://lists.puredata.info/listinfo/pd-list