Hi everyone,
does anyone know how to use pd~ to run a subpatch in another thread?
The help is not much of a help. My subpatch has 4 inlets, 2 inlets~ and 2 outlets~
thank you in advance!
pure data in multicore
Hi everyone,
does anyone know how to use pd~ to run a subpatch in another thread?
The help is not much of a help. My subpatch has 4 inlets, 2 inlets~ and 2 outlets~
thank you in advance!
@Spyros The [inlet~]s and [outlet~]s in your subpatch have to be converted to 2 channel [adc~] and [dac~] objects. Furthermore I don't think you get regular [inlet]s in the subpatch--those have to be converted to receives and then you prepend the messages for each inlet with the name of the new corresponding receive.
Open the help for [pd~], start DSP, then click on [pd~ start pd~-subprocess.pd(. You should see the subprocess patch open in a separate instance of Pd, and then you can use the controls in the main [pd~] helpfile to see how it works.
Edit: to "convert" an existing abstraction you can simply wrap it in another abstraction.
@jameslo thank you very much for your response!
thank you again @jameslo
@Spyros said:
- In the abstraction I replaced all the inlets to [receive] and [send] from the main, the [inlet~]s to [receive~] and [send~] from the main and the [outlet~] to [dac~]
Almost right. You convert the inlets to [receive] but in main you don't [send] to them, you send a message to the left-most inlet of [pd~] prefixed with the name of the receive. So if you originally had an inlet that accepted the message [go bears( and converted that to a [receive cheers], you would send the message [cheers go bears( to the left-most inlet of [pd~].
Similarly, you can't [send~] in main to a [receive~] in the subprocess patch. In the subprocess patch you replace all [inlet~] with [adc~] and in main you configure [pd~] ninsig to match the number of adc~ channels. Those channels become inlet~s on the [pd~] object itself.
- in the main I created [pd~] and I am sending a message <pd~ start pd~-button.pd> calling the abstraction button.pd. But I get an error: "pd~-button.pd: can't open" (in a separate instance of Pd). The weird thing is that when I go to help of [pd~] and click on the message <pd~ start pd~-subprocess.pd> I don't get the error when I copy and past the help in my main.pd I get an error: "pd~-subprocess.pd: can't open".
The message should contain the name of your abstraction, "button.pd" not "pd~-button.pd". In the help example, the name of the subprocess patch has that "pd~-" prefix, but that's just how they chose to name it.
- In the button abstraction I have more abstractions. Will they run in the new separate instance of Pd as well?
Yes, provided the Pd subprocess can find them. That's what failed in 2)--you copied the main patch in help but didn't move the subprocess patch to your local directory.
Here's another example you can study: two subprocesses.zip
@jameslo ace! you are a star. thank you so much for the detailed replay!
Oops! Looks like something went wrong!