Home › Forums › Development › Problems with Panel Data Request as Restricted Instance
Tagged: Opening Panel, request
- This topic has 17 replies, 3 voices, and was last updated 3 years, 11 months ago by dnaldoog.
-
AuthorPosts
-
March 10, 2020 at 8:20 pm #117345
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
March 10, 2020 at 9:46 pm #117347Hi!
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.
March 12, 2020 at 9:27 am #117348Hello 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!
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 meI 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…
March 14, 2020 at 11:12 am #117391Well, 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.
March 16, 2020 at 5:08 am #117400Hello 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!
March 16, 2020 at 9:33 am #117401Hi lecleto, I think your checksums are all wrong. That could be one problem.
I have Roland checksum code in lua if you want.
March 16, 2020 at 6:43 pm #117407Hello 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.
March 16, 2020 at 8:24 pm #117408Can you please share your panel so I can have a more detailed look?
The problem must lie somewhere else.
Which DAW are you using?March 17, 2020 at 7:05 pm #117417Hello 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=false
ong>
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:
March 17, 2020 at 8:46 pm #117418I 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!
March 17, 2020 at 11:06 pm #117428Thank 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 = falseJust to understand better.
Thanks!
March 17, 2020 at 11:44 pm #117431Great 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()
March 18, 2020 at 12:49 am #117436Yeah 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!March 18, 2020 at 8:29 am #117439Here’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:
:)
April 5, 2020 at 7:37 am #117693Hello 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 years, 11 months ago by lecleto.
April 5, 2020 at 8:11 am #117695Hi 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!
April 8, 2020 at 1:41 am #117735Hello 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)
April 8, 2020 at 1:46 am #117737Very nice!
-
AuthorPosts
- The forum ‘Development’ is closed to new topics and replies.