lua&demo panel question

Home Forums General Programming lua&demo panel question

This topic contains 25 replies, has 3 voices, and was last updated by zeoka zeoka 4 years, 11 months ago.

Viewing 20 posts - 1 through 20 (of 26 total)
  • Author
    Posts
  • #10058
    zeoka
    zeoka
    Participant
    • Topics: 70
    • Replies: 459
    • Total: 529
    • ★★★

    Hi i have questions about th demo panel data dump utilities :
    what is the number after “modulatorCustomIndex”, an index that defines this command ? Can we use several command that’s why there is an index ?
    An index 0 could exist? ( in the rackattack panel i had set a timer id 0 may be that’s why there is errors ? )

    Is possible to use modulatorCustomIndexGroup instead ? if yes how i can keep the same order ? i ask this for multiple dumps with différents modulators ?

    Except that , the exemple is clear for me and can reduce strongly my panel script !

    Just a last question o^O what is the console, i know it is evident , i’ve searched on lua website and nothing that explain why a console

    #10059
    atom
    atom
    Moderator
    • Topics: 156
    • Replies: 2940
    • Total: 3096
    • ★★★★★

    A console is used to quickly test Lua snippets and methods.

    The number after the property name is the byte length of the written memory block, for values 0-127 one byte is enough, but for values larger then that you will have to use at least 2 bytes to store the value. The functions is defined as:

    getModulatorValuesAsData(const String &propertyToIndexBy, const int bytesPerValue, const bool useMappedValues)
    

    the propertyToIndexBy can be any property (you can set/add your own), the example uses modulatorCustomIndex because it’s a pre-defined property visible in the property pane. You can use the group property too sure.

    The order is defined by the property, that’s the point if you index your modulators using the modulatorCustomIndex property 0-N then you will get a memory block of size N – 1 and position of the byte in the resulting MemoryBlock will be the same as the value of modulatorCustomIndex for each modulator

    But these are only utility methods. there is more to come and a special demo panel for program management will be created. With all those methods documented.

    #10061
    zeoka
    zeoka
    Participant
    • Topics: 70
    • Replies: 459
    • Total: 529
    • ★★★

    Thank you Atom !
    So it is generally 1
    If i use the group mod index then use custom mod index too or not ?
    Exemple group 0 with custom index 0 to 100
    group 1 with custom index 0 to 100 or index 101 to 200 ?
    or custom groups without custom index ?
    Can i combine the two ? if i use groups will i keep the same order ?

    What’s happen if for ex : mod1=1(customindex) mod2=4 mod3=5 mod=6….
    if there is unused bytes in the receiving dump message from unit ?

    • This reply was modified 5 years, 3 months ago by zeoka zeoka.
    • This reply was modified 5 years, 3 months ago by zeoka zeoka.
    #10065
    atom
    atom
    Moderator
    • Topics: 156
    • Replies: 2940
    • Total: 3096
    • ★★★★★

    If there are “holes” in indexing i thing Juce will fill them with zeros.

    In this i doubt you’ll find a good reason to combine both groups and indexes, the groups were designed to be used with method for fetching modulators from the panel. For now there is only one method that does that, but it really doesn’t work with the groups property.

    getModulatorsWildcard(const String &wildcardMatch, const bool ignoreCase)
    

    The groups property is also something i’d like to use later when connecting Ctrlr to different control surfaces, via MIDI or OSC. Exporting parameters in groups helps to navigate through them.

    Those two properties are sort of extras, or placeholders for whatever a clever panel developer can think of.

    Like i said if you want you can assign your own properties to modulators with different names, this is just a “hint”.

    • This reply was modified 5 years, 3 months ago by atom atom.
    #10095
    zeoka
    zeoka
    Participant
    • Topics: 70
    • Replies: 459
    • Total: 529
    • ★★★

    Hi

    -“If there are “holes” in indexing i thing Juce will fill them with zeros.”
    Yes but it does not “take” last modulators corresponding to “holes”.

    -setModulatorValuesAsData(“vstIndex”,1,false):setRange(8,20)

    Is this possible ?

    • This reply was modified 5 years, 3 months ago by zeoka zeoka.
    #10097
    atom
    atom
    Moderator
    • Topics: 156
    • Replies: 2940
    • Total: 3096
    • ★★★★★

    1. what ? what is missing in your memory block

    2. no, there are 2 methods

    LMemoryBlock getModulatorValuesAsData(const String &propertyToIndexBy, const int bytesPerValue, const bool useMappedValues)
    and
    void setModulatorValuesFromData (const MemoryBlock &dataSource, const String &propertyToIndexBy, int bytesPerValue, const bool useMappedValues)
    

    What would setRange(8,20) do anyway ?

    #10098
    zeoka
    zeoka
    Participant
    • Topics: 70
    • Replies: 459
    • Total: 529
    • ★★★

    I’ ve taken your exemple and change custom indexes
    mod1 0, mod2 5, mod3 6 , mod4 7 , mod5 8 , mod7 9
    I have 7f(mod1 value) 00 00 00 00 7f(mod2 value) and it miss mod3 to mod7.

    A solution could be to make dummy mods

    I need setRange to choose indexes i want ex :vstindex 8 to 20

    data=setModulatorValuesFromData(“vstIndex”,1,false):setRange(8,20) ?
    I want set only a rang of index not possible ?

    #10099
    atom
    atom
    Moderator
    • Topics: 156
    • Replies: 2940
    • Total: 3096
    • ★★★★★

    You can’t do that:

    data=setModulatorValuesFromData(“vstIndex”,1,false)
    realData = data:getRange(8,20)
    
    #10100
    zeoka
    zeoka
    Participant
    • Topics: 70
    • Replies: 459
    • Total: 529
    • ★★★

    Yes thank you i will try later when i go home

    #14136
    zeoka
    zeoka
    Participant
    • Topics: 70
    • Replies: 459
    • Total: 529
    • ★★★

    Hi
    i try this :

    myNewMethod = function(midi)
    
    vendor = midi:getLuaData():getByte(1)
     model = midi:getLuaData():getByte(2)
      typ1 = midi:getLuaData():getByte(4)
      typ2 = midi:getLuaData():getByte(5)
      typ3 = midi:getLuaData():getByte(6)
       if vendor == 62 and model == 17 then 
          if typ1 == 16  and typ3 == 0 then  
     i0to13 = midi:getLuaData():getRange(7,14) 
    i16to23 = midi:getLuaData():getRange(23,8)
    i26to33 = midi:getLuaData():getRange(33,8)
    i36to50 = midi:getLuaData():getRange(43,15)
    i53to67 = midi:getLuaData():getRange(60,15)
    i69to73 = midi:getLuaData():getRange(76,5)
    i75to83 = midi:getLuaData():getRange(82,9)
    i85to91 = midi:getLuaData():getRange(92,7)
        i94 = midi:getLuaData():getByte(101)
    sound01 = MemoryBlock(string.format("%s %s %s %s %s %s %s %s %s", i0to13:toHexString(1),i16to23:toHexString(1),i26to33:toHexString(1),
    i36to50:toHexString(1),i53to67:toHexString(1),
    i69to73:toHexString(1),i75to83:toHexString(1),i85to91:toHexString(1),i94:toHexString())) 
    panel:setModulatorValuesFromData (sound01, "vstIndex", 0, 1, false)
      elseif typ1 == 16  and typ3 == 1 then
     i0to13 = midi:getLuaData():getRange(7,14) 
    i16to23 = midi:getLuaData():getRange(23,8)
    i26to33 = midi:getLuaData():getRange(33,8)
    i36to50 = midi:getLuaData():getRange(43,15)
    i53to67 = midi:getLuaData():getRange(60,15)
    i69to73 = midi:getLuaData():getRange(76,5)
    i75to83 = midi:getLuaData():getRange(82,9)
    i85to91 = midi:getLuaData():getRange(92,7)
        i94 = midi:getLuaData():getByte(101)
    sound02 = MemoryBlock(string.format("%s %s %s %s %s %s %s %s %s", i0to13:toHexString(1),i16to23:toHexString(1),i26to33:toHexString(1),
    i36to50:toHexString(1),i53to67:toHexString(1),
    i69to73:toHexString(1),i75to83:toHexString(1),i85to91:toHexString(1),i94:toHexString())) 
    panel:setModulatorValuesFromData (sound02, "vstIndex", 82, 1, false)
         end
      end
    end

    I have a problem with sound01 variable that doesn’t work at all

    The last line is taken from the mopho “panel:setModulatorValuesFromData (unpackedData, “modulatorCustomIndex”, 0, 1, false)” and modified but not sure the first number is the index starting number . i don’t know what it is
    Any idea ?

    #14139
    zeoka
    zeoka
    Participant
    • Topics: 70
    • Replies: 459
    • Total: 529
    • ★★★

    -midi:getLuaData():getRange(92,7) or midi:getLuaData():getByte(101) gives hexstrings ?
    -setModulatorValuesFromData wants data ? but accepts hexstrings ?
    -do i need to convert hexstring to data ?

    #14143
    zeoka
    zeoka
    Participant
    • Topics: 70
    • Replies: 459
    • Total: 529
    • ★★★

    Saw the” Data dump utility” panel and tried this :

     myNewMethod = function(midi)
    
    vendor = midi:getLuaData():getByte(1)
     model = midi:getLuaData():getByte(2)
      typ1 = midi:getLuaData():getByte(4)
      typ2 = midi:getLuaData():getByte(5)
      typ3 = midi:getLuaData():getByte(6)
     txt =panel:getComponent("modulator-1")
       if vendor == 62 and model == 17 and typ1 == 16 then 
          i0to13 = midi:getLuaData():getRange(7,14) 
         i16to23 = midi:getLuaData():getRange(23,8)
         i26to33 = midi:getLuaData():getRange(33,8)
         i36to50 = midi:getLuaData():getRange(43,15)
         i53to67 = midi:getLuaData():getRange(60,15)
         i69to73 = midi:getLuaData():getRange(76,5)
         i75to83 = midi:getLuaData():getRange(82,9)
         i85to91 = midi:getLuaData():getRange(92,7)
             i94 = midi:getLuaData():getByte(101)
            txt:setText(string.format("%s %s %s %s %s %s %s %s", i0to13:toHexString(1),i16to23:toHexString(1),i26to33:toHexString(1),i36to50:toHexString(1),i53to67:toHexString(1),i69to73:toHexString(1),i75to83:toHexString(1),i85to91:toHexString(1)))
           sound = MemoryBlock(txt:getText())
           if typ3 == 0 then  
             panel:setModulatorValuesFromData (sound, "vstIndex",0, 1, false)
    -- not working (see the picture) 
        elseif typ3 == 1 then  
            txt:setText(string.format("%s %s %s %s %s %s %s %s", i0to13:toHexString(1),i16to23:toHexString(1),i26to33:toHexString(1),i36to50:toHexString(1),i53to67:toHexString(1),i69to73:toHexString(1),i75to83:toHexString(1),i85to91:toHexString(1)))
        elseif typ3 == 2 then  ................  
    -- i can get texts formats , that's working 

    This is not working and on the demo panel too :

    Attachments:
    You must be logged in to view attached files.
    #14148
    atom
    atom
    Moderator
    • Topics: 156
    • Replies: 2940
    • Total: 3096
    • ★★★★★

    I fixed that panel, i added an option and forgot to updat the DEMO, it should be woring in the SVN repo.

    #14154
    zeoka
    zeoka
    Participant
    • Topics: 70
    • Replies: 459
    • Total: 529
    • ★★★

    Cool
    Just to clarify the first INT is what ?
    I Wonder it is the starting index number
    Then i could use range of index to get midi dump for each sounds
    What is SVN repo ?

    #14155
    atom
    atom
    Moderator
    • Topics: 156
    • Replies: 2940
    • Total: 3096
    • ★★★★★

    SVn repo is a place i keep my source files, and those are the latest available, the DEMO panels are part of source code so they are also the latest, there is a link to it on the Downloads->Ctrlr page, here it is again:
    http://sourceforge.net/p/ctrlrv4/code/HEAD/tree/

    #14157
    zeoka
    zeoka
    Participant
    • Topics: 70
    • Replies: 459
    • Total: 529
    • ★★★

    Thank you Atom !
    It seems working now !
    But it seems very high cpu usage because simple methods like setText are not working :may be they are displayed too fast
    Other thing i have a delay because all 1968 mods are updated in same time
    I’ve compared a few RackAttack&Ctrlr values after received a whole prog (all sounds)
    and it’s ok. i must find RA users now to check totally .
    I will gain more than 200kb of script if all is ok !

    Here is my method :

    Attachments:
    You must be logged in to view attached files.
    #14167
    atom
    atom
    Moderator
    • Topics: 156
    • Replies: 2940
    • Total: 3096
    • ★★★★★

    But it seems very high cpu usage because simple methods like setText are not working :may be they are displayed too fast

    what do you mean setText is not working ? in the DEMO panel or in your panel ?

    #14169
    zeoka
    zeoka
    Participant
    • Topics: 70
    • Replies: 459
    • Total: 529
    • ★★★

    This is my panel
    First my lcdlabel produce a nil with setText and a normal label not (not a big probl.)
    second the problem is the method setModulatorValuesFromData : Ctrlr get busy and i can’t display dump progression (sound01,sound02…)
    Only the last text is displayed and all mods are set at once .My old method takes less cpu and works fine (since i changed the fx structure the dump never crashes) but takes 283 kb so would reduce it strongly
    I don’t know what i will do….

    The RA sends dumps with 90-100 ms between each dump

    • This reply was modified 4 years, 11 months ago by zeoka zeoka. Reason: RA specs
    #14171
    atom
    atom
    Moderator
    • Topics: 156
    • Replies: 2940
    • Total: 3096
    • ★★★★★

    The LCDLabel issue is there, i fixed it (the class was not registered in Lua). The new nightly build will containt the fix

    #14189
    lfo2vco
    lfo2vco
    Participant
    • Topics: 24
    • Replies: 154
    • Total: 178
    • ★★

    The LCDLabel issue is there, i fixed it (the class was not registered in Lua). The new nightly build will containt the fix

    Hey Atom, will the Mac version of the Nightly also updated with this fix? It may solve a bug that has been ‘buggging’ me.; a nil value possibly linked to a LCDLabel. : )

Viewing 20 posts - 1 through 20 (of 26 total)

You must be logged in to reply to this topic.

There is currently 0 users and 23 guests online
No users are currently active
Forum Statistics
Threads: 2,151, Posts: 15,163, Members: 13,650
Most users ever online was 5 on March 28, 2018 6:11 pm
Do NOT follow this link or you will be banned from the site!