Home › Forums › General › Programming › how to output a table into console or uiLabel
Tagged: display console output;
- This topic has 21 replies, 4 voices, and was last updated 6 years, 7 months ago by human fly.
-
AuthorPosts
-
August 16, 2017 at 1:57 pm #72728
getData() and getLuaData() are the same
Look at the bottom of https://sourceforge.net/p/ctrlrv4/code/HEAD/tree/nightly/Source/MIDI/CtrlrMidiMessage.cpp
They both point to getData()It is easy to assemble MemoryBlocks!
Use the append() function
Look for MemoryBlocks functions at https://sourceforge.net/p/ctrlrv4/code/HEAD/tree/nightly/Source/Lua/JuceClasses/LMemoryBlock.cpp and at https://www.juce.com/doc/group__juce__core-memory#classMemoryBlockFull Juce API (click on a letter to find an object) is at https://www.juce.com/doc/classes
August 19, 2017 at 1:03 pm #72750@enzo: you said to post the getPanelData thing i’m using.
it’s pretty much what goodweather and Possemo suggested,
and i still need to knock it into shape, but it’s headed
in the right direction:
(no idea how this is going to display here…)getToneDataFromPanel = function(mod, value) -- This variable stops index issues during panel bootup if panel:getRestoreState() == true or panel:getProgramState() == true then return end -- Create a table to store all patch values with corresponding bytes values ToneDataValuesTable = {} -- Retrieving Modulators Values console("Retreiving Modulators Values") -- byte (1) to (3) used for message prefix ToneDataValuesTable[1] = "f0" -- prefix of sysex file ToneDataValuesTable[2] = "41" -- roland manufacturer id ToneDataValuesTable[3] = "10" -- model?//basic midich?// ToneDataValuesTable[4] = "16" -- device id?// ToneDataValuesTable[5] = "12" -- ??mode?// ToneDataValuesTable[6] = "04" -- part1 tone temp address 1st byte ToneDataValuesTable[7] = "00" -- address 2nd byte-- address 3rd byte?// -- Common parameters///////////////////////////////////////////////////////// -- Retrieving Patch Name ToneName = L(panel:getModulatorByName("lcd_ToneName"):getComponent():getProperty("uiLabelText")) console("Retreiving Tone name from LCD Text : "..ToneName) -- Store each character in variable and convert it from ASCII to numerical code character1 = string.byte(ToneName,1) character2 = string.byte(ToneName,2) character3 = string.byte(ToneName,3) character4 = string.byte(ToneName,4) character5 = string.byte(ToneName,5) character6 = string.byte(ToneName,6) character7 = string.byte(ToneName,7) character8 = string.byte(ToneName,8) character9 = string.byte(ToneName,9) character10 = string.byte(ToneName,10) -- Check for empty characters and put each character value in PatchDataValuesTable -- with corresponding byte number//renumber table here//do correct table numbers// if character1 == nil then character1 = "32" end ToneDataValuesTable[8] = string.format("%.2x", character1) if character2 == nil then character2 = "32" end ToneDataValuesTable[9] = string.format("%.2x", character2) if character3 == nil then character3 = "32" end ToneDataValuesTable[10] = string.format("%.2x", character3) if character4 == nil then character4 = "32" end ToneDataValuesTable[11] = string.format("%.2x", character4) if character5 == nil then character5 = "32" end ToneDataValuesTable[12] = string.format("%.2x", character5) if character6 == nil then character6 = "32" end ToneDataValuesTable[13] = string.format("%.2x", character6) if character7 == nil then character7 = "32" end ToneDataValuesTable[14] = string.format("%.2x", character7) if character8 == nil then character8 = "32" end ToneDataValuesTable[15] = string.format("%.2x", character8) if character9 == nil then character9 = "32" end ToneDataValuesTable[16] = string.format("%.2x", character9) if character10 == nil then character10 = "32" end ToneDataValuesTable[17] = string.format("%.2x", character10) byte18 = panel:getModulatorByName("struct12_pt1"):getValue()-- 0A ToneDataValuesTable[18] = string.format("%.2x", byte18) byte19 = panel:getModulatorByName("struct34_pt1"):getValue()-- 0B ToneDataValuesTable[19] = string.format("%.2x", byte19) --etc.../////////////////////////////: byte256 = panel:getModulatorByName("tvaL3_p4pt1"):getValue()-- 46 ToneDataValuesTable[256] = string.format("%.2x", byte256) byte257 = panel:getModulatorByName("tvaSusL4_p4pt1"):getValue()-- 47;vst/78 ToneDataValuesTable[257] = string.format("%.2x", byte257) -- end of sysex ToneDataValuesTable[258] = "f7" -- suffix of sysex file console ("All Patch Data in Table") -- concatenate table into one big string DatasConcat = table.concat(ToneDataValuesTable, " ", 1, 258) --console ("DatasConcat : "..DatasConcat) --make a memory block from the big string memB = MemoryBlock(DatasConcat) -- send it to synth --panel:sendMidiMessageNow(CtrlrMidiMessage(MemB)) console("memBlock :"..memB:toHexString(1)) panel:getComponent("label_toneData"):setPropertyString("uiLabelText",""..memB:toHexString(1)) end
my table isn’t correct yet, wrong numbering and entries for my thing.
it’s the bit at the end -
AuthorPosts
- The forum ‘Programming’ is closed to new topics and replies.