Home › Forums › General › Using Ctrlr › make modulators appear when needed?
Tagged: linked modulators; change view;
- This topic has 18 replies, 2 voices, and was last updated 7 years, 1 month ago by human fly.
-
AuthorPosts
-
March 7, 2017 at 12:13 am #71572
can modulators be made to appear only when needed?
or change, depending on another parameter?or for example, if it is a wave bank, have one combo
waveform name list if bank1 is selected, and have
another if bank2 is selected?March 9, 2017 at 5:32 am #71584[code]
— Change Visibility
panel:getModulatorByName(“SlidA”):getComponent():setVisible(true)
panel:getModulatorByName(“FortSlidA”):getComponent():setVisible(false)
panel:getModulatorByName(“FortSlidA”):setPropertyInt(“vstIndex”,848)
panel:getModulatorByName(“SlidA”):setPropertyInt(“vstIndex”,48)
[/code]The VST Index changes I used in my panel to make sure that things mapped properly to default controllers, so that moving controllers modified a slider on screen, rather than a hidden one.
The Puppeteer
http://godlike.com.auMarch 10, 2017 at 3:09 pm #71591here, i’ve got a mini-panel here to illustrate (not a working
panel, it’s basically a drawing)this just shows the hierarchy of choices:
‘structure’ selection determines whether S or P for each partial,
and from that whether ‘Wave’ or ‘PCM’ is displayed. and there, you
get either square/saw or pcm1/pcm2(with respective lists)i kinda tried to compile what you showed me, but obviously didn’t
get it to work… 🙂i anticipate a series of 13 conditions for selecting S/P configuration,
first of all..and then the rest. i have a semi-inelegant workaround
at the moment that should work, but it doesn’t look as good as it could.March 13, 2017 at 9:51 am #71619You’ll need to do them in order.
So for the Structure control, you’ll need a method in the luaModulatorValueChange parameter.
Pretty much
if panel:getModulatorByName(“Structure”):getValue() == 0 then
panel:getModulatorByName(“Partial_Wave”):getComponent():setVisible(true)
panel:getModulatorByName(“Partial_PCM”):getComponent():setVisible(false)elseif panel:getModulatorByName(“Structure”):getValue() == 1 then
panel:getModulatorByName(“Partial_Wave”):getComponent():setVisible(false)
panel:getModulatorByName(“Partial_PCM”):getComponent():setVisible(true)etc.
Then for the two controls Partial_Wave and Partial_PCM do the same thing to determine Square/Saw or PCM1/PCM2.
The Puppeteer
http://godlike.com.auMarch 13, 2017 at 10:57 am #71622yes, ok – i’ll get back onto that. i’ve done a little sidestep
to get on with something else, which is what i usually do when
i get stuck.funny, i can build things like this really quickly with synthedit
and logic combinations. maybe if i can think of some hypothetical
AND/OR/XOR/NOT etc situations we can do a thread on that sometime.i’ll see if i can get the first bit working this evening.
March 13, 2017 at 4:53 pm #71623i’m looking at it like this (where are the code thingies now?)
>for the first 2 choices, both partial ‘Wave'(‘S’)combos must appear:
(but how do i say ‘and’ for the second result, for partial2? or is it
ok like that?)— 00
if
panel:getModulatorByName(“Structure12”):getValue() == 0 thenpanel:getModulatorByName(“Partial1_Wave”):getComponent():setVisible(true)
panel:getModulatorByName(“Partial1_PCM”):getComponent():setVisible(false)panel:getModulatorByName(“Partial2_Wave”):getComponent():setVisible(true)
panel:getModulatorByName(“Partial2_PCM”):getComponent():setVisible(false)
— 01
elseif
panel:getModulatorByName(“Structure12”):getValue() == 1 thenpanel:getModulatorByName(“Partial1_Wave”):getComponent():setVisible(true)
panel:getModulatorByName(“Partial1_PCM”):getComponent():setVisible(false)panel:getModulatorByName(“Partial2_Wave”):getComponent():setVisible(true)
panel:getModulatorByName(“Partial2_PCM”):getComponent():setVisible(false)etc.
:
:
endanother question: do i have to be careful how i use returns and gaps
in text? i don’t know how much leeway i have, nor which characters
i must exclude – as syntax elements: is ‘&’ permissible? if i want
to call ‘Structure1+2’ 1&2, for example? is ‘and’ reserved for logic
and-ing? (and many more questions besides…)March 14, 2017 at 7:06 am #71625ok, so i think i’ve got the ‘body’ of the method looking ok:
my 13 ‘Structure’ options selecting which combo shows for each side.
but i still don’t know how to ‘wrap’ it with Header and End, and when
i try ‘save and compile’, it is sending back this error:*can’t seem to attach files, so i’ve uploaded to boxnet*:
text:
https://app.box.com/s/xe1mojziexmiz3gzuu2i8l05avxfxs7r
demo panel:
https://app.box.com/s/zsawga5etw6kghkkdfrp9j2pm7fpcg25(each entry has a ren’d description: midi value, display value, and the S/P
choices for each side’s combo view)
——————————————————————————-
Compile: Structure12_showCombo – FAILED
ERROR: [string “Structure12_showCombo”]:9: unexpected symbol near ‘â’(i just pasted my Lua in between the brackets () after ‘function’ (in blue)
-line ‘6’ is where there is: ‘Structure12_showCombo = function(if’ )—
— Called when a modulator value changes
— @mod http://ctrlr.org/api/class_ctrlr_modulator.html
— @value new numeric value of the modulator— Structure12_showCombo
— 00_01_SS
if
panel:getModulatorByName(“Structure12”):getValue() == 0 thenpanel:getModulatorByName(“Partial1_Wave”):getComponent():setVisible(true)
panel:getModulatorByName(“Partial1_PCM”):getComponent():setVisible(false)panel:getModulatorByName(“Partial2_Wave”):getComponent():setVisible(true)
panel:getModulatorByName(“Partial2_PCM”):getComponent():setVisible(false)
— 01_02_SS
elseif
panel:getModulatorByName(“Structure12”):getValue() == 1 thenpanel:getModulatorByName(“Partial1_Wave”):getComponent():setVisible(true)
panel:getModulatorByName(“Partial1_PCM”):getComponent():setVisible(false)panel:getModulatorByName(“Partial2_Wave”):getComponent():setVisible(true)
panel:getModulatorByName(“Partial2_PCM”):getComponent():setVisible(false)
— 02_03_PS
elseif
panel:getModulatorByName(“Structure12”):getValue() == 2 thenpanel:getModulatorByName(“Partial1_Wave”):getComponent():setVisible(false)
panel:getModulatorByName(“Partial1_PCM”):getComponent():setVisible(true)panel:getModulatorByName(“Partial2_Wave”):getComponent():setVisible(true)
panel:getModulatorByName(“Partial2_PCM”):getComponent():setVisible(false)
— 03_04_PS
elseif
panel:getModulatorByName(“Structure12”):getValue() == 3 thenpanel:getModulatorByName(“Partial1_Wave”):getComponent():setVisible(false)
panel:getModulatorByName(“Partial1_PCM”):getComponent():setVisible(true)panel:getModulatorByName(“Partial2_Wave”):getComponent():setVisible(true)
panel:getModulatorByName(“Partial2_PCM”):getComponent():setVisible(false)
— 04_05_SP
elseif
panel:getModulatorByName(“Structure12”):getValue() == 4 thenpanel:getModulatorByName(“Partial1_Wave”):getComponent():setVisible(true)
panel:getModulatorByName(“Partial1_PCM”):getComponent():setVisible(false)panel:getModulatorByName(“Partial2_Wave”):getComponent():setVisible(false)
panel:getModulatorByName(“Partial2_PCM”):getComponent():setVisible(true)
— 05_06_PP
elseif
panel:getModulatorByName(“Structure12”):getValue() == 5 thenpanel:getModulatorByName(“Partial1_Wave”):getComponent():setVisible(false)
panel:getModulatorByName(“Partial1_PCM”):getComponent():setVisible(true)panel:getModulatorByName(“Partial2_Wave”):getComponent():setVisible(false)
panel:getModulatorByName(“Partial2_PCM”):getComponent():setVisible(true)
— 06_07_PP
elseif
panel:getModulatorByName(“Structure12”):getValue() == 6 thenpanel:getModulatorByName(“Partial1_Wave”):getComponent():setVisible(false)
panel:getModulatorByName(“Partial1_PCM”):getComponent():setVisible(true)panel:getModulatorByName(“Partial2_Wave”):getComponent():setVisible(false)
panel:getModulatorByName(“Partial2_PCM”):getComponent():setVisible(true)
— 07_08_SS
elseif
panel:getModulatorByName(“Structure12”):getValue() == 7 thenpanel:getModulatorByName(“Partial1_Wave”):getComponent():setVisible(true)
panel:getModulatorByName(“Partial1_PCM”):getComponent():setVisible(false)panel:getModulatorByName(“Partial2_Wave”):getComponent():setVisible(true)
panel:getModulatorByName(“Partial2_PCM”):getComponent():setVisible(false)
— 08_09_PP
elseif
panel:getModulatorByName(“Structure12”):getValue() == 7 thenpanel:getModulatorByName(“Partial1_Wave”):getComponent():setVisible(true)
panel:getModulatorByName(“Partial1_PCM”):getComponent():setVisible(false)panel:getModulatorByName(“Partial2_Wave”):getComponent():setVisible(true)
panel:getModulatorByName(“Partial2_PCM”):getComponent():setVisible(false)
— 09_10_SS
elseif
panel:getModulatorByName(“Structure12”):getValue() == 7 thenpanel:getModulatorByName(“Partial1_Wave”):getComponent():setVisible(true)
panel:getModulatorByName(“Partial1_PCM”):getComponent():setVisible(false)panel:getModulatorByName(“Partial2_Wave”):getComponent():setVisible(true)
panel:getModulatorByName(“Partial2_PCM”):getComponent():setVisible(false)
— 10_11_PS
elseif
panel:getModulatorByName(“Structure12”):getValue() == 7 thenpanel:getModulatorByName(“Partial1_Wave”):getComponent():setVisible(true)
panel:getModulatorByName(“Partial1_PCM”):getComponent():setVisible(false)panel:getModulatorByName(“Partial2_Wave”):getComponent():setVisible(true)
panel:getModulatorByName(“Partial2_PCM”):getComponent():setVisible(false)
— 11_12_SP
elseif
panel:getModulatorByName(“Structure12”):getValue() == 7 thenpanel:getModulatorByName(“Partial1_Wave”):getComponent():setVisible(true)
panel:getModulatorByName(“Partial1_PCM”):getComponent():setVisible(false)panel:getModulatorByName(“Partial2_Wave”):getComponent():setVisible(true)
panel:getModulatorByName(“Partial2_PCM”):getComponent():setVisible(false)
— 12_13_PP
elseif
panel:getModulatorByName(“Structure12”):getValue() == 7 thenpanel:getModulatorByName(“Partial1_Wave”):getComponent():setVisible(true)
panel:getModulatorByName(“Partial1_PCM”):getComponent():setVisible(false)panel:getModulatorByName(“Partial2_Wave”):getComponent():setVisible(true)
panel:getModulatorByName(“Partial2_PCM”):getComponent():setVisible(false)
endMarch 15, 2017 at 2:26 am #71630Line 6 should look more like this.
Structure12_showCombo = function (–[[CtrlrModulator –]] mod, –[[number –]] value)
The Puppeteer
http://godlike.com.auMarch 15, 2017 at 6:48 am #71631ok. literally, you mean?
i’ll try that. thanks.it would be *really* good if there was a repertory/reference of most
commonly used Lua stuff for Ctrlr here – looking at the JUCE site is
mindboggling, i gave up. it merits its own section. i suppose the
best way is to look at existing examples, but i don’t usually know
what’s going on, or what is possible. learning bit by bit though.as you see, i don’t even know yet how to sort out the basic headers
and enders.March 15, 2017 at 7:07 am #71632mm didn’t work yet – getting same message. here is exactly
what i have in the compiler view:https://app.box.com/s/fmwypr9xjrhnzyrxqk404g82rk7p2mjp
(called v02, realised last one was v03..never mind)
error message is:
Compile: Structure12_showCombo – FAILED
ERROR: [string “Structure12_showCombo”]:6:or ‘…’ expected near ‘â’ i replaced previous ‘function’ line with yours.
do i need to declare modulators or anything like that?
i don’t know what ‘â’ means.
March 15, 2017 at 8:27 am #71635(i’m also looking now at the layers and tabs demo, – where i can’t
seem to get the slider version to switch tabs. i’m definitely going
to study atom’s examples now. shame that the D50 panel seems to be
inaccessible via normal panel unlock..i still don’t understand how
they’ve hidden the tabs..)March 16, 2017 at 6:53 am #71642YESSSSSS !!! >8-)
little victory dance…i was sitting here muttering “#!%!..Ctrlr..”
and then i had a look at some of the demo panels, which address some
similar issues: DEMO layers and Tabs, and DEMO switching tabs with Lua,
and:
i realised that all my <"> that i had pasted in from my notepad file were
in RED, with the in-betweenstill in BLACK, – in the example Lua’s
it is all in PURPLE…and noticed that if i re-typed these <"> in the Lua
Editor, the entry turned PURPLE.
ALSO, main thing, after ‘function’ it should just have (mod, value), and
not all the other stuff. it seems errors are shown in RED ??
so:
i’ve just gone through, changed them all, and got one last error telling
me it was missing an END after the END for the ‘conditions’, so i put
and extra END at the end, save+compiled, AND GOT THE OK. woo.hoo.
and even better, it bl**dy works. and that’s very satisfying, i must say.
ha ha ha.
one more Lua NAILED. thanks for your help !BTW: i cannot get DEMO Layers and Tabs to work, with the Horiz Slider.
the combo changes the Tabs, but not the Slider.HERE is the demo panel(zip). it isn’t selecting the right combos
yet, not sure why, but it is working, showing just one of each for
each value change – need to check it through:
(my values are still shown in RED, so maybe i need to enter those again?)https://app.box.com/s/mvw9bjebq6n4n5erx3ubl7648ljx1ah2
- This reply was modified 7 years, 1 month ago by human fly.
March 16, 2017 at 7:29 am #71644okaaaay…so i had a wrongly numbered condition, a couple of errors
in the true/false options, and most stupidly, had the wrong ‘value min/max’,
duh, set to 0 to 13, instead of 0 to 12.. and now that’s fixed, and it’s
working ticketyboo:
changeview v04.panel(zip)
https://app.box.com/s/b2adaofc9jkg1aci3d4845rftusd2jkounreasonably proud LOL of this micro achievement.
game changer for me. i do now, of course have to figure out how
it will actually work in terms of sending MIDI, and figure out
the next step, with the PCM list selections, which should be simpler.check it out, anyway, it’s quite nice, i reckon.
i still don’t understand how UITabs are made invisible in
some panelz. that’s another subject.March 16, 2017 at 8:42 am #71645rrrright, have a look at this one. not quite there yet,
i’m switching the PCM 1/2 lists with the Wave/Bank select,
but it needs to change, so that PCM options only appear
when ‘P’/Bank is the choice. i think a square/saw graphic
should appear when the choice is ‘S’/Wave.
getting there…https://app.box.com/s/d3fyllt7dgmffpiis29rv1bnl2mnlnsz
changeview v07.zipMarch 16, 2017 at 10:12 am #71648sorry *DOH* … realised you can’t see that, you are missing
the graphic for Structure. here it is:https://app.box.com/s/l1m3g35g94lkq2k5d3b29w6ahhae82z3
2.6kb Structure.png
just put it in the same folder, add it to Resources.
sorry about that… :o)March 16, 2017 at 11:13 pm #71653another version; put both PCM lists in a Group that
is shown/hidden according to Structure selection;but choices on ‘Wave’ and on ‘PCM’ must be synchronised
-Wave/Bank are the same parameter, so if ‘square’ is selected
PCM1 should be selected when the Structure choice switches
between themchangeview v11.zip
https://app.box.com/s/439swie9g9wghh16o6drwca8vm5rr9otMarch 17, 2017 at 2:57 am #71654Glad you got it working
The –[[ stuff –]] are in line comments. They can be omitted, but are useful for documenting your code.
Using
— stuff
Will comment the entire lineThe Puppeteer
http://godlike.com.auMarch 17, 2017 at 7:46 am #71657(yes, thanks. i sussed out the commenting thing, had not noticed it
‘in-line’ – also had not anticipated that pasting in from a notepad
file disables “name” – the apostrophes become red until you re-enter
them.)HERE: Final working version:
https://app.box.com/s/4cwkdy1xpkho3yra8vvfg55yb2uqekjk
changeview v12.zipfresh morning inspiration, i had another look at the Layers and Tabs DEMO,
and ‘Linked Modulators’ – this provided the solution to synchronising
‘Wave’/’Bank’ choice/value. i’ve also added a combo dropdown linked both
ways to the Structure graphic selector (which shows the Partial combinations).
this is the version worth looking round. (have now also figured out how that
DEMO prefab works for showing Layers. !most interesting! – this has been a
very useful little learning curve)(so there ARE lots of useful methods already included in the program ! )
Job Done.
edit: here, as a exe (64bit) – i think i’ll make the graphic passive now,
it’s a bit fiddly as a slider; just use the list selector.https://app.box.com/s/jirwcqfk9r2i6c9gw0n2rh4l9f04y8t8
oh yeah: some tips on making Radio buttons? ie: one button per option?
(lazy question, just to save some time figuring out how it’s done)March 19, 2017 at 9:21 am #71681if you are following this, … here’s a new demo, with
panels showing/hiding/swapping for option selections.
edited previous version. included *.panel in there this
time, with a 64bit exe version:https://app.box.com/s/qgk0hxh0y5nyk3y04ak4a6e1rdst3be2
edited the lua method for structure12/34
maybe i need to nul on startup? as panel shows both views.
seems ok in standalone.(nb: this is still a rough, just
checking appearance/action. sysex messages not corrected;
looking at alternative way to set out parameters) -
AuthorPosts
- The forum ‘Using Ctrlr’ is closed to new topics and replies.