soundvision/UnityProject/Assets/PdBackend/PdBackend.cs
2019-09-28 12:53:22 +02:00

35 lines
No EOL
865 B
C#

using System.Diagnostics;
using UnityEngine;
namespace cylvester
{
public class PdBackend : MonoBehaviour
{
[SerializeField] string mainPatch;
[SerializeField] int inchannels = 2;
private Process pdProcess_;
void Start()
{
pdProcess_ = new Process();
pdProcess_.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
pdProcess_.StartInfo.UseShellExecute = true;
pdProcess_.StartInfo.FileName = Application.streamingAssetsPath + "/pd/win/pd.com";
var path = Application.streamingAssetsPath + "/pd/patch/" + mainPatch;
pdProcess_.StartInfo.Arguments = "-nogui -rt -inchannels " + inchannels + " " + path;
pdProcess_.Start();
}
private void OnDestroy()
{
pdProcess_.Kill();
}
}
}