The reason why I think this is that if I play two or three different Synths, then free them, the next Synth will try to register using an already used nodeID - ie if 1000 is registered then freed, then 1001 is registered then freed, then for some reason, the third one will try to register with 1001, as if the process hadn’t finished yet ?
Does that make sense? How could I either fix the code or debug this?
I am running SuperCollider 3.11.2 installed from apt on Ubuntu 22.04, and I also tried this on a dev-installed-from-source SC 3.14 on Ubuntu 22.04
Hi – one thing is that node IDs and bufnums are separate concepts, with separate allocators. A “bufnum not understood” error should not have anything to do with node IDs (and if the issue is node IDs, you’d see a “duplicate node ID” posting from the server).
Second thing is, the meaning of this error is that you’re calling .bufnum on something, and you’re expecting that thing to be a Buffer object, but for some reason it’s something else. (I’ll guess possibly nil.)
It would help a lot to see the entire error dump – all of it – the stack dump might look intimidating but it’s very important.
It’s pretty cut-and-dried here – you have some object reference somewhere that you’re expecting to be a Buffer, but instead it’s a Synth.
One possible way you might have gotten here is, if you have a synth that plays a buffer, you might have thought you could ask the synth which buffer it’s playing by using the bufnum method – but the Synth object doesn’t work like that. Synth is a thin layer over server nodes, “thin” meaning that it maintains relatively little state. It’s not really meant to be queried in that way.
That’s just a guess – you could be doing something totally different. In any case, check your .bufnum calls carefully and make sure the receiver really is a Buffer.
It works by luck, if your buffer has bufnum 0. If your buffer has a different bufnum, then it will stop working. So you should get in the habit of having a buffer number synth input, and supplying it in the synth argument list.
Without seeing your code, this is just an educated guess, but I’ll hazard that guess based on your post window output.
I guess that at some point in this sequence, you did b = Synth(...). From that point forward, the buffer object is no longer accessible through b. I could easily imagine doing “ok, my first synth is a so I’ll make my second synth b” but it’s important to remember that b was already busy and shouldn’t be given a new job. (Side note: “my first synth is s” causes a whole slew of trouble if you’re assuming later that s is the server! So SC will warn you about that if you try it.)