Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

enhancement: ProxyChainPreset exceptedKeys #18

Open
elgiano opened this issue Jun 24, 2020 · 2 comments
Open

enhancement: ProxyChainPreset exceptedKeys #18

elgiano opened this issue Jun 24, 2020 · 2 comments

Comments

@elgiano
Copy link

elgiano commented Jun 24, 2020

It would be nice if ProxyChainPreset could exclude some keys, in addition to exceptedSlots.
In my use case it would be crucial: I have a resonator that takes a multichannel control for frequencies, which I only set from an OSCdef, and I don't need to store in presets. Other than this, it looks like whenever ProxyPreset touches a multichannel control, it becomes one-channel in the gui.

My implementation is very simple: just an array of exceptedKeys. It could be made into a dictionary to set exceptedKeys by slot, but I think it doesn't really make sense, since slots should have unique argument names anyway:

--- a/classes/Presets/ProxyChainPreset.sc
+++ b/classes/Presets/ProxyChainPreset.sc
@@ -2,6 +2,7 @@ ProxyChainPreset {
        classvar <all;
        var <key, <chain, <proxy, <settings;
        var <>exceptedSlots;
+    var <>exceptedKeys;
 
        *initClass {
                all = ();
@@ -40,6 +41,8 @@ ProxyChainPreset {
        getCurr {
                var activeSlotsToStore = this.slotsToStore.sect(chain.activeSlotNames.copy);
                ^activeSlotsToStore.collect { |slotName|
+            var slotSettings = chain.keysValuesAt(slotName);
+            exceptedKeys !? { slotSettings = slotSettings.reject{|v,k| exceptedKeys.includes(k)}};
                        slotName -> chain.keysValuesAt(slotName)
                }
        }
@adcxyz
Copy link
Contributor

adcxyz commented Jun 25, 2020

@elgiano :
ProxyChainPreset is still quite experimental, as the logic of what to store and what not
is rather complicated - so thanks for testing it!

Generally, yes makes sense to except single keys as well, like ProxyPreset does
with namesToStore.
Maybe this should generally be attached to the proxychain funcs,
so you could recombine them freely?
Or better to the ProxyChainPreset?
(you might want to store them in some cases and not in others...)

For your immediate use, setting controls with n values continuously from OSC,
you could just write that to n-channel control bus or Ndef
and read that in the ProxyChain func, no?

a multi-control in a ProxyChain becomes one-channel in the gui

This works here as expected, maybe you were not on the latest version?

// params with two values become rangeslider: dust -> dustfreqs
//  params with three values become a textview: ringmod -> freqRange
ProxyChain.add3(
    \dust,
	\mix -> { |dens=20, dustdec=0.02, dustfreqs= #[600, 1000, 1600] |
		Splay.ar(Ringz.ar(Dust2.ar(dens ! 2).lag(0.0001), dustfreqs, dustdec));
    },
    0.2,
    [
        \dens, [0.1, 1000, \exp],
        \dustdec, [0.0001, 0.1, \exp],
        \dustfreqs, \freq
    ]
);

ProxyChain.add3(
    \ringmod,
	\filter -> { |in, randrate=5, freqRange = #[300, 3000]|
        in * SinOsc.ar(LFNoise0.kr(randrate ! in.size).exprange(*freqRange))
    },
    0.5, // wet/dry mix of 50/50
    [ \randrate, [0.5, 50, \exp],
		\freqRange, \freq,
	]
);

// now make a proxy chain and gui for it
c = ProxyChain(\c, [\dust, \ringmod], 2);
c.play;    // play the proxy
g = c.gui(12).moveTo(0, 800);
c.add(\dust, 0.3);
c.add(\ringmod, 0.5);
);

@elgiano
Copy link
Author

elgiano commented Jun 25, 2020

  1. Isn't it like ProxyChain functions should have unique arg names anyway? Then it wouldn't be so important to attach exceptedKeys to functions. But if I get your point: if a func defines (maybe through an extra arg to add3) a list of excepted keys, then you could create multiple chains that use that same func and always except those keys automatically.

  2. Attaching to the preset: do you mean to some specific sets and not others, within the same ProxyChainPreset? (A bit like how MFunc does with func exclusion in different modes?). Something like pcp.addSet(\ada, exceptedSlots: [ ... ], exceptedKeys: [....])?

  3. All good with the textview gui. The problem is when you load a preset:

ProxyChain.add3(
    \dust,
	\mix -> { |dens=20, dustdec=0.02|
		Splay.ar(Ringz.ar(Dust2.ar(dens ! 2).lag(0.0001), \dustfreqs.kr(0!3), dustdec));
    },
    0.2,
    [
        \dens, [0.1, 1000, \exp],
        \dustdec, [0.0001, 0.1, \exp],
        \dustfreqs, \freq
    ]
);

c = ProxyChain(\c, [\dust]) 
c.play
g = c.gui(12).moveTo(0, 800);
c.add(\dust, 0.3);

p = ProxyChainPreset(\c)
p.addSet(\ada)
p.setCurr(\ada) // textView became one-dimensional slider

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants