soundvision/UnityProject/Assets/Scenes/Examples/Example1/script/PdBackend.cs
2019-09-25 22:01:13 +02:00

33 lines
No EOL
855 B
C#

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();
}
}
}