private void Awake() { if (emg == null) { Debug.Log("StaticEMG: Awake: Created EMG"); emg = new EMGReader(debugMode); } if (instance != null && instance != this) { Destroy(this.gameObject); } else { instance = this; DontDestroyOnLoad(this.gameObject); } }
public void Setup() { if (!useFile) { reader = new EMGSerialReader(portName, maxQueueSize); } else { FileStream stream; try { stream = File.OpenRead(Application.dataPath + "/" + filePath); } catch (Exception e) { Debug.LogError("EMGManager: Unable to read file: " + e); return; } EMGFileReader fileReader = new EMGFileReader(stream, maxQueueSize); fileReader.EnableFileLoop(); reader = fileReader; } processor = new EMGProcessor(reader); }