Home › Forums › General › Programming › IncDec Selected Modulator ?
Tagged: sequencer; stepcounter; timer;
- This topic has 44 replies, 5 voices, and was last updated 6 years, 5 months ago by human fly.
-
AuthorPosts
-
November 9, 2017 at 7:43 am #73455
uiButton should also respond to that method I wrote, but not uiLabel.
To create those graphics, I just did a screen grab then cropped and doubled the image.
btw where are those references to ‘comp’, ‘mod’ ?
couldn’t find itI couldn’t find them either, but for example – if you create a mouse down function in Ctrlr, it creates a function with two parameters (comp,event). It seems you can go to Panel -> Modulator List -> View -> Visible columns and there is a long list of constructors(?) or properties which can be called through getProperty().
As an example, you would look for the uiLabel… constructors and I think some (all/most?) of them will be loaded into parameter ‘comp’, which are passed to the callback function and are called with
x=comp:getProperty("uiLabelText") y=comp:getProperty("uiLabelChangedCbk") z=comp:getProperty("uiLabelInputAllowedChars")
…etc – or in the case of a regular call back function ‘mod’ for uiButton, uiSlider and other types;
x=mod:getProperty("name")
etc. Second parameter is ‘value’ which you know and I am not sure what ‘source’ contains?This is my understanding of things so far!
November 9, 2017 at 7:58 am #73456ah. i’ve been looking at the Utility tab under the properties pane.
no joy with button yet. but both uiLabel and uiButton have ‘name’
entry. -?- so i thought it could be done. could it have anything to
do with the position of the property in a list of properties ?anyway, just installing knobman now (need a transparent background
for the png)https://www.g200kg.com/knobman/
https://www.g200kg.com/jp/software/skinman.htmlNovember 9, 2017 at 8:02 am #73457aaaah: … i’m a timewaster idiot … 🙂
copying has changed the names … added ‘-1’ on the
mod names. get back on this in a minute.November 9, 2017 at 8:39 am #73458WELL i don’t think it was that, but i renamed them anyway.
the secondary combos are now numbered ..05 – ..08, same with
buttons.i have now changed the call to ‘onValueChange’ rather than
‘clickDown'(sic), and it works 🙂 so it’s all good.sussed it from what you said about mod vs comp (or was that
what you meant?) – because onValue change has the ‘mod’ as
? a default variable ? – whereas onMouseClick (sic2) may not
have.here it is fixed(ignore first file: startup fixed on the 2nd one)
Attachments:
You must be logged in to view attached files.November 9, 2017 at 8:42 am #73460from which we now know that Link modulators don’t cause
a problem. still can’t stop that second combo from coming
up showing when it shouldn’t – don’t think i can avoid
that without my startup method ‘hide/show’ thing.edit: same problem with the Structure graphic sliders:
they don’t give the correct view on startup on the
tabs that should be visible.November 9, 2017 at 4:03 pm #73462I found a solution to returning a unique identifier from a callback mouse-down function on uiLabel !
myMethod = function(--[[ CtrlrComponent --]] comp, --[[ MouseEvent --]] event) cvn=comp:getProperty("componentVisibleName") console(String("cvn="..cvn)) end -- function
November 9, 2017 at 5:07 pm #73463yes! funny thing there is that i’d kept old names after
changing the modulator name, and i wondered whether
‘visible name’ was being used at one point.thing is: turned out to be needing it to be onValueChange,
didn’t it? labels can’t change their value. …November 9, 2017 at 7:03 pm #73464working ! 😉
the implications of that sank in as i reproduced
your code above – of course i just changed the
*modulator name* again first, and got nothing ..
and then saw those old names i’d left in at
‘visible name’.
it works with ‘onClick’/mouseDown.
very useful..!Attachments:
You must be logged in to view attached files.November 10, 2017 at 7:00 am #73468what if i wanted to get a character in the middle of a string
with string.sub ? i’m trying without success.the mod name is currently ‘pcm1_pt1p1’, and endChar gets the end ‘1’
with (NAME,-1)so if i rename the mod: ‘pcm1_p1pt1’ (swapping round p1 and pt1 – this
is my current naming convention for modulators: part, then partial),
i should be able to get my *keyChar* (new name for the variable) at
(NAME,-4) ? or maybe just (NAME,7) -counting from the beginning-so if it try
-console(String("keyChar = : \""..keyChar.."\""))
it just returns""
(i don’t know how to use those escape slashes)and i cannot seem to concatenate with:
local comboName="pcm1_p"..keyChar.."pt1"
(suppose that is not how it is done? brackets?)i have already renamed etc. in my main project, so it doesn’t
matter – was just wondering if i could keep my ‘naming convention’.
(this is so everything appears ordered in the Modulator List)November 10, 2017 at 7:09 am #73469oh * i see* 🙂
NAME-1 refers to the button name !
if i do NAME-4, it returns the *last 4* characters of the button name.
got it.so i just keep it as it is, and re-order comboName expression as:
local comboName="pcm1_p"..keyChar.."pt1"
with or without brackets around it.
and this works too. 🙂
(still have no idea how that console expression with the
escape slashes works)November 10, 2017 at 8:07 am #73470… mm, now what about a timer loop? 🙂 to keep
inc/dec-rementing whilst button held hehe …little exercise with timers …
and thinking it might involve a short delay before
it kicks in, to avoid unwanted jumping of values
(which happens with one inbuilt Ctrlr thing, if i can
remember what that was).
(‘day commences’)November 10, 2017 at 10:28 am #73471(still have no idea how that console expression with the
escape slashes works)Because ” is used to define/hold strings ( a set of bytes ), you cannot include a ” within that string. If you do, the compiler will get confused!
myMethod = function(--[[ CtrlrModulator --]] mod, --[[ number --]] value, --[[ number --]] source) line ="\n________________" o="o" a="hell"..o .." world" console(String(a..line)) o="'s " -- don't need a backslash b="hell"..o .."world" console(String(b..line)) o="\"s " -- need a backslash c="hell"..o .."world" console(String(c..line)) o="o\n" -- need a backslash for line terminator or else it will just print 'n' d="hell"..o .."world" console(String(d..line)) o="\\" -- need a backslash to print a backslash e="hell"..o .."world" console(String(e..line)) end
🙂
November 10, 2017 at 6:23 pm #73472ok, so \n is new line. 🙂
and i see the other examples. great, cheers.so: looking at timers … goodweather uses these quite a bit.
(DSI Pro2 panel)
seems like counts can be ID’d assigning a timerID(number)function timerCallback(timerId) --Load program timer if timerId == 1 then --blablabla whatever you want to do timer:stopTimer(timerId) end
then i saw this:
-- Starting a timer to etc. --timer:setCallback (1, timerCallback) --timer:startTimer(1, 200)
infos online don’t seem very specific about it.
so i’m going to have a dig in the Ctrlr panels
i’ve seen with timers, see if i can understand
anything…was thinking that the ideal action for a scroll
action on held buttons would be a short delay before
onset of repeated inc/decrementing. so? 2 timers? or
one, and a ‘mouseDown’ function that causes repeating
count in either direction? *not* absolutely critical,
this, but it is what happens on a lot of interfaces.(speaking of interfaces – offtopic – the Roland JV1080
has a serious defect: anytime the device is receiving
sysex, you get a big ‘sysex received message’ across
the display, preventing you from seeing the parameters
changing. i wonder if there was another firmware version
than the one i have. what a load of .. even the old D-110
behaves normally when receiving sysex, doesn’t make a big
fuss about it..)November 10, 2017 at 7:39 pm #73473right well that timerID stuff seems to be the convention
within Ctrlr. don’t really see much elsewhere, but it’s
what everyone here has used for timers as far as i can
see. don’t really understand it yet. time for something
to eat.checking out this:
November 11, 2017 at 12:06 am #73474I just used
sleep(500)
(500=500ms) in the JD-990 panel, but I don’t know the difference and like you was confused by the timer code.I don’t have a JV-1080 although I have a JV-1010 and I have written a panel for it, which I hope to release soon. I think they are very similar machines, right?
Have you seen this panel? Jay-V (Roland JV/XP family panel)
November 11, 2017 at 7:26 am #73475can’t see where you used that ‘sleep’ – althought it did make
me look through all of your methods: btw it was your JD panel
that has arrays defined externally (re: earlier issue – probably
another one as well though).there is something under ‘static public member functions’:
”
static void JUCE_CALLTYPE –
callAfterDelay (int milliseconds, *std::function< void()>* functionToCall)
”
don’t know how to deal with the bit inside asterisks, but it makes some
sense. does that still need a timer?
now i’m wondering if ALL timers depend on os time…i can conceive of
having, say, timers 1,2,3,4, all with their own counts in mSec, …let’s
see now: and that a ‘timer callback’ is the bit that invokes a function
or operation…
then, start timer, stop timer, ~timer(to ‘destroy’ it? how is this different
from just stopping it? makes it start from 0 next time it’s called?)i am not clear on the term ‘void’ (although i’ve seen it all over the place),
and less so on ‘virtual’ and ‘virtual void'(!).so ‘timerID’ could be an arbitrary variable name … and when goodweather
goes:--timer:setCallback (1, timerCallback) --timer:startTimer(1, 200)
‘1’ is the ID of that timer, ‘timerCallback’ is the attributed function..
and then.. ?stop timer? kill timer? when operation is complete?or: for the purpose of this scrolling action, would not callAfterDelay()
be enough? but that would still need a timer to be defined, and a function…
which, perhaps, would involve a ‘while’ statement? while mouse is down?
does this go into mouse actions territory? getting left/right click? as
MrTor brought up somewhere..
so that would be a i=i+1 type of thing, with the ability to loop round
when it gets to max/min value of the modulator …that’s my ballpark conception of it. Ctrlr’s -/+ uiSlider buttons do the
scrolling action when held (evidently a doddle for Atom, all of this).
hehe i can spend days just figuring out button actions … 🙂
– – –
JV1080: yes have seen the JayVee panel – it is missing some params
specific to the 1080 because it’s a generic JV panel – some interesting
stuff to look at there. but i was mainly making a ‘midi template’ for
a Novation RemoteSL at that point – which i completed, as far as i could:
the RemoteSL will only allow sysex messages of a certain length, and can
not therefore address Exp(ansion card) waveforms, and i had to do a bodge
for waveform selection – which i don’t mind, because if i’m programming
a synth-type voice i don’t want to have to go through hearing all the
‘wrong’ waveforms along the way (fundamental design flaw imo with these
series: i don’t want a load of ‘generalMIDI’ type sounds coming up when
i want decent synth waveforms) – anyway, so, the ‘template’ works, with
a few compromises, and makes it really quick to get around the JV ‘patch’,
including FX (albeit blindly, there: you can’t have param.names displayed
for everything) – and if the sysex is the same or similar, it would not
take much to get it to work with the 1010.that’s here, if you want it:
RemoteSL JV 1080:
https://app.box.com/s/up0kxs6srr7a1hhvntai9y4w12twspq7November 11, 2017 at 11:19 am #73476I downloaded that file, but what is a blk file?
That timer code is in the JD-990 is in this ‘function’ myGetAllTempPatchInfoAndEffects and you can see I left some commented out code below as I was looking at timer as an option.
myGetAllTempPatchInfoAndEffects=function() --print("_________please wait__________") myGetTonesCD() -- load Patch Tone Values sleep(1000) myGetTonesAB() -- load Patch Tone Values sleep(750) myGetFX() -- load effects end --function --------------------------------------------------------- --[[ timer:setCallback (33, timerCallback) timer:startTimer(33,1000) -- stuff to do after timer has run its duration (here 1000ms) function timerCallback (timerId) -- this function name must match the name above in the first line. ;) --stuff to do while timer is running timer:stopTimer(33) panel:getModulatorByName("?????????"):setValue(0,true) end --]]
void in c++ means the function doesn’t return anything. If you want a function to return a value then you need to put that return type before the function.
int returnInt(int n){ return n }
Something like that!
Here is an explanation of virtual functions, which are used in derived classes.
November 11, 2017 at 11:33 am #73477KILObytes .. worried for a minute there… 🙂
it’s a ‘midi template’ *.blk file, for use with a Novation RemoteSL,
should you come across one. (as opposed to the usual *.syx template
file)it loads all 17 templates in one go via the Remote Editor, which
displays what memory slots they are going to before upload to the
RemoteSL.i’ve been messing around with/collating ‘evidence’ for the timer
stuff just now, looking at Possemo’s sequencer in the Matrix1k
panel. starting to get a clue.. i’m just going to build a simple
start/stop looping counter to begin with.. a bit later.November 12, 2017 at 3:19 pm #73497What do you want to know about timers? I have already documented them in Step by Step v2 so I can do a copy/paste here.
You can store all your timers in one function only provided you call the right timer with its ID
function timerCallback(timerId) --Load program timer if timerId == 1 then --blablabla whatever you want to do timer:stopTimer(timerId) elseif timerId == 8 then --blablabla whatever you want to do timer:stopTimer(timerId) end end
A timer is a loop that performs itself automatically a a specific time interval until it is stopped.
So, if you estimate that it takes 200ms to perform a lot of operations before showing a message on the screen or performing a certain action (for example) then you start a timer.if LoadedProgramData:getSize() == 1024 then bLoadingProgram = true LoadProgramData(LoadedProgramData) -- Starting a timer to reset bLoadingProgram to false after that all modulators have processed their OnChange function timer:setCallback (1, timerCallback) timer:startTimer(1, 200) end
In this case, LoadProgramData is setting all modulators to a value which is triggering their OnChange methods. In each OnChange method I’m checkng for bLoadingProgam==True and if this is the case, the OnChange method content is bypassed. Of course, I should reset bLoadingProgram to False when all OnChange methods are treated and this is what the timer 1 is doing.
You can also use a timer to send 99 sysex messages requesting a program dump from the synth and get the answer back one program at a time.
With trial an error I figured out that it takes 150ms to get the answer and request the next program without disturbing the synth. SO I have a timer call with 150ms. In the timer callback I store the data for each program but I also count until 99 and if 99 I stop the timer.November 12, 2017 at 3:55 pm #73498that’s quite ‘higher level’ compared to my current ambitions 🙂
just the basics, will do nicely.in this instance, i was thinking of how i might make an inc/dec
button pair start auto-inc’/dec’ing after holding their button down
for ? 1 second ? something like that. so one click just inc/decs
once, and click+hold starts scrolling – a combo, for example, and
then will perhaps loop the combo list when it gets to either extremity.
(or not loop, that isn’t critical)or: how about something basic for starters:
a run/stop button that starts a count through a table 1-10, sending
the uiLabelText property to a label acting as a display..?that’s what i’m planning to do when i get down to this later anyway.
being a bit of a dunce, i like to take things one step at a time … -
AuthorPosts
- The forum ‘Programming’ is closed to new topics and replies.