Re: Changing Images – what could be wrong in that LUA code

Home Forums General Programming Changing Images – what could be wrong in that LUA code Re: Changing Images – what could be wrong in that LUA code

#4459
Cramp
Participant
  • Topics: 11
  • Replies: 66
  • Total: 77
"atom":1sfscrfc wrote:
Can you see there are two "r" in the property name, also there is no such property as uiFixedImageSliderResource it’s always "uiImageSliderResource"[/quote:1sfscrfc]
Yes I noticed that. I used uiImageSliderResource property. But that didn’t help me

See the code –
1st button activates the single filter
[code:1sfscrfc]FilterSwitch = function(modulator, newValue)

— Images ON Status

MultiFilterTypeOn = "sixfold_selection_filter"
FilterDistSliderOn = "nord_led_pot_full"
SingleFilterTypeOn = "sixfold_selection_filter"
FilterSlopeTypeOn = "led_three_upward2"

— Images OFF Status

MultiFilterTypeOff = "sixfold_selection_filteroff"
FilterDistSliderOff = "nord_led_pot_full_off"
SingleFilterTypeOff = "sixfold_selection_filteroff"
FilterSlopeTypeOff = "led_three_upward_off"

— When click this know Filter mode changes to Multi

FilterMode = 0
if FilterMode == 0 then

— filterslope modulator
filter_slope_mod = panel:getModulatorByName("FilterSlope")

— Single Filter Type modulator
single_filter_mod = panel:getModulatorByName("FilterType")

— Multi Filter Type and Led Modulators
multi_filter_mod = panel:getModulatorByName("FilterEnvCtrl")

— Frequency2/Dist Slider modulator
freq_dist_mod = panel:getModulatorByName("FilterFreq2")

— This knob on click disables Multi Filter type that is why Filter Slope and Single Filter Type knobs
— need to be enabled. And MultiFilter knob plus Filter2 need to be disabled. Filter2 runs with CC 114

— ENABLING SINGLE FILTER
comp = filter_slope_mod:getComponent()
comp:setPropertyString ("uiImageButtonResource" , FilterSlopeTypeOn)

comp = single_filter_mod:getComponent()
comp:setPropertyString ("uiImageButtonResource" , SingleFilterTypeOn)

— DISABLING MULTI FILTER
comp = multi_filter_mod:getComponent()
comp:setPropertyString ("uiImageButtonResource" , MultiFilterTypeOff)

comp = freq_dist_mod:getComponent()
comp:setPropertyString ("uiImageSliderResource" , FilterDistSliderOff)


— Enabling Dist Slider if DIST LP (58) value is Selected on Filter Type and
— set MIDI CC 114 to Frequency2/Dist Slider modulator

if freq_dist_mod ~= nil then
comp = freq_dist_mod:getComponent()
if newValue == 5 then

comp:setPropertyString ("uiImageSliderResource" , FilterDistSliderOn)
filter_slope_mod:setModulatorValue(1, false, true, true)
else

comp:setPropertyString ("uiImageSliderResource" , FilterDistSliderOff)
filter_slope_mod:setModulatorValue(2, false, true, true)

end
end


— Disabling Filter Slope if BR (35) is Selected on Filter Type

if newValue == 3 then
z = filter_slope_mod:getComponent()
z:setPropertyString ("uiImageButtonResource" , "led_three_upward_off")
else
z = filter_slope_mod:getComponent()
z:setPropertyString ("uiImageButtonResource" , "led_three_upward2")

end


end

mod = panel:getModulatorByName("FilterFreq2")
if mod ~= nil then
midi = mod:getMidiMessage()
if midi ~= nil then
if newValue == 1 then
midi:setPropertyInt ("midiMessageCtrlrNumber", 59)
else
midi:setPropertyInt ("midiMessageCtrlrNumber", 114)
end
end
end
end[/code:1sfscrfc]
This button activates Multi Filter and disable visualuzation of Single filter
[code:1sfscrfc]FilterSwitch2 = function(modulator, newValue)

— Images ON Status

MultiFilterTypeOn = "sixfold_selection_filter"
FilterDistSliderOn = "nord_led_pot_full"
SingleFilterTypeOn = "sixfold_selection_filter"
FilterSlopeTypeOn = "led_three_upward2"

— Images OFF Status

MultiFilterTypeOff = "sixfold_selection_filteroff"
FilterDistSliderOff = "nord_led_pot_full_off"
SingleFilterTypeOff = "sixfold_selection_filteroff"
FilterSlopeTypeOff = "led_three_upward_off"

— When click this know Filter mode changes to Multi

FilterMode = 1

if FilterMode == 1 then

— filterslope modulator
filter_slope_mod = panel:getModulatorByName("FilterSlope")

— Single Filter Type modulator
single_filter_mod = panel:getModulatorByName("FilterType")

— Multi Filter Type and Led Modulators
multi_filter_mod = panel:getModulatorByName("FilterEnvCtrl")

— Frequency2/Dist Slider modulator
freq_dist_mod = panel:getModulatorByName("FilterFreq2")

— This knob on click enables Multi Filter type that is why Filter Slope and Single Filter Type knobs
— need to be disabled. And MultiFilter knob plus Filter2 need to be enabled. Filter2 runs with CC 59

— DISABLING SINGLE FILTER
comp = filter_slope_mod:getComponent()
comp:setPropertyString ("uiImageButtonResource" , FilterSlopeTypeOff)

comp = single_filter_mod:getComponent()
comp:setPropertyString ("uiImageButtonResource" , SingleFilterTypeOff)

— ENABLING MULTI FILTER
comp = multi_filter_mod:getComponent()
comp:setPropertyString ("uiImageButtonResource" , MultiFilterTypeOn)

comp = freq_dist_mod:getComponent()
comp:setPropertyString ("uiImageSliderResource" , FilterDistSliderOn)

end

mod = panel:getModulatorByName("FilterFreq2")
if mod ~= nil then
midi = mod:getMidiMessage()
if midi ~= nil then
if newValue == 1 then
midi:setPropertyInt ("midiMessageCtrlrNumber", 114)
else
midi:setPropertyInt ("midiMessageCtrlrNumber", 59)
end
end
end

end[/code:1sfscrfc]

I can’t get – this ImageResource of the "FilterFreq2" modulator is not changing when I requested via Script.

You see Image is not changing if I select the Image from the list
[img:1sfscrfc]http://dl.dropbox.com/u/4202790/slideroff.png[/img:1sfscrfc] should be OFF
[img:1sfscrfc]http://dl.dropbox.com/u/4202790/slideroon.png[/img:1sfscrfc] should be ON

The images located in C:Users$MYUSERNAMEAppDataRoamingCtrlrresources and both OFF and ON Images are ok

The XML file of Modulator (taken from Utility)
[code:1sfscrfc]<?xml version="1.0" encoding="UTF-8"?>

<modulator modulatorValueExpression="modulatorValue" modulatorValueExpressionReverse="midiValue"
modulatorIsStatic="0" modulatorGlobalVariable="-1" modulatorMuteOnStart="0"
modulatorExcludeFromSnapshot="0" modulatorLinkedToPanelProperty="– None"
modulatorLinkedToModulatorProperty="– None" modulatorLinkedToModulator="– None"
modulatorLinkedToModulatorSource="1" modulatorLinkedToComponent="0"
modulatorBaseValue="0" modulatorCustomIndex="0" modulatorCustomIndexGroup="0"
modulatorVstExported="1" luaModulatorValueChange="" modulatorMax="127"
modulatorValue="85" vstIndex="13" name="FilterFreq2" modulatorMin="0">
<midi midiMessageType="0" midiMessageChannelOverride="0" midiMessageChannel="1"
midiMessageCtrlrNumber="114" midiMessageCtrlrValue="127" midiMessageMultiList=""
midiMessageSysExFormula="F0 00 F7"/>
<component componentLabelPosition="top" componentLabelJustification="centred"
componentLabelHeight="14" componentLabelWidth="0" componentLabelVisible="0"
componentLabelAlwaysOnTop="0" componentSentBack="0" componentLabelColour="0xff000000"
componentLabelFont="&lt;Sans-Serif&gt;;12;0;0;0;0;1" componentVisibleName="FilterFreq1"
componentMouseCursor="1" componentGroupName="" componentSnapSize="8"
componentIsLocked="0" componentRadioGroupId="0" componentRadioGroupNotifyMidi="1"
componentVisibility="1" componentEffect="0" componentEffectRadius="0"
componentEffectColour="0xff000000" componentEffectOffsetX="0"
componentEffectOffsetY="0" componentEffectAlpha="0" uiImageSliderResource="nord_led_pot_full_off"
resourceImageWidth="80" resourceImageHeight="80" resourceImagePaintMode="8"
resourceImageOrientation="0" uiSliderStyle="RotaryVerticalDrag"
uiSliderMin="0" uiSliderMax="1" uiSliderInterval="1" uiSliderValueHeight="12"
uiSliderValuePosition="0" uiSliderValueWidth="64" uiSliderValueTextColour="ffffffff"
uiSliderValueBgColour="ffffff" uiSliderRotaryOutlineColour="0xff0000ff"
uiSliderRotaryFillColour="0xff0000ff" uiSliderThumbColour="0xffff0000"
uiSliderValueHighlightColour="0xff0000ff" uiSliderValueOutlineColour="0"
uiSliderTrackColour="0xff0f0f0f" uiFixedSliderContent="12Hz=0&#10;14Hz=1&#10;15Hz=2&#10;16Hz=3&#10;17Hz=4&#10;18Hz=5&#10;19Hz=6&#10;20Hz=7&#10;21Hz=8&#10;22Hz=9&#10;24Hz=10&#10;25Hz=11&#10;26Hz=12&#10;28Hz=13&#10;30Hz=14&#10;31Hz=15&#10;33Hz=16&#10;35Hz=17&#10;37Hz=18&#10;40Hz=19&#10;42Hz=20&#10;45Hz=21&#10;47Hz=22&#10;50Hz=23&#10;53Hz=24&#10;56Hz=25&#10;60Hz=26&#10;63Hz=27&#10;67Hz=28&#10;71Hz=29&#10;75Hz=30&#10;80Hz=31&#10;85Hz=32&#10;90Hz=33&#10;95Hz=34&#10;101Hz=35&#10;107Hz=36&#10;113Hz=37&#10;120Hz=38&#10;127Hz=39&#10;135Hz=40&#10;143Hz=41&#10;151Hz=42&#10;160Hz=43&#10;170Hz=44&#10;180Hz=45&#10;191Hz=46&#10;202Hz=47&#10;214Hz=48&#10;227Hz=49&#10;241Hz=50&#10;255Hz=51&#10;270Hz=52&#10;286Hz=53&#10;303Hz=54&#10;322Hz=55&#10;341Hz=56&#10;361Hz=57&#10;383Hz=58&#10;406Hz=59&#10;430Hz=60&#10;456Hz=61&#10;483Hz=62&#10;512Hz=63&#10;543Hz=64&#10;575Hz=65&#10;609Hz=66&#10;646Hz=67&#10;684Hz=68&#10;725Hz=69&#10;769Hz=70&#10;815Hz=71&#10;863Hz=72&#10;915Hz=73&#10;970Hz=74&#10;1028Hz=75&#10;1089Hz=76&#10;1155Hz=77&#10;1224Hz=78&#10;1297Hz=79&#10;1374Hz=80&#10;1457Hz=81&#10;1544Hz=82&#10;1636Hz=83&#10;1734Hz=84&#10;1838Hz=85&#10;1948Hz=86&#10;2064Hz=87&#10;2188Hz=88&#10;2319Hz=89&#10;2457Hz=90&#10;2604Hz=91&#10;2760Hz=92&#10;2925Hz=93&#10;3100Hz=94&#10;3286Hz=95&#10;3482Hz=96&#10;3690Hz=97&#10;3911Hz=98&#10;4145Hz=99&#10;4393Hz=100&#10;4656Hz=101&#10;4934Hz=102&#10;5230Hz=103&#10;5542Hz=104&#10;5874Hz=105&#10;6225Hz=106&#10;6598Hz=107&#10;6992Hz=108&#10;7411Hz=109&#10;7854Hz=110&#10;8324Hz=111&#10;8822Hz=112&#10;9350Hz=113&#10;9909Hz=114&#10;10502Hz=115&#10;11130Hz=116&#10;11796Hz=117&#10;12501Hz=118&#10;13249Hz=119&#10;14042Hz=120&#10;14882Hz=121&#10;15772Hz=122&#10;16715Hz=123&#10;17715Hz=124&#10;18775Hz=125&#10;19898Hz=126&#10;21000Hz=127"
uiSliderValueFont="&lt;Sans-Serif&gt;;12;1;0;0;0;1" uiSliderIncDecButtonColour="0xff0000ff"
uiSliderIncDecTextColour="0xffffffff" uiSliderValueTextJustification="centred"
uiSliderVelocitySensitivity="1" uiSliderVelocityThreshold="1"
uiSliderVelocityOffset="0" uiSliderVelocityMode="0" uiSliderVelocityModeKeyTrigger="1"
uiSliderSpringMode="0" uiSliderSpringValue="0" uiSliderMouseWheelInterval="1"
uiSliderPopupBubble="0" componentRectangle="822 311 56 56" componentSnapSizeAllow="0"
uiType="uiFixedImageSlider" componentLayerUid="f7e09d550e00000080d7220000000000"/>
</modulator>[/code:1sfscrfc]

Ctrlr