Home › Forums › General › Programming › basic help needed with formatting message of a button
- This topic has 7 replies, 4 voices, and was last updated 8 years, 8 months ago by goodweather.
-
AuthorPosts
-
July 18, 2015 at 8:48 pm #53004
Hi,
I’m not too good with programming techniques, nor am I particularly knowledgeable with LUA or other programming languages, but I started designing an editor for a SIEL DK700 and I struggle to solve an unfortunate difficulty.As far as I can tell, buttons only output consecutive values starting with 0 and going up to however many lines you enter in the “button values” box minus 1. Stop me here if I’m wrong.
I need to generate a sysex code that would translate in decimal values as :
first button position (first value) : 1
second button position (second value) : 2
third button position (third value) : 4Clicking on the button a fourth time would go back to the first value.
I cant come up with an arithmetic way to transform the “0, 1, 2” output into “1, 2, 4”. Has anybody any idea how to proceed – either via a mathematical expression or a programming technique?
I don’t know where else to ask so I hope someone here will be able to help… Thanks in advance to anybody willing to look into it.
July 18, 2015 at 10:24 pm #53006In the button values box, you can assign a value to each line:
0 = 1
1 = 2
2 = 4July 19, 2015 at 4:47 am #53021As Dasfaker is written it will output the correct values, but the display in the button will cycle through 0,1,2.
To make it cycle through 1,2,4 and output the correct values put this in the uiButtonContent Box
1=1
2=2
4=4or you could do something like
Lopass = 1
Hipass = 2
Bandpass = 4The expression before the equals sign is what is displayed. The value after the equals sign is what is output.
- This reply was modified 8 years, 9 months ago by Puppeteer.
The Puppeteer
http://godlike.com.auJuly 19, 2015 at 2:18 pm #53032thanks a lot for the input guys, for a moment i thought i was out of trouble… but i just tried it and it doesnt seem to work for me.
I haven’t said above that I do this in LUA :
a = panel:getModulatorByName(“Button”):getValue()and then include this value as a broader part of a sysex message. But it seems that the method with the equal signs in the button value box doesn’t change the “modulator value” field so it still produces a “0, 1, 2” output.
Any more ideas?
- This reply was modified 8 years, 9 months ago by prprp.
July 19, 2015 at 4:01 pm #53038In this case you need a = panel:getModulatorByName(“Button”):getValueMapped()
July 30, 2015 at 1:00 pm #53781Thx for your explanation Puppeteer (and dasfaker) ! I was also looking for this and was sure to find it in the forum 🙂
I’ll add your explanation in the user guide.
About that one, I’ll keep a post with a “released” version then I will create another post with “in dev” version so other people can write.
I started with some LUA programs…July 30, 2015 at 2:32 pm #53787I’ve started making notes for Chapter 3. Hopefully I’ll get the last bit of my panel out of the way tonight and can spend a little bit of time on chapter 3 shortly.
The Puppeteer
http://godlike.com.auAugust 1, 2015 at 7:14 pm #53916Hi again,
to come back on this topic it is worth adding some precision to what Puppeteer explained above…
There are 3 things to consider: the text that will be displayed, the value to test in the Lua code and the value that is send by Midi.- The text to display (you need to have Text position different than “none”) is what’s come on the left side of “=” sign
- The value sent by Midi is on the right side of the equal sign
- The value to test in your Lua code is the rank of each line starting by 0
On the Moog Sub37, there is a button that indicates the destination of the pitch modulation (Osc1+Osc2, Osc1, Osc2). CC is 88 and Midi values to send are 0, 43 and 85. The destination is indicated on the synth by 2 leds (1 and 2).
The Lua code is used to set the corresponding LEDs ON depending on each button press.So, for button values I have:
Osc1+Osc2=0
Osc1=43
Osc2=85
(I set Text position to top just for testing purposes, otherwise it is none.)In the Lua code I have:
function mod2OscSelect(modulator, modValue) -- console ("Value: " .. modValue) if modValue==0 then -- console ("Osc1+Osc2") panel:getComponent("ledMod2Osc1Pitch"):setValue(1,true) panel:getComponent("ledMod2Osc2Pitch"):setValue(1,true) end if modValue==1 then -- Send 43 to Midi -- console ("Osc1") panel:getComponent("ledMod2Osc1Pitch"):setValue(1,true) panel:getComponent("ledMod2Osc2Pitch"):setValue(0,true) end if modValue==2 then -- Send 85 to Midi -- console ("Osc2") panel:getComponent("ledMod2Osc1Pitch"):setValue(0,true) panel:getComponent("ledMod2Osc2Pitch"):setValue(1,true) end end
Checked on the panel and with the synth.
- This reply was modified 8 years, 8 months ago by goodweather.
-
AuthorPosts
- The forum ‘Programming’ is closed to new topics and replies.