Cabbage Logo
Back to Cabbage Site

Bug with OSC?

I am having problems when I use OSClisten in Cabbage. It works well when running the code after having opened Cabbage fresh, but the second time I try to run/save it, it is silent. Also, it often complaints when it is starting that the listener can’t be started on the chosen port. It looks like Cabbage isn’t closing off the OSC processes when it is not in running mode. Thus, I have to close Cabbage each time I want to run my code, which is naturally slowing the workflow considerably.

Below is some very basic code that should demonstrate the problem, that is, if it can be reproduced. I’m on OSX 10.14.6 with Cabbage 2.8.0 (but was the same on 2.8.10).

Best, Andreas

form caption("Untitled") size(400, 300), guiMode("queue") pluginId("def1") rslider bounds(296, 162, 100, 100), channel("gain"), range(0, 1, 0, 1, .01), text("Gain"), trackerColour("lime"), outlineColour(0, 0, 0, 50), textColour("black") -n -d -+rtmidi=NULL -M0 -m0d ; Initialize the global variables. ksmps = 32 nchnls = 2 0dbfs = 1

giPhys OSCinit 9010

instr 1
kGain cabbageGetValue “gain”
kans, kdata[] OSClisten giPhys, “/test”, “fff”

a1 oscil .1, 220

outs a1kGain, a1kGain

;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]

As far as I can tell it is Csound that is not closing its ports. @Oeyvind has used OSC extensively, I wonder how he got around this issue. I’ve seen it pop up before.

Yes, I was thinking something similar. But this doesn’t happen when running csound in other contexts, so I though it was related to how Cabbage exited csound.
But anyway, I will ask Øyvind about it :smiley:

Yes, when Csound exists it seems to be able to free up this resource, yet when called through the API there seems to be some problems. I think @Oeyvind and I came across this before. Let me know what he says. I’m curious to see if there is a fix.

Ah, Yes I remember this happened… but I do not remember the exact details.
My best guess is that perhaps using Csound in a reentrant manner might cause the hiccup with (not) closing the ports. One thing to try might be to export your csd to VST, load it in Reaper and use that as the way to run it. Then it is easier to reaload the project containing the VST to update the plugins if you have edited (Alt+f+r shortcut in Reaper reloads the last opened project, which is quite a snappy way to do it). You can also use the autoUpdate() attribute to the form widget to enable Cabbe to reload the plugin whenever the source csd file has changed on disk (but perhaps that method will have the same reentrancy problem as when running directly in Cabbage).
I do remember at one point I was having the problem of not closing network ports when running as a VST, but I think that was a bug in the opcode that was later fixed. If you have the same problem when running as a VST, then please send me the offending csd and I will test here.

1 Like