soundvision/UnityProject/Assets/PdBackend/PdBackend.cs

35 lines
865 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;
2019-09-28 10:53:22 +00:00
private Process pdProcess_;
2019-09-25 20:01:13 +00:00
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();
2019-09-28 10:53:22 +00:00
2019-09-25 20:01:13 +00:00
}
private void OnDestroy()
{
pdProcess_.Kill();
}
}
}