Cabbage Logo
Back to Cabbage Site

Presets not updating modmatrix

Hi!

I am using the modmatrix opcode to make a plugin to control other vsts.

For some reason, the table doesnt update properly when I load presets.
Both using Reaper presets and the cabbage preset system dont update the table. One value it can handle, but somehow more just doesnt work?
Any ideas?
I’ve been trying different things all day yesterday with no luck.

Here is the full csd file:
https://codeberg.org/mayaengel/master-thesis/src/branch/main/ModMatrix/ModMatrixCabbage.csd#
Here is the snippet that likely is causing the problem:

  1. instr ModMatrix

  2. ``

  3. prints "ModMatrix initialised"

  4. ``

  5. kSpeed chnget "Speed"

  6. ; printks2 "kSpeed %f\n", kSpeed

  7. #include "output.inc"

  8. OSCsend kwhen, "127.0.0.1", 999, "SpeedOut", "f", kSpeed

  9. ``

  10. cabbageSetValue "VolumeOut", kVolumeOut

  11. ``

  12. if kSpeed > 0 then

  13. OSCsend kwhen, "127.0.0.1", 999, "VolumeOut", "f", kVolumeOut

  14. else

  15. OSCsend kwhen, "127.0.0.1", 999, "VolumeOut", "f", 0

  16. endif

  17. ``

  18. ;velocity of input

  19. ;check the velocity of the input of the featexmod

  20. ;if it is bigger than 0, sound is on (tho as a slider????)

  21. ``

  22. SCoeffs[] cabbageGetWidgetChannels "_type(\"coeff\")"

  23. ``

  24. kIndex init 0

  25. ``

  26. kIndex, kTrig cabbageChanged SCoeffs

  27. ``

  28. SUpdatedChannel, kTrig cabbageChanged SCoeffs

  29. ``

  30. if kTrig == 1 then

  31. kValue cabbageGetValue SUpdatedChannel

  32. tablew kValue, kIndex, giModScale

  33. ftprint giModScale, -1

  34. endif

  35. ; ;for each channel in SCoeffs

  36. ; ;kValue cabbageGetValue SChannel

  37. ; ;tablew kValue, kIndex, giModScale

  38. ; kCount init 0

  39. ; kUpdateValue init 0

  40. ``

  41. kCount init 0

  42. ``

  43. while kCount < lenarray(SCoeffs) do

  44. prints SCoeffs[kCount]

  45. kUpdateValue cabbageGetValue SCoeffs[kCount]

  46. printk2 kUpdateValue

  47. tablew kUpdateValue, kIndex, giModScale

  48. printk2 kCount

  49. kCount += 1

  50. od

  51. ``

  52. ``

  53. cabbageSet kTrig, "label1", sprintfk("text(\"Last updated widget: %s - Index:%d\")", SUpdatedChannel, kIndex)

  54. ftprint giModScale

  55. endin

Sorry, i’ve never used that opcode, and can’t follow the code you posted as I’m not really sure what you’re trying to do. Can you produce a simple, extremely minimal csd file that illustates the problem?

haha, my bad, should have been a bit more clear. Symptom of staring at this code for so long.

Here is a simple version of the ModMatrix instrument
ModMatrixCabbageSimple.csd (22.3 KB)

So: when the I update the UI, it writes to the table as expected. When I load a preset, either in cabbage or in Reaper, the UI updates, but the table does not.

Hope that’s a bit clearer <3 :slight_smile:

Can you prepare a minimal example, this is still far too complex. As you know, Cabbage doesn’t save tables, but the fact that the UI is updating correctly means something is failing to trigger the table to write. The cabbage get value opcodes have an option trigger on i-pass parameter:

kValue [, kTrig] **cabbageGetValue** SChannel[, iTriggerOnPerfPass]
SValue [, kTrig] **cabbageGetValue** SChannel[, iTriggerOnPerfPass]

Can you try enabling that and seeing if that makes a difference?

kValue cabbageGetValue SCoeffs[kIndex], 1

Is that what you mean? When I write the code like that I get an error saying;

error: Unable to find opcode entry for ‘cabbageGetValue’ with matching argument types:

Found: k cabbageGetValue Sc
Line: 373

I also just now tried

kIndex, kTrig cabbageChanged SCoeffs, 0, 3

but then the table doesnt update when I update the UI.

What version of Cabbage are you using? Have you download the latest build from Azure DevOps?

the latest from the website, should I get the latest from azure devops? I’ve never downloaded from there before. Am on Windows

Yes please, you can grab them from here:
https://dev.azure.com/rorywalsh/cabbage/_build/results?buildId=2800&view=artifacts&pathAsName=false&type=publishedArtifacts
There are 3 dots on the right when you hover over the Installers button, you can grab the installers there. Hopefully this will make a difference :+1:

1 Like