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

Re: [sc-users] SynthDescLib and Pbind




Ah, I see. But hm, was it really me who shared this Function ?

However, I can sketch how to do it: with Pbind, as you noticed, you don't have Synth objects language-side. But you can adapt the Function by replacing the get/getn methods by terms that do that messging on the nodeIDs (not all too difficult, you can look up the source code of get/getn).

Then you would need a tracker that indicates the current nodeIDs, e.g. by updating in a List. This can be built into the Pbind, I did something some years ago, but can't find it in the list archive right now ...

Then the getter can be applied at any time on all List items. As always there can't be a 100% guarantee that the state indicated in the language represents the server state, but practically it should suffice.

Hope that helps

All the best

Daniel

-----------------------------
http://daniel-mayer.at
-----------------------------


Am 16.12.2018 um 01:17 schrieb sam@xxxxxxxxxxx:

hi daniel,

I'm not really interested in the default values. what I want is to asynchronously take snapshots of the events values as they unfold. so far I'm using this function that I believe you shared with the list a while ago:

var get_control_values = { |synth|
   var event = ();
   var desc = SynthDescLib.global[synth.defName.asSymbol];

       desc.notNil.if {
       desc.controls.do {
           |ctl|
           if( ctl.name != '?', {
           if( ctl.numChannels > 1, {
              synth.getn(ctl.name, ctl.numChannels,  {
               |v|

               event.put(ctl.name, v)
           })
           },
           {
             synth.get(ctl.name,  {
               |v|
               event.put(ctl.name, v)
               } );
           });
           } );
};
   };
   event;
};

a = Synth(\default);
b = get_control_values.(a)
b.postln;

now with Pbind I know the SynthDef's name but I don't know how to obtain a
handle to the Synth.

thanks a lot for helping out.

::: sam :::

On Sun, 16 Dec 2018 00:28:51 +0100 sc-users@xxxxxxxxxxxxxxxx said

Hi,

if you're not setting with Pbind there will be the default args and you can
get them like this:

SynthDescLib.global[\default].controlDict.collect(_.defaultValue)

// equivalent

SynthDescLib.global[\default].controlDict.collect { |x| x.defaultValue }

// or

SynthDescLib.global[\default].controls.collect { |x| x.name -> x.defaultValue
}

So there's no need to track the synths (except you're somehow controlling
them otherwise)

Regards

Daniel

-----------------------------
http://daniel-mayer.at [5]
-----------------------------

_______________________________________________
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/