Home › Forums › General › Programming › lua&demo panel question
- This topic has 25 replies, 3 voices, and was last updated 10 years, 5 months ago by zeoka.
-
AuthorPosts
-
June 17, 2013 at 7:14 pm #10058
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
June 17, 2013 at 7:36 pm #10059A 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.
June 17, 2013 at 8:12 pm #10061Thank 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 ?June 17, 2013 at 9:59 pm #10065If 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 10 years, 9 months ago by atom.
June 18, 2013 at 9:07 am #10095Hi
-“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 10 years, 9 months ago by zeoka.
June 18, 2013 at 9:21 am #100971. 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 ?
June 18, 2013 at 10:22 am #10098I’ 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 ?June 18, 2013 at 10:31 am #10099You can’t do that:
data=setModulatorValuesFromData(“vstIndex”,1,false) realData = data:getRange(8,20)
June 18, 2013 at 11:08 am #10100Yes thank you i will try later when i go home
October 13, 2013 at 8:01 pm #14136Hi
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 ?October 13, 2013 at 9:52 pm #14139-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 ?October 13, 2013 at 11:49 pm #14143Saw 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.October 14, 2013 at 10:37 am #14148I fixed that panel, i added an option and forgot to updat the DEMO, it should be woring in the SVN repo.
October 14, 2013 at 1:11 pm #14154Cool
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 ?October 14, 2013 at 2:13 pm #14155SVn 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/October 14, 2013 at 9:02 pm #14157Thank 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.October 15, 2013 at 11:55 am #14167But 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 ?
October 15, 2013 at 12:57 pm #14169This 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 10 years, 5 months ago by zeoka. Reason: RA specs
October 15, 2013 at 3:00 pm #14171The LCDLabel issue is there, i fixed it (the class was not registered in Lua). The new nightly build will containt the fix
October 15, 2013 at 4:07 pm #14189The 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. : )
Here is some noise I organised into an acceptable format:
https://soundcloud.com/lfo2vco/a-dark-crystal -
AuthorPosts
- The forum ‘Programming’ is closed to new topics and replies.