Hi Scott,

The way I handle multiple instances is to open new patches via C# and store
the dollar zero variable in a game object.

The PdAudioSource component can be attached to a prefab and you can
instantiated the prefab via C#. PdAudioSource also stores the dollar zero
variable of the associated patch, so you can directly send messages to a
particular instance by calling methods in PdAudioSource. However, all send
and receive objects in your patches need to start with a dollar zero (e.g.
[send $0-Frequency], [receive $0-isPlaying]).

For audio signals, all patches need to have appropriate [throw~ ] objects
(e.g. [throw~ out5] [throw~ out6]) in order to be heard. Audio signals from
all instances will go through the [catch~ ] object in pdManager.pd, which
is mapped to the Unity audio mixer. Getting audio input from Unity to libpd
is a little bit tricky in this case. If someone need audio input from
Unity, one might modify the OnAudioFilterRead method in PdStereo.cs.

My project isn't complete and I always welcome for suggestions or comments.

Best,
Wing
_______________________________________________
[email protected] mailing list
UNSUBSCRIBE and account-management -> 
https://lists.puredata.info/listinfo/pd-list

Reply via email to