public void Receive(string sendName, SymbolReceiveCallback symbolReceiver, bool asynchronous = false) { if (!sendNameSymbolReceiverDict.ContainsKey(sendName)) { LibPD.Subscribe(sendName); sendNameSymbolReceiverDict[sendName] = new List <PureDataSymbolReceiver>(); } sendNameSymbolReceiverDict[sendName].Add(new PureDataSymbolReceiver(sendName, symbolReceiver, asynchronous, pureData)); }
public void Release(SymbolReceiveCallback symbolCallback) { foreach (List <PureDataSymbolReceiver> symbolReceivers in sendNameSymbolReceiverDict.Values) { for (int i = symbolReceivers.Count - 1; i >= 0; i--) { if (symbolReceivers[i].symbolReceiver == symbolCallback) { Release(symbolReceivers[i]); } } } }
/// <summary> /// Unsubscribes a delegate so that it stops receiving symbols from Pure Data. /// </summary> /// <param name="symbolReceiver">The subscribed delegate that will stop receiving symbols.</param> public static void Release(SymbolReceiveCallback symbolReceiver) { instance.communicator.Release(symbolReceiver); }
/// <summary> /// Subscribes a delegate so that it receives symbols from all <c>[send <paramref name="sendName"/>]</c> in Pure Data. /// </summary> /// <param name="sendName">The name of the sender from which the symbols will be received.</param> /// <param name="symbolReceiver">The delegate that will receive the symbols.</param> /// <param name="asynchronous">If true, the symbols will be received as soon as they are sent by Pure Data, otherwise they will be received on the next Unity Update, FixedUpdate or LateUpdate.</param> public static void Receive(string sendName, SymbolReceiveCallback symbolReceiver, bool asynchronous = false) { instance.communicator.Receive(sendName, symbolReceiver, asynchronous); }
public PureDataSymbolReceiver(string sendName, SymbolReceiveCallback symbolReceiver, bool asynchronous, PureData pureData) : base(sendName, asynchronous, pureData) { this.symbolReceiver = symbolReceiver; }
public PureDataSymbolReceiver(string sendName, SymbolReceiveCallback symbolReceiver, bool asynchronous, PureData pureData) : base(sendName, asynchronous, pureData) { this.symbolReceiver = symbolReceiver; }