// Start is called before the first frame update void Start() { if (Application.platform == RuntimePlatform.OSXEditor || Application.platform == RuntimePlatform.OSXPlayer) { Debug.Log("You're running " + SystemInfo.operatingSystem + ". Aborting MonkeyLogicController.cs"); return; // LSL crashes OSX } // These need to be MonoBehavior so leave unchanged _resolver = gameObject.AddComponent <MonkeyLogicResolver>(); _trialInlet = gameObject.AddComponent <MonkeyLogicInlet>(); outlets = gameObject.AddComponent <MonkeyLogicOutlet>(); // Configure _trialInlet.Configure(_trialInletName, _trialInletType, _trialInletID, _resolver); trialOutlet = outlets.Configure(_trialOutletName, _trialOutletType, 1, liblsl.IRREGULAR_RATE, liblsl.channel_format_t.cf_string, _trialOutletID, GenerateXMLMetaData()); // add listener for Streams delegates _trialInlet.OnTrialParamReceived += ForwardTrialParam; _trialInlet.OnTrialDataReceived += ForwardTrialData; _trialInlet.OnPlaybackStartReceived += ForwardStartPlayback; _trialInlet.OnCalibrationReceived += ForwardEyecalibration; }
// Override the function in the ABaseInlet class: // returns an error if no stream is not found during initialization. // The resolver should still continuously resolve. //protected override void registerAndLookUpStream() { } // Instead of calling this in the start function, we call it here to pass the parameters of the // expected stream. public void Configure(string Name, string Type, string ID, MonkeyLogicResolver resolve) { StreamName = Name; StreamType = Type; UniqueID = ID; resolver = resolve; resolver.OnStreamFound += AStreamIsFound; resolver.OnStreamLost += AStreamGotLost; // now that the listeners are set, we can start the Resolver coroutine resolver.Run(); }
// Start is called before the first frame update void Start() { if (Application.platform == RuntimePlatform.OSXEditor || Application.platform == RuntimePlatform.OSXPlayer) { Debug.Log("You're running " + SystemInfo.operatingSystem + ". Aborting MonkeyLogicController.cs"); return; // LSL crashes OSX } // Create stream descriptors outlets = gameObject.AddComponent <MonkeyLogicOutlet>(); // These need to be MonoBehavior so leave unchanged _resolver = gameObject.AddComponent <MonkeyLogicResolver>(); inlet = gameObject.AddComponent <MonkeyLogicInlet>(); // Configure frameOutlet = outlets.Configure(_frameOutletName, _frameOutletType, 22, liblsl.IRREGULAR_RATE, liblsl.channel_format_t.cf_double64, _frameOutletID, GenerateXMLMetaData()); trialOutlet = outlets.Configure(_trialOutletName, _trialOutletType, 1, liblsl.IRREGULAR_RATE, liblsl.channel_format_t.cf_string, _trialOutletID, GenerateXMLMetaData()); inlet.Configure(_controlInletName, _controlInletType, _controlInletID, _resolver); // add listener for Streams delegates inlet.OnCalibrationReceived += ForwardEyecalibration; inlet.OnCommand += ForwardCommand; EventsController.OnPublishFrame += PublishFrame; EventsController.OnPublishTrial += PublishTrial; }