Cabbage Logo
Back to Cabbage Site

Erratic behavior of "MOUSE_X/Y" in Cabbage 2.6

Also cabbageSet is only working with kTrig in performance, maybe that’s intended?

Anyway, Mouse coordinates are all over the place, looking multiplied by a different up to 5 figure number on each run. Randomly on one or two runs they were right.
Here a script:

<Cabbage>
form caption("Untitled") size(400, 300), colour(58, 110, 182), pluginId("def1") guiMode("queue")
rslider bounds(296, 162, 100, 100), channel("gain"), range(0, 1, 0, 1, .001), text("Gain"), trackerColour("lime"), outlineColour(0, 0, 0, 50), textColour("black")
label bounds(10,10,300,15) text("init text") channel("label")

</Cabbage>
<CsoundSynthesizer>
<CsOptions>
-n -d -+rtmidi=NULL -M0 -m0d 
</CsOptions>
<CsInstruments>
; Initialize the global variables. 
ksmps = 32
nchnls = 2
0dbfs = 1


instr 1

kLeftClick      cabbageGet "MOUSE_DOWN_LEFT"    
kRightClick     cabbageGet "MOUSE_DOWN_RIGHT"
kMouseX         cabbageGet "MOUSE_X"            // those are some strange coordinates, sometimes right,
kMouseY         cabbageGet "MOUSE_Y"            // sometimes they looks like they are a multiplied by 10, sometimes by 37281 or 49819 or ....

if(changed(kLeftClick) == 1)then
    printks         "\n left click at x: %d | y: %d",0.1,kMouseX,kMouseY
    
    String          sprintfk "text(\" left click at x: %d | y: %d \")", kMouseX, kMouseY
    printks         "  -  format string: %s",0.1, String                    // CabbageSet
    cabbageSet      "label", String                                         // without kTrig works in init run, not in performance
endif

if(changed(kRightClick) == 1)then
    printks "\n reft click at x: %d | y: %d",0.1,kMouseX,kMouseY
    
    String          sprintfk "text(\" left click at x: %d | y: %d \")", kMouseX, kMouseY
    printks         "  -  format string: %s",0.1, String                    // // CabbageSet
    cabbageSet      1,"label", String                                       // with kTrig doesn't work in init run, works in performance
endif

endin

</CsInstruments>
<CsScore>
;causes Csound to run for about 7000 years...
f0 z
;starts instrument 1 and runs it for a week
i1 0 [60*60*24*7] 
</CsScore>
</CsoundSynthesizer>

Can you download the latest beta. This bug arrived in my inbox about 10 seconds are I published the last release :rage: It’s fixed now. I will wait till I catch a few more issues before doing a minor point release.

Ah, Great! Thanks! Will be in touch about the auth stuff…

1 Like