Replies: 8 comments 67 replies
-
Slider just have mouse over (triggering a load of messages every 5ms), click and double click. Let us know if this is a solution for you |
Beta Was this translation helpful? Give feedback.
-
I tried to find a way to access mouseUp but to no avail. I found a way to do it with timers - it seems to work well. At 800ms delay if you go from 0-127 I think it sends out only one interim MIDI message before landing on and sending 127. If you increase the delay, there is no interim value sent, but it feels slow, so I suggest playing around with that variable -- -- Called when a modulator value changes -- @mod http://ctrlr.org/api/class_ctrlr_modulator.html -- @value new numeric value of the modulator -- emulateMouseUp = function(--[[ CtrlrModulator --]] mod --[[ number --]], value --[[ number --]], source) globvalue = value -- picked up in Timer Callback sysexnumber = tonumber(mod:getProperty("modulatorCustomIndex")) or 0 -- keep global local timerDelay = 800 -- experiment with this value if not timer:isTimerRunning(5) then timer:setCallback(6, TimerCallback) -- sends the MIDI timer:startTimer(6, timerDelay) -- Timer Id n ms timer:setCallback(5, TimerCallback) -- blocks timer 6 until cleared timer:startTimer(5, timerDelay) -- Timer Id n ms end end TimerCallback = function(timerId) if timerId == 5 then -- actually nothing to do here elseif timerId == 6 then local message={240, 0, sysexnumber, globvalue, 247} panel:sendMidiMessageNow(CtrlrMidiMessage(message)) panel:getLabelComponent("debug"):setText(MemoryBlock(message):toHexString(1):upper()) timer:stopTimer(5) timer:stopTimer(timerId) end end -- f |
Beta Was this translation helpful? Give feedback.
-
That’s great that it is working for you. I wonder if there isn’t some way of doing it? I tried all sorts of strange incantations that looked wrong and were. the @Tedjuh has a knack of sussing these things out. Found this post but was unresolved. |
Beta Was this translation helpful? Give feedback.
-
Wha? Who me? Oh, where to start? Most of what is said above is true. It comes down to the fact that you don't have an option to attach a mouseUp to the Slider you want. A while back I had some success calling the properties of a slider by adding it to the function statements as in "mouseUp = function(comp, event, slider)". The last "slider" could have been uiSlider, CtrlrSlider, or getOwnedSlider or just slider. I can't remember exactly. And I can't seem to find the panel between my 1000 test panels. The addMouseListener might work but I think it is used to differentiate the mouseclick whether it was on the slider or the label part of the component, not to add a mouseUp. Although the mouselistener detects any mouseclick. -- Sorry, The following statement is "not" true In the meantime. Would it work for you, Bijlevel, if you could use a left or a right click on the slider? The left click is to set the correct value, right click to send the value to the synth? |
Beta Was this translation helpful? Give feedback.
-
Actually, this was discussed here previously: In that post I came up with a solution where there is a |
Beta Was this translation helpful? Give feedback.
-
Hi, |
Beta Was this translation helpful? Give feedback.
-
Ok, the steps to take: Open the Ctrlr.jucer file in the Projucer. Then open your IDE. In CtrlrIDs.h : In CtrlrIDs.xml : In CtrlrSlider.cpp : In CtrlrSlider.cpp:
This was only possible because: Now save it all in your IDE, close the IDE and save the project in the Projucer. I noticed I had to close the Projucer and reopen it, open the IDE again to do a rebuild/ build of the Ctrlr_Sharedcode and a rebuild/ build of the Ctrlr_StandalonePlugin for it to show up properly. How to compile this with CMAKE? Because the Projucer way is getting kind of tedious. |
Beta Was this translation helpful? Give feedback.
-
Yes you are right, I forgot them in the list I'll edit my post to add them. Xcode will give warnings anyway if it's forgotten. As a side note, there's no need to add the mouse events in both the sliders/button individual .cpp, it should work only with the extra function in CtrlrComponent.cpp I recommand adding this NotificationOnlyOnRelease in the Component Generic part of CtrlrComponent.cpp so that you don't have to add it in every slider type, buttons etc When I added the functions in the different sliders .cpp (CtrlrFixedImageSlider.cpp, CtrlrFixedSlider.cpp etc) it was because there was already an override applied for the "slider spring" function, so it was required in this particular case to update it there too. But it's not required if the individual component don't already have a specific mouse event in their own .cpp |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I want to send MIDI (a value change of a parameter) after a mouse up event on a slider, because a drag mouse event, which sounds the way to go, generates too many MIDI events. The device can keep up (so far) with these events, but it takes too long to finish and I only need the last send MIDI message. When I look at the generic slider component mouse properties it seems that a mouse up event is not supported:
but I did a what() call for a slider and this was the result for specific mouse related functions for a slider:
mouseExit: function
mouseMove: function
mouseDown: function
mouseEnter: function
isMouseOver: function
removeMouseListener: function
isMouseButtonDown: function
mouseDrag: function
getInterceptsMouseClicks: function
getMouseXYRelative: function
mouseUp: function
This is for version 5.6.23, which I use at the moment. So it seems that one can detect a mouseUp event on a slider. Even if this is not true, than it might be possible to use "getMouseXYRelative" to know where a mouse pointer is and act accordingly.
Sorry for this elaborate post, but I hope you wizzards can confirm these mouse related functions do indeed exists for a slider, so I don't waist a lot of time trying to write a method that detects for instance a mouseUp event on a slider.
(I know about other rather complicated methods to achieve the same results.)
Beta Was this translation helpful? Give feedback.
All reactions