Home › Forums › General › Using Ctrlr › Switch Bits Problem
- This topic has 5 replies, 3 voices, and was last updated 10 years, 6 months ago by msepsis.
-
AuthorPosts
-
August 28, 2013 at 1:02 am #12550
OK I’m probably being really dumb and just need someone to point out the obvious mistake. However I seem unable crack this one. I have two instances where bits select options in Comboboxes the first method works the second method doesn’t.
The first uses the last two bits thus (from KiwiTechnics manual):
000000yx x = Off/On (set = On) y = Auto/Manual (set = Auto)This is my method, it works fine:
byte = programData:getByte(59) bi = BigInteger(byte) CS = bi:getBitRangeAsInt(0,1) CM = bi:getBitRangeAsInt(1,1) if CS == 0 then panel:getModulatorByName("Chorus On/Off"):setValueMapped ((00), false) elseif CS == 1 then if CM == 1 then panel:getModulatorByName("Chorus On/Off"):setValueMapped ((01), false) elseif CM == 0 then panel:getModulatorByName("Chorus On/Off"):setValueMapped ((02), false) end
The second uses the last three bits thus (from KiwiTechnics manual):
00000yxw w = Gate (set = Gate – overrides x) x = Env 1/2 (set = Env2) y = LFO 1/2 (set = LFO2)This is my method, x and y seem to work fine however w does not work at all:
byte = programData:getByte(62) bi = BigInteger(byte) VS = bi:getBitRangeAsInt(0,1) VM = bi:getBitRangeAsInt(1,1) if VS == 1 then panel:getModulatorByName("VCA Mode"):setValueMapped ((00), false) elseif VS == 0 then if VM == 0 then panel:getModulatorByName("VCA Mode"):setValueMapped ((01), false) elseif VM == 1 then panel:getModulatorByName("VCA Mode"):setValueMapped ((02), false) panel:getModulatorByName("VCA LFO Mod Source"):setValueMapped(bi:getBitRangeAsInt(2,1), false) end
Here is some noise I organised into an acceptable format:
https://soundcloud.com/lfo2vco/a-dark-crystalAugust 28, 2013 at 5:24 pm #12592It’s your logic so i can’t really comment on that (i’d need to understand the whole program to understand this snippet).
What i can propose, ident your code (better tabulation), if you can use pastebin.com to show us the code, explain why are you doin (00) (01) (02) where normal integer values are used, is “w” from the manual the variable VS in your code ?
I recommend looking at the BigInteger (bi) when getting data to see what should happen and what is actualy happening
console (bi:toString(2,8))
August 28, 2013 at 6:13 pm #12596Hi Atom, yes the variable VS does refer to the “w” from the manual.
The (00)(01)(02) in the method refers to the list of comboValues in the combobox.
Update it seems that it is working! Your suggestion of checking the byte values in the console revelled that I was not getting the required byte back from the synth. Oddly this only affected one patch, the one I was using to test my script.
Indenting code… when to tab that is the question?
Thanks for your patience and assistance as always : )
- This reply was modified 10 years, 7 months ago by lfo2vco.
Here is some noise I organised into an acceptable format:
https://soundcloud.com/lfo2vco/a-dark-crystalSeptember 21, 2013 at 12:42 am #13423Indenting code… when to tab that is the question?
take your first example.. you’d want it to read something more like:
basically when you declare an “if” statement, the stuff after “then” should be indented. Then you back-tab when you want to close the “if” statement.. Especially in your example when you have embedded if statements it helps you understand what you’ve wrote and others understand when it comes time to help you out 🙂
Monstrum Media | Music, Sound & Software Design, Chicago / San Francisco listen
September 21, 2013 at 1:51 am #13425Thanks msepsis a clear explanation. Oh, and thanks again for your explanation to my post ‘Help with Sysex please’ that really helped my get my panel going.
By trial and error I am getting there. The panel now has a Save button that successfully dumps Sysex to the Kiwi-3P too! Almost done.
Here is some noise I organised into an acceptable format:
https://soundcloud.com/lfo2vco/a-dark-crystalSeptember 21, 2013 at 8:35 pm #13443no problem on the help 🙂 This thread actually helped me out with getting and assigning parameter values from a program dump from the synth.. now i need to figure out how to send those values from two different knobs that control two different parameters to one sysex message.
Monstrum Media | Music, Sound & Software Design, Chicago / San Francisco listen
-
AuthorPosts
- The forum ‘Using Ctrlr’ is closed to new topics and replies.