コード例 #1
0
        void Start()
        {
            var expectedStreamHasAName = !StreamName.Equals("");
            var expectedStreamHasAType = !StreamType.Equals("");

            if (!expectedStreamHasAName && !expectedStreamHasAType)
            {
                Debug.LogError("Inlet has to specify a name or a type before it is able to lookup a stream.");
                this.enabled = false;
                return;
            }

            if (expectedStreamHasAName)
            {
                Debug.Log("Creating LSL resolver for stream " + StreamName);

                resolver = new liblsl.ContinuousResolver("name", StreamName);
            }
            else if (expectedStreamHasAType)
            {
                Debug.Log("Creating LSL resolver for stream with type " + StreamType);
                resolver = new liblsl.ContinuousResolver("type", StreamType);
            }

            StartCoroutine(ResolveExpectedStream());
            StartCoroutine(WaitForStream());

            AdditionalStart();
        }
コード例 #2
0
ファイル: AInlet.cs プロジェクト: sudip-haz/labstreaminglayer
 /// <summary>
 /// Init a resolver
 /// </summary>
 protected void Init()
 {
     Debug.Log("ADoubleInlet: Init ");
     if (resolver == null)
     {
         resolver = new liblsl.ContinuousResolver();
     }
 }
コード例 #3
0
    void Start()
    {
        Debug.Log("Creating LSL resolver for stream " + StreamName);

        resolver = new liblsl.ContinuousResolver("name", StreamName);

        StartCoroutine(ResolveExpectedStream());
    }
コード例 #4
0
        private void Initialize(string streamName)
        {
            if (streamName != null)
            {
                StreamName = streamName;

                resolver = new liblsl.ContinuousResolver("name", StreamName);
            }
        }
コード例 #5
0
ファイル: LSLEditorWindow.cs プロジェクト: mvidaldp/LSL4Unity
        public void Init()
        {
            resolver = new liblsl.ContinuousResolver();

            var libVersion      = liblsl.library_version();
            var protocolVersion = liblsl.protocol_version();

            var lib_major  = libVersion / 100;
            var lib_minor  = libVersion % 100;
            var prot_major = protocolVersion / 100;
            var prot_minor = protocolVersion % 100;

            lslVersionInfos = string.Format("You are using LSL library: {0}.{1} implementing protocol version: {2}.{3}", lib_major, lib_minor, prot_major, prot_minor);

            this.titleContent = new GUIContent("LSL Utility");
        }
コード例 #6
0
ファイル: OVInlets.cs プロジェクト: tmonseigne/LSL4Unity
        /// <summary> Start is called before the first frame update. </summary>
        private void Start()
        {
            bool hasAName = streamName.Length != 0;

            if (!hasAName)
            {
                Debug.LogError("Inlet has to specify a name or a type before it is able to lookup a stream.");
                enabled = false;
                return;
            }

            Debug.Log("Creating LSL resolver for stream " + streamName);
            resolver = new liblsl.ContinuousResolver("name", streamName);

            StartCoroutine(ResolveExpectedStream());
        }
コード例 #7
0
        public void Init()
        {
            resolver = new liblsl.ContinuousResolver();

            int libVersion      = liblsl.LibraryVersion();
            int protocolVersion = liblsl.ProtocolVersion();

            int libMajor  = libVersion / 100;
            int libMinor  = libVersion % 100;
            int protMajor = protocolVersion / 100;
            int protMinor = protocolVersion % 100;

            lslVersionInfos = $"You are using LSL library: {libMajor}.{libMinor} implementing protocol version: {protMajor}.{protMinor}";

            titleContent = new GUIContent("LSL Utility");
        }
コード例 #8
0
        protected void pullSamples()
        {
            sample = new float[expectedChannels];

            try
            {
                double lastTimeStamp = inlet.pull_sample(sample, 0.0f);

                if (lastTimeStamp != 0.0)
                {
                    // do not miss the first one found
                    Process(sample, lastTimeStamp);
                    // pull as long samples are available
                    while ((lastTimeStamp = inlet.pull_sample(sample, 0.0f)) != 0)
                    {
                        Process(sample, lastTimeStamp);
                    }
                }
            }
            catch (ArgumentException aex)
            {
                Debug.LogError("An Error on pulling samples deactivating LSL inlet on...", this);
                this.enabled = true;
                inlet        = null;
                isConnected  = false;


                Debug.LogException(aex, this);
            }
            catch (LSL.liblsl.LostException aex)
            {
                Debug.LogError("An Error on pulling samples deactivating LSL inlet on...", this);
                this.enabled = true;
                inlet        = null;
                isConnected  = false;
                resolver     = new liblsl.ContinuousResolver("name", StreamName);
                Debug.LogException(aex, this);
            }
        }
コード例 #9
0
    // Modified by GD, put the contents of the Start function here. Since we script the addition of the components,
    // we need to wait for the listeners to be properly configured before starting the stream resolution.
    public void Run()
    {
        resolver = new liblsl.ContinuousResolver(forgetStreamAfter);

        StartCoroutine(resolveContinuously());
    }
コード例 #10
0
    public void Init()
    {
        resolver = new liblsl.ContinuousResolver();

        this.titleContent = new GUIContent("LSL Utility");
    }
コード例 #11
0
 /// <summary> Use this for initialization. </summary>
 private void Start()
 {
     resolver = new liblsl.ContinuousResolver(forgetStreamAfter);
     StartCoroutine(ResolveContinuously());
 }