Hi all, I’m using OSCdefs to trigger different functions based on incoming messages from another process.
The problem is, the OSCdefs are executed twice per incoming message, resulting in some memory leaks due to the same synth being instantiated twice, under the same name, almost simultaneously.
To make things worse, this only happens sometimes.
Below is the console output with OSC tracing enabled. Debug messages starting with OSC-
are printed when the respective OSCdef gets called, and right before calling the actual function, while the rest are printed when the function finishes evaluating (which is asynchronous for functions like loadSynthBuffers
or setSynthOrder
).
DEBUG: OSC-setSession done, t = 62768.9605786
DEBUG: setSession: FiniteMode done, t = 62768.9605786
DEBUG: OSC-setSession done, t = 62768.9605786
DEBUG: setSession: FiniteMode done, t = 62768.9605786
OSC Message Received:
time: 62768.9605786
address: a NetAddr(127.0.0.1, 65411)
recvPort: 57121
msg: [ /TimeLines/setSession, FiniteMode, s1_fm ]
DEBUG: OSC-setWindowDur done, t = 62768.9605786
DEBUG: setWindowDur done, t = 62768.9605786
DEBUG: OSC-setWindowDur done, t = 62768.9605786
DEBUG: setWindowDur done, t = 62768.9605786
OSC Message Received:
time: 62768.9605786
address: a NetAddr(127.0.0.1, 65411)
recvPort: 57121
msg: [ /TimeLines/setWindowDur, 1.0 ]
DEBUG: OSC-loadSynthBuffers done, t = 62768.9806922
DEBUG: OSC-loadSynthBuffers done, t = 62768.9806922
OSC Message Received:
time: 62768.9806922
address: a NetAddr(127.0.0.1, 65411)
recvPort: 57121
msg: [ /TimeLines/loadSynthBuffers, C:\Users\Carl\AppData\Local\Temp\TimeLines\buffers\s1_fm_amp.w64, C:\Users\Carl\AppData\Local\Temp\TimeLines\buffers\s1_fm_freq.w64, C:\Users\Carl\AppData\Local\Temp\TimeLines\buffers\s1_fm_ratio.w64, C:\Users\Carl\AppData\Local\Temp\TimeLines\buffers\s1_fm_index.w64, C:\Users\Carl\AppData\Local\Temp\TimeLines\buffers\s1_fm_pan.w64 ]
DEBUG: OSC-setSynthOrder done, t = 62768.9842005
DEBUG: OSC-setSynthOrder done, t = 62768.9842005
OSC Message Received:
time: 62768.9842005
address: a NetAddr(127.0.0.1, 65411)
recvPort: 57121
msg: [ /TimeLines/setSynthOrder ]
DEBUG: OSC-setPatches done, t = 62768.9842005
DEBUG: OSC-setPatches done, t = 62768.9842005
OSC Message Received:
time: 62768.9842005
address: a NetAddr(127.0.0.1, 65411)
recvPort: 57121
msg: [ /TimeLines/setPatches ]
DEBUG: OSC-setMute done, t = 62768.9842005
DEBUG: setMute: 0 done, t = 62768.9842005
DEBUG: OSC-setMute done, t = 62768.9842005
DEBUG: setMute: 0 done, t = 62768.9842005
OSC Message Received:
time: 62768.9842005
address: a NetAddr(127.0.0.1, 65411)
recvPort: 57121
msg: [ /TimeLines/setMute, 0 ]
DEBUG: loadSynthBuffers (s1_fm), added buffer amp done, t = 62769.0009476
DEBUG: loadSynthBuffers (s1_fm), added buffer freq done, t = 62769.0009476
DEBUG: loadSynthBuffers (s1_fm), added buffer ratio done, t = 62769.0009476
DEBUG: loadSynthBuffers (s1_fm), added buffer index done, t = 62769.0009476
DEBUG: loadSynthBuffers (s1_fm), added buffer pan done, t = 62769.0009476
DEBUG: loadSynthBuffers (s1_fm), added buffer amp done, t = 62769.0044526
DEBUG: loadSynthBuffers (s1_fm), added buffer freq done, t = 62769.0044526
DEBUG: loadSynthBuffers (s1_fm), added buffer ratio done, t = 62769.0044526
DEBUG: loadSynthBuffers (s1_fm), added buffer index done, t = 62769.0044526
DEBUG: loadSynthBuffers (s1_fm), added buffer pan done, t = 62769.0044526
DEBUG: loadSynthBuffers, server sync done, t = 62769.0044526
DEBUG: loadSynthBuffers, server sync done, t = 62769.0044526
DEBUG: setSynthOrder done, t = 62769.0044526
DEBUG: setSynthOrder done, t = 62769.0044526
DEBUG: setPatches done, t = 62769.0044526
DEBUG: setPatches done, t = 62769.0044526
DEBUG: loadSynthBuffers done, t = 62769.030667
DEBUG: loadSynthBuffers done, t = 62769.030667
DEBUG: freeOldBuffers done, t = 62769.1406032
As you can see, for every OSC message received there are two executions of the OSCdef, which results in loadSynthBuffers
loading the buffers and creating the synth twice.
Immediately after doing this I restarted the server and tried it again, and this time they executed only once. Here is the relevant SC code, if that helps.
What can be causing this?