soundvision/UnityProject/Assets/Scenes/Examples/Example1/script/PdBackend.cs

33 lines
855 B
C#
Raw Normal View History

2019-09-25 20:01:13 +00:00
using System.Diagnostics;
using UnityEngine;
namespace cylvester
{
public class PdBackend : MonoBehaviour
{
[SerializeField] string mainPatch;
[SerializeField] int inchannels = 2;
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();
}
}
}