Problems with Panel Data Request as Restricted Instance

Home Forums Development Problems with Panel Data Request as Restricted Instance

Viewing 18 posts - 1 through 18 (of 18 total)
  • Author
    Posts
  • #117345
    lecletolecleto
    Participant
    • Topics: 9
    • Replies: 31
    • Total: 40

    Hello Ctrlrs!

    I´m trying to get the Data from synth JV-880 when my panel is opening. For this I created a LUA function to request the parameters with method “called when a panel has finishing loading” This are working in edit mode but when I export as a “restricted instance” don´t work. What can be wrong? It´s a bug? Thanks in advance!

    I wrote this function:

    callBackInit = function(mod, value)

    –Request Common Data

    mySysex = CtrlrMidiMessage({0xF0, 0x41, 0x10, 0x46, 0x11, 0x00, 0x08, 0x20, 0x00, 0x00, 0x00, 0x00, 0x22, 0x5E, 0xF7})

    panel:sendMidiMessageNow(mySysex)

    –Request Tone 1 Data

    mySysex = CtrlrMidiMessage({0xF0, 0x41, 0x10, 0x46, 0x11, 0x00, 0x08, 0x28, 0x00, 0x00, 0x00, 0x00, 0x74, 0x0C, 0xF7})

    panel:sendMidiMessageNow(mySysex)

    –Request Tone 2 Data

    mySysex = CtrlrMidiMessage({0xF0, 0x41, 0x10, 0x46, 0x11, 0x00, 0x08, 0x29, 0x00, 0x00, 0x00, 0x00, 0x74, 0x0C, 0xF7})

    panel:sendMidiMessageNow(mySysex)

    –Request Tone 3 Data

    mySysex = CtrlrMidiMessage({0xF0, 0x41, 0x10, 0x46, 0x11, 0x00, 0x08, 0x2A, 0x00, 0x00, 0x00, 0x00, 0x74, 0x0C, 0xF7})

    panel:sendMidiMessageNow(mySysex)

    –Request Tone 4 Data

    mySysex = CtrlrMidiMessage({0xF0, 0x41, 0x10, 0x46, 0x11, 0x00, 0x08, 0x2B, 0x00, 0x00, 0x00, 0x00, 0x74, 0x0C, 0xF7})

    panel:sendMidiMessageNow(mySysex)

    end

    #117347
    goodweathergoodweather
    Participant
    • Topics: 41
    • Replies: 499
    • Total: 540
    • ★★★

    Hi!
    In which version are you? 5.3.201?
    The method to put in “Called when the panel finished loading” should be like

    --
    -- Called when the panel has finished loading
    --
    PanelLoaded = function()
    

    or like

    --
    -- Called when the panel has finished loading
    --
    -- @type the type of instance beeing started, types available in the CtrlrPanel
    -- class as enum
    --
    -- InstanceSingle
    -- InstanceMulti
    -- InstanceSingleRestriced
    -- InstanceSingleEngine
    -- InstanceMultiEngine
    -- InstanceSingleRestrictedEngine
    --
    myNewMethod = function(--[[ CtrlrInstance --]] type)
    end

    and thus not have any argument or just have one. I didn’t try the second possibility yet.
    This is at least one thing to notice.

    To create a method: right click in the left column of the Lua editor, give a name but also select the method type (what you probably didn’t do). in this case it should be luaPanelLoaded

    Your method seems to be an “on value change” method (missing the source variable at the end) and is probably attached to a modulator. It works in Edit mode because unless restricted by some isPanelReady method, all OnChange methods are automatically scanned and executed when you open your panel.

    #117348
    lecletolecleto
    Participant
    • Topics: 9
    • Replies: 31
    • Total: 40

    Hello GoodWeather!

    Thank you for replly!

    I´m tryed all the things that you told me but stils not working. I´m on version 6.026 of Ctrlr. The 5.3.201 don´t work well on my PC. The menus are “black” but I tryed export with the version 5.3.201 and not worked as well.

    After your explains and more research on Google, I found this old thread and now I thinking that it´s a old problem with no solution for while… maybe a trick!

    2 problems not solved

    2 problems not solved

    Atom, what about the first zeoka’s question?

    zeoka wrote:
    – “luaPanelLoaded” and “luaPanelBeforeLoad” are not working in
    restricted exported versions ? they work only in the full version for me

    I have similar problems with all exported instances.

    Dasfaker:

    Found the issue. If I save the panel with “Override panel MIDI channel” off for all mods and reopen the panel I get this behaviour, no matter if I now active “Override..” for all mods. Only if this option is active on startup it works fine.

    So I will try change all modulators…

    #117391
    goodweathergoodweather
    Participant
    • Topics: 41
    • Replies: 499
    • Total: 540
    • ★★★

    Well, I can only repeat what is stated everywhere, stable and working well: use only 5.3.201 on Windows PC.
    I’m doing restricted exports standalone, VST/AU, PC and Mac and have no issue.

    Your problem must be somewhere else thus.

    I have Override OFF. It should be like that I think as otherwise users cannot use a different Midi channel.

    #117400
    lecletolecleto
    Participant
    • Topics: 9
    • Replies: 31
    • Total: 40

    Hello Goodwhether! Thank for reply!

    I´m now on version 5.3.201. The problem about “black menus” was in my panel configuration.
    About my main problem in a version 5.3.201 the comportament is the same of 6.026.
    WIth Ctrlr editor the fucntion callBackInit work and the synth gives back data for refresh a panel.
    With a restricted instance the panel is not refreshed.
    I wrote the function “callBackInit” as you teache me but still not working when I render as restricted instance. I also tryed other function to set modulator values at initialization but it seems that noone function is called after panel is load.

    Here is the code. There are something wrong?

    callBackInit = function(luaPanelLoaded)

    –Request Common Data

    mySysex = CtrlrMidiMessage({0xF0, 0x41, 0x10, 0x46, 0x11, 0x00, 0x08, 0x20, 0x00, 0x00, 0x00, 0x00, 0x22, 0x5E, 0xF7})

    panel:sendMidiMessageNow(mySysex)

    –Request Tone 1 Data

    mySysex = CtrlrMidiMessage({0xF0, 0x41, 0x10, 0x46, 0x11, 0x00, 0x08, 0x28, 0x00, 0x00, 0x00, 0x00, 0x74, 0x0C, 0xF7})

    panel:sendMidiMessageNow(mySysex)

    –Request Tone 2 Data

    mySysex = CtrlrMidiMessage({0xF0, 0x41, 0x10, 0x46, 0x11, 0x00, 0x08, 0x29, 0x00, 0x00, 0x00, 0x00, 0x74, 0x0C, 0xF7})

    panel:sendMidiMessageNow(mySysex)

    –Request Tone 3 Data

    mySysex = CtrlrMidiMessage({0xF0, 0x41, 0x10, 0x46, 0x11, 0x00, 0x08, 0x2A, 0x00, 0x00, 0x00, 0x00, 0x74, 0x0C, 0xF7})

    panel:sendMidiMessageNow(mySysex)

    –Request Tone 4 Data

    mySysex = CtrlrMidiMessage({0xF0, 0x41, 0x10, 0x46, 0x11, 0x00, 0x08, 0x2B, 0x00, 0x00, 0x00, 0x00, 0x74, 0x0C, 0xF7})

    panel:sendMidiMessageNow(mySysex)

    end

    Thanks a lot!

    #117401
    dnaldoogdnaldoog
    Participant
    • Topics: 3
    • Replies: 372
    • Total: 375
    • ★★

    Hi lecleto, I think your checksums are all wrong. That could be one problem.

    I have Roland checksum code in lua if you want.

    #117407
    lecletolecleto
    Participant
    • Topics: 9
    • Replies: 31
    • Total: 40

    Hello dnaldoog! Thank you for reply!

    The problem is the fucntion in Lua are working when I open in Ctrlr.

    The problem comes just when I render as restricted instance. The sysex messages on the function are the same of button panel and work at panel and I don´t get any message about checksum error. I tryed other function that only set the values of modulators and don´t send any sysex. The problem is the same. Just not work. It seems that any lua script not run after loading panel.

    #117408
    goodweathergoodweather
    Participant
    • Topics: 41
    • Replies: 499
    • Total: 540
    • ★★★

    Can you please share your panel so I can have a more detailed look?
    The problem must lie somewhere else.
    Which DAW are you using?

    #117417
    lecletolecleto
    Participant
    • Topics: 9
    • Replies: 31
    • Total: 40

    Hello Ctrlrs!

    Firstly I woluld like to thank you for all inputs!

    Hello dnaldoog you solved my problem and you don´t know!!!

    I found in one past post of dnaldoog the solution to my problem. It seemns that panel needs a delay on init to process a function after load. Lets go to solution:

    The fisrt thing was create a function that will be called when panel finished to load. In this case “init”

    In this fucntion, after panel load, the variable allowtoRun will seted to 0 and will start a timer:

    init = function(–[[ CtrlrInstance –]] type)

    allowToRun=falseong>
    timer:setCallback (1,timerCallback)
    — allowToRun = 1
    timer:startTimer(1,400)

    end

    After this counting time the funtion “timer” will be called and here you will put what you what to do when the panel is load. In my panel I want set initial modulators value and send a sysex messages to requesting a data from synth.

    function timerCallback(timerId)

    — Load program timer
    if timerId == 1 then
    allowToRun=true

    — Init Panel Options

    panel:getModulatorByName(“SR-JV-SELECT”):setModulatorValue(0,false,true,false)
    panel:getModulatorByName(“COPY-SELECT”):setModulatorValue(0,false,true,false)
    panel:getModulatorByName(“CHORUS-SW”):setModulatorValue(1,false,true,false)
    panel:getModulatorByName(“REVERB-SW”):setModulatorValue(1,false,true,false)

    –Request Common Data

    mySysex = CtrlrMidiMessage({0xF0, 0x41, 0x10, 0x46, 0x11, 0x00, 0x08, 0x20, 0x00, 0x00, 0x00, 0x00, 0x22, 0x5E, 0xF7})

    panel:sendMidiMessageNow(mySysex)

    –Request Tone 1 Data

    mySysex = CtrlrMidiMessage({0xF0, 0x41, 0x10, 0x46, 0x11, 0x00, 0x08, 0x28, 0x00, 0x00, 0x00, 0x00, 0x74, 0x0C, 0xF7})

    panel:sendMidiMessageNow(mySysex)

    –Request Tone 2 Data

    mySysex = CtrlrMidiMessage({0xF0, 0x41, 0x10, 0x46, 0x11, 0x00, 0x08, 0x29, 0x00, 0x00, 0x00, 0x00, 0x74, 0x0C, 0xF7})

    panel:sendMidiMessageNow(mySysex)

    –Request Tone 3 Data

    mySysex = CtrlrMidiMessage({0xF0, 0x41, 0x10, 0x46, 0x11, 0x00, 0x08, 0x2A, 0x00, 0x00, 0x00, 0x00, 0x74, 0x0C, 0xF7})

    panel:sendMidiMessageNow(mySysex)

    –Request Tone 4 Data

    mySysex = CtrlrMidiMessage({0xF0, 0x41, 0x10, 0x46, 0x11, 0x00, 0x08, 0x2B, 0x00, 0x00, 0x00, 0x00, 0x74, 0x0C, 0xF7})

    panel:sendMidiMessageNow(mySysex)

    timer:stopTimer(timerId)

    end

    end

    Now everything are working as I want!

    The original post from dnaldoog:

    Reply To: Standalone Lua Not Loading

    #117418
    goodweathergoodweather
    Participant
    • Topics: 41
    • Replies: 499
    • Total: 540
    • ★★★

    I have this as well in my panels since long… Difficult to help without getting the full picture 😉

    --
    -- Called when the panel has finished loading
    --
    PanelLoaded = function()
    
    	bPanelLoaded = false
    	bLoadingProgram = false
    
    	AssignModulators()
    	Tables_Init()
    	BasicProgramData_Init()
    	About_Init()
    
    	timer:setCallback (2, timerCallback)
    	timer:startTimer(2, 200)
    
    end

    Glad you found this!

    #117428
    lecletolecleto
    Participant
    • Topics: 9
    • Replies: 31
    • Total: 40

    Thank you GoodWeather!

    Very clear your code! I will try here!

    One doubt: Why you set timer:startTimer(2, 200)? What is 2? 200 is a miliseconds?

    and

    bPanelLoaded = false
    bLoadingProgram = false

    Just to understand better.

    Thanks!

    #117431
    dnaldoogdnaldoog
    Participant
    • Topics: 3
    • Replies: 372
    • Total: 375
    • ★★

    Great to hear you got it working lecleto!

    Of course I knew about that post, but I didn’t think it applied to you, because I thought those functions you were running didn’t need to be blocked, but it turns out they did. I still don’t understand it fully I guess!

    Well I wanted to update the example panel in that post and made a few edits and then the post disappeared. It’s a big problem with this forum right now. I’ll see if I can repost it soon – if you post the same message soon after it detects a multiple post, but luckily I Ctrl-C`ed the message before updating!

    Also when posting code if you put it between two backticks `myFunction()` it will look like:

    myFunction()

    #117436
    lecletolecleto
    Participant
    • Topics: 9
    • Replies: 31
    • Total: 40

    Yeah dnaldoog!

    Thanks for tip about backticks! ‘I realy desired know how to do this…’

    About code your panel example was perfect to what I needing!

    After that I tryed in my panel a function that don´t send any sysex and still not working I said: this can be a temporization problem. I need d delay to execute the function… And what I need is a timer! Here your panel and example enter in the history!! As you said is not the same case of your example in a post but was what I needing to know about timers in Ctrlr!
    The Ctrlr is fantastic interface but the documentation about is very limitaded. All that I learn to built a JV PatchEd. was in posts and examples of community.
    Thank you for reply and will wait for new example!

    #117439
    dnaldoogdnaldoog
    Participant
    • Topics: 3
    • Replies: 372
    • Total: 375
    • ★★

    Here’s the new link with a new panel, but your old link that was deleted from the thread still exists!! What’s going on?

    Anyway here is is:

    Standalone Lua Not Loading

    :)

    #117693
    lecletolecleto
    Participant
    • Topics: 9
    • Replies: 31
    • Total: 40

    Hello dnaldoog! I´m back! You are right! All my checksums are wrong!!
    I just really understand how this work today!!

    My problem now is with checksums of sysex message that contais all data of patch and I´m working to create a “store patch” function on my editor for Roland JV-880 and the store function are working but comes a message o checksums error.

    Roland JV-880 patch message is composed of one message with 45 bytes and 4 messages with 127 bbytes and I storing each of this messages on respective tables.

    This is one example message with a correct checksum.

    F0 41 10 46 12 01 43 20 00 54 65 6B 6E 6F 20 64 72 6F 6E 65 31 01 06 42 22 00 01 7F 28 50 28 00 00 5A 40 3B 05 01 00 01 01 00 1A 30 F7

    The problem is when I edit a patch this cheksum change and I need recalculate this but I don´t Know how in this long message.

    This is a sysex message from table that I created:

    --Send Common Patch Data to be stored
            		
    		commonSysex = CtrlrMidiMessage({0xF0, tableCommon[0], tableCommon[1], tableCommon[2], tableCommon[3], storePlace, storePatch, tableCommon[6], tableCommon[7], tableCommon[8], tableCommon[9], tableCommon[10], tableCommon[11], tableCommon[12], tableCommon[13], tableCommon[14], tableCommon[15], tableCommon[16], tableCommon[17], tableCommon[18], tableCommon[19], tableCommon[20], tableCommon[21], tableCommon[22], tableCommon[23], tableCommon[24], tableCommon[25], tableCommon[26], tableCommon[27], tableCommon[28], tableCommon[29], tableCommon[30], tableCommon[31], tableCommon[32], tableCommon[33], tableCommon[34], tableCommon[35], tableCommon[36], tableCommon[37], tableCommon[38], tableCommon[39], tableCommon[40], tableCommon[41], tableCommon[42], 0xF7})
    	    
        	panel:sendMidiMessageNow(commonSysex)

    After many research I found your lesson:

    myCheckSum=function(...)
        --1. Convert the hex values to decimal. (function parameters are automatically converted)
        --2. Add the values together, but if the answer to any sum exceeds 127 then subtract 128.
        --3. Subtract the final answer from 128.
        --4. Convert the resulting value back to hex and use as the checksum.
        local total=0
        local result=0
        for i,v in ipairs(arg) do
            total=total+v --add up all the numbers
            if(total > 127) then
                total=total - 128
            end
        end
    
        result=128-total
    	if result== 128 then result = 0 end -- If the result is 128 then substitute a value of 0
        return tonumber(result,10)
    
    end --function

    How I can use your funtion on my tables tables since I have to “scan” the 38 bytes before checksum?

    Thank you in advance!!

    • This reply was modified 3 months ago by lecletolecleto.
    #117695
    dnaldoogdnaldoog
    Participant
    • Topics: 3
    • Replies: 372
    • Total: 375
    • ★★

    Hi Lecleto,

    You need to calculate the data values separate to the whole message.

    Using argument(…) you can pass multiple arguments to a function

    so for example to create a dynamic sysex message for

    F0 41 10 46 12 01 43 20 00 54 65 6B 6E 6F 20 64 72 6F 6E 65 31 01 06 42 22 00 01 7F 28 50 28 00 00 5A 40 3B 05 01 00 01 01 00 1A 30 F7

    
    local tableCommon[42]=checkSum(
    tableCommon[8], tableCommon[9], tableCommon[10], tableCommon[11], tableCommon[12], tableCommon[13], tableCommon[14], tableCommon[15], tableCommon[16], tableCommon[17], tableCommon[18], tableCommon[19], tableCommon[20], tableCommon[21], tableCommon[22], tableCommon[23], tableCommon[24], tableCommon[25], tableCommon[26], tableCommon[27], tableCommon[28], tableCommon[29], tableCommon[30], tableCommon[31], tableCommon[32], tableCommon[33], tableCommon[34], tableCommon[35], tableCommon[36], tableCommon[37], tableCommon[38], tableCommon[39], tableCommon[40], tableCommon[41]) -- returns the checksum of all data values
    
    --Send Common Patch Data to be stored
            		
    		commonSysex = CtrlrMidiMessage({0xF0, tableCommon[0], tableCommon[1], tableCommon[2], tableCommon[3], storePlace, storePatch, tableCommon[6], tableCommon[7], tableCommon[8], tableCommon[9], tableCommon[10], tableCommon[11], tableCommon[12], tableCommon[13], tableCommon[14], tableCommon[15], tableCommon[16], tableCommon[17], tableCommon[18], tableCommon[19], tableCommon[20], tableCommon[21], tableCommon[22], tableCommon[23], tableCommon[24], tableCommon[25], tableCommon[26], tableCommon[27], tableCommon[28], tableCommon[29], tableCommon[30], tableCommon[31], tableCommon[32], tableCommon[33], tableCommon[34], tableCommon[35], tableCommon[36], tableCommon[37], tableCommon[38], tableCommon[39], tableCommon[40], tableCommon[41], tableCommon[42] --[[checksum--]], 0xF7})
    	    
        	panel:sendMidiMessageNow(commonSysex)
    	

    There is an another way to do this using MemoryBlock(). It’s more elegant but difficult to understand at first.

    I am now using this function to calculate the checkSum, but the one you quote should be fine too:

    
    checkSum=function(...) -- Roland Checksum
    local sum=0
    local result=0
    for _,v in ipairs(arg) do
    sum=sum+v
    end
    local result=bit.band(sum,0x7f)
    if result * 1 ~=0 then
    result= 0x80-result
    end
    return result 
    end --function
    
    

    Let me know if this works. I haven’t tested the it!

    #117735
    lecletolecleto
    Participant
    • Topics: 9
    • Replies: 31
    • Total: 40

    Hello Dnaldoog!

    Now everything are working and my “Store Patch” function on my panel is ready! Thank you so much!!

    I run the “for” loop inside the store function and one “for” for each tone! I had to change “(” by “{” on checksumCmn vector.

    This is the final Lua script for Roland checksum:

    --### Checksum of Common Data ###
    		
    		checkSumCmn = {storePlace, storePatch, tableCommon[6], tableCommon[7], tableCommon[8], tableCommon[9], tableCommon[10], tableCommon[11], tableCommon[12], tableCommon[13], tableCommon[14], tableCommon[15], tableCommon[16], tableCommon[17], tableCommon[18], tableCommon[19], tableCommon[20], tableCommon[21], tableCommon[22], tableCommon[23], tableCommon[24], tableCommon[25], tableCommon[26], tableCommon[27], tableCommon[28], tableCommon[29], tableCommon[30], tableCommon[31], tableCommon[32], tableCommon[33], tableCommon[34], tableCommon[35], tableCommon[36], tableCommon[37], tableCommon[38], tableCommon[39], tableCommon[40], tableCommon[41]} -- returns the checksum of all data values
    
    		
    		local total=0
        	        local result=0
        	
    								
    				for i,v in ipairs(checkSumCmn) do
            
    					total=total+v --add up all the numbers
            
    					if(total > 127) then
                			total=total - 128
            			end
        
    				end
    
        	        result=128-total
    	
    		if result== 128 then result = 0 end -- If the result is 128 then substitute a value of 0
        
    		tableCommon[42] = tonumber(result,10)
    --### Send Sysex Messages ###
    		
    
    		--Send Common Patch Data to be stored
            		
    		commonSysex = CtrlrMidiMessage({0xF0, tableCommon[0], tableCommon[1], tableCommon[2], tableCommon[3], storePlace, storePatch, tableCommon[6], tableCommon[7], tableCommon[8], tableCommon[9], tableCommon[10], tableCommon[11], tableCommon[12], tableCommon[13], tableCommon[14], tableCommon[15], tableCommon[16], tableCommon[17], tableCommon[18], tableCommon[19], tableCommon[20], tableCommon[21], tableCommon[22], tableCommon[23], tableCommon[24], tableCommon[25], tableCommon[26], tableCommon[27], tableCommon[28], tableCommon[29], tableCommon[30], tableCommon[31], tableCommon[32], tableCommon[33], tableCommon[34], tableCommon[35], tableCommon[36], tableCommon[37], tableCommon[38], tableCommon[39], tableCommon[40], tableCommon[41], tableCommon[42], 0xF7})
    	    
        	panel:sendMidiMessageNow(commonSysex)
    #117737
    dnaldoogdnaldoog
    Participant
    • Topics: 3
    • Replies: 372
    • Total: 375
    • ★★

    Very nice!

Viewing 18 posts - 1 through 18 (of 18 total)
  • You must be logged in to reply to this topic.
There is currently 0 users and 26 guests online
No users are currently active
Forum Statistics
Threads: 2,393, Posts: 16,740, Members: 59,208
Most users ever online was 12 on January 22, 2019 3:47 pm
Do NOT follow this link or you will be banned from the site!