[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [sc-users] SynthDescLib and Pbind



There's nothing intrinsic in a Synth running on the server that would let you differentiate based on who created it. But I can think of two ways you might filter things - 

1. Use a separate group for each Pbind - then you can snapshot just that group. This wouldn't work if you needed individual synths from one Pbind to end up in different groups, but that's not a very common requirement (this is what I was doing in my example code).

2. Add a dummy parameter to your synth, set it from your Pbind, and filter based on that. That can't be done by TreeSnapshot alone, but you could just walk through the snapshot once you receive it, and search for synths with that parameter. E.g. (didn't test this code....):

SynthDef(\foo, { |createdBy| ... }).add;
Pbind(
    \instrument, \foo
    \createdBy, 1
);
TreeSnapshot.get({
     |sn|
     var node, nodes = List.newFrom(sn.children);
     while { nodes.empty.not } {
           node = nodes.removeAt(nodes.size - 1);
           if (node.isKindOf(GroupSnapshot) {
                 nodes.addAll(node.children);
           } {
                 if (node.controls[\createdBy] == 1) {
                        node.postln;
                 }
           }
     }
})

And incidentally - if you're finding it useful to filter the TreeSnapshot by other things than just the synthdef name, let me know - it's a very small change to support filtering via an arbitrary function, so I might add that functionality.

- S

On Mon, Dec 17, 2018 at 10:59 AM <sam@xxxxxxxxxxx> wrote:
hi scott,

> I believe the NodeSnapshot quark can do what youre looking for.
>
> (
> g = Group();
>
> Pbind(
> \instrument, \default,
> \group, g
> ).play;
>
> fork {
> inf.do {
> TreeSnapshot.get({
> |tree|
> tree.postln;
> }, g);
> 2.wait;
> }
> };
> )

super. this is what I was looking for, indeed!

> This is intended for debugging and occasional use - its a pretty heavy-weight
> way of getting the parameters of a running synth, so if youre planning on
> calling it to get realtime status of your synth argument values, I would
> definitely try something else.

so far it seems perfect for my needs. I don't really need to keep track of the values in realtime, just query them from time to time.

although this gets me pretty close to where I want to go, it would also be handy for me to filter the results not by SynthDef or Node id but by the Pbind that's generating them. basically I'd like to be able to have more than one Pbind creating Synths from the same SynthDef but only track the parameters of the Pbind that the user has selected.

can you think of an alternative way to do this besides what daniel mentioned?

thanks a lot

::: sam :::

_______________________________________________
sc-users mailing list

info (subscription, etc.): http://www.birmingham.ac.uk/facilities/ea-studios/research/supercollider/mailinglist.aspx
archive: https://listarc.bham.ac.uk/marchives/sc-users/
search: https://listarc.bham.ac.uk/lists/sc-users/search/