<value>:setRange question

Currently I use this code to toggle between the visibility of two controls:

function showVintage() 
  local value = parameterMap.get(deviceId,PT_NRPN,715) 
  if value==1 then 
    controls.get (170):setVisible (false) 
    controls.get (1):setVisible (true) 
  else 
    controls.get (170):setVisible (true) 
    controls.get (1):setVisible (false) 
  end
end

This works. But ideally I don’t want to use up two slots. Since the only functional difference between the two controls is their display and midi value ranges I tried this instead:

function showVintage() 
  local value = parameterMap.get(deviceId,PT_NRPN,715)
  local control = controls.get (1)
  local ctrlValue = control:getValue (“”)
  if value == 1 then
    ctrlValue:setRange (36, 122,122, true)
  else
    ctrlValue:setRange (0, 80,80, true) 
  end
end

But I have an error in here. Can anyone spot it? I could be revealing that I don’t fully understand what control.getValue(“”) is doing :slight_smile:

Try changing the :getValue line to this:

local ctrlValue = control:getValue (“value”)

The "value" is the default control value object name for normal single - value controls (like buttons and faders). Search for “<control>:getValue(valueId)” on the doc page

1 Like

What’s the error you are getting? (show also the code with its line numbers as well as the error with its line number please)
What type of control is control 1? What min and max MIDI value does it have?

Thanks. It is working as expected now. I need to read up more on the Lua console in the preset editor. Most of the time I get no information at all in the bottom section when I press the green go arrow in the top right hand corner. But sometimes I do get information.

This what I am currently getting. But this is only after I disconnected and then reconnected the E1 3 times.

16:40:02.586 lua: transport disabled
16:40:03.023 loadLua debug output:
16:40:03.024 ---- START ----
16:40:03.048 loadLuaModule: Lua extension file initialized: file=ctrlv2/slots/p000.lua
16:40:03.051 ----- END -----

The E1 seems to be communicating with the editor - I see the USB device and USB host blink when I send the preset. But most of the time that (logger?) section is empty. What is that indicating? Is there a setting I need to make to enable logging?

When I upload a preset in the making to the E1 , I always do that while being in the lua section, to get immediate error feedback in the lower section.

The above feedback says ‘no error’. It should always appear when you upload a preset successfully to E1.

Thanks. I do that too. It’s just that sometimes the logger doesn’t provide any info at all. I need to investigate why.

I think there are possibilities to enable or disable the logger function. But it’s been ages that I delved into it, so I forgot where/how to turn it on or off

1 Like

I actually think its more of a connectivity issue. Even though I successfully upload an edited preset to the E1 I get no info in the logger. But if I disconnect and reconnect the E1 from my Windows PC the next time I upload a preset I do get info in the logger. Not sure if anyone else has experienced that.

With the Mk II hardware, if I use the app.electra.dev (not sure I have that remembered correctly) web URL (versus the app.electra.one) then I get 2 windows when I choose a preset to edit and the main window allows me to see the console log and MIDI logs.

When I use the original app.electra.one I get a single window and no logging messages.

2 Likes

Oh. Very helpful. I did not know about app.electra.dev. Now I am seeing logged info that is not displayed in the app.electra.one log console. Thanks! I also see old versions of my presets I had deleted in the app.electra.one app but apparently they live on in the dev version.
Cheers

Right – much caution about switching between .dev and .one.

I’m sure @martin will chime in, but it’s easy to lose work if you forget and switch between the two URLs.

I’ve overwritten things and accidentally been editing an old version because my browser on different computers had different URLs cached. Also, earlier versions of the .dev didn’t allow you to clone or to delete presets, so again – much caution.