IncDec Selected Modulator ?

Home Forums General Programming IncDec Selected Modulator ?

Viewing 20 posts - 21 through 40 (of 45 total)
  • Author
    Posts
  • #73455
    dnaldoog
    Participant
      • Topics: 4
      • Replies: 480
      • Total: 484
      • ★★

      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 it

      I 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!

      #73456
      human fly
      Participant
        • Topics: 124
        • Replies: 1070
        • Total: 1194
        • ★★★★

        ah. 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.html

        #73457
        human fly
        Participant
          • Topics: 124
          • Replies: 1070
          • Total: 1194
          • ★★★★

          aaaah: … i’m a timewaster idiot … 🙂
          copying has changed the names … added ‘-1’ on the
          mod names. get back on this in a minute.

          #73458
          human fly
          Participant
            • Topics: 124
            • Replies: 1070
            • Total: 1194
            • ★★★★

            WELL 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.
            #73460
            human fly
            Participant
              • Topics: 124
              • Replies: 1070
              • Total: 1194
              • ★★★★

              from 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.

              #73462
              dnaldoog
              Participant
                • Topics: 4
                • Replies: 480
                • Total: 484
                • ★★

                I 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
                
                #73463
                human fly
                Participant
                  • Topics: 124
                  • Replies: 1070
                  • Total: 1194
                  • ★★★★

                  yes! 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. …

                  #73464
                  human fly
                  Participant
                    • Topics: 124
                    • Replies: 1070
                    • Total: 1194
                    • ★★★★

                    working ! 😉
                    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.
                    #73468
                    human fly
                    Participant
                      • Topics: 124
                      • Replies: 1070
                      • Total: 1194
                      • ★★★★

                      what 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)

                      #73469
                      human fly
                      Participant
                        • Topics: 124
                        • Replies: 1070
                        • Total: 1194
                        • ★★★★

                        oh * 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)

                        #73470
                        human fly
                        Participant
                          • Topics: 124
                          • Replies: 1070
                          • Total: 1194
                          • ★★★★

                          … 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’)

                          #73471
                          dnaldoog
                          Participant
                            • Topics: 4
                            • Replies: 480
                            • Total: 484
                            • ★★

                            (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
                            
                            

                            🙂

                            #73472
                            human fly
                            Participant
                              • Topics: 124
                              • Replies: 1070
                              • Total: 1194
                              • ★★★★

                              ok, 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..)

                              #73473
                              human fly
                              Participant
                                • Topics: 124
                                • Replies: 1070
                                • Total: 1194
                                • ★★★★

                                right 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:

                                https://juce.com/doc/classTimer

                                #73474
                                dnaldoog
                                Participant
                                  • Topics: 4
                                  • Replies: 480
                                  • Total: 484
                                  • ★★

                                  I 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)

                                  #73475
                                  human fly
                                  Participant
                                    • Topics: 124
                                    • Replies: 1070
                                    • Total: 1194
                                    • ★★★★

                                    can’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/up0kxs6srr7a1hhvntai9y4w12twspq7

                                    #73476
                                    dnaldoog
                                    Participant
                                      • Topics: 4
                                      • Replies: 480
                                      • Total: 484
                                      • ★★

                                      I 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.

                                      #73477
                                      human fly
                                      Participant
                                        • Topics: 124
                                        • Replies: 1070
                                        • Total: 1194
                                        • ★★★★

                                        KILObytes .. 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.

                                        #73497
                                        goodweather
                                        Participant
                                          • Topics: 45
                                          • Replies: 550
                                          • Total: 595
                                          • ★★★

                                          What 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.

                                          #73498
                                          human fly
                                          Participant
                                            • Topics: 124
                                            • Replies: 1070
                                            • Total: 1194
                                            • ★★★★

                                            that’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 …

                                          Viewing 20 posts - 21 through 40 (of 45 total)
                                          • The forum ‘Programming’ is closed to new topics and replies.
                                          There is currently 0 users and 119 guests online
                                          No users are currently active
                                          Forum Statistics
                                          Threads: 2,495, Posts: 17,374, Members: 77,605
                                          Most users ever online was 12 on January 22, 2019 3:47 pm
                                          Ctrlr