Skip to content

Commit 226c232

Browse files
committed
Adding Comments
1 parent b3a702b commit 226c232

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

gui.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,20 +30,20 @@ def plot_lsl_data():
3030
global inlet, num_channels, data
3131

3232
print("Searching for available LSL streams...")
33-
streams = resolve_streams()
34-
available_streams = [s.name() for s in streams]
33+
streams = resolve_streams() # Discover available LSL streams
34+
available_streams = [s.name() for s in streams] # Get list of stream names
3535

3636
if not available_streams:
3737
print("No LSL streams found!")
3838
return None
3939

40-
for stream_name in available_streams:
40+
for stream_name in available_streams: # Try to connect to each available stream until successful
4141
print(f"Trying to connect to {stream_name}...")
42-
resolved_streams = resolve_byprop('name', stream_name, timeout=2)
42+
resolved_streams = resolve_byprop('name', stream_name, timeout=2) # Attempt to resolve the stream by its name
4343

4444
if resolved_streams:
4545
print(f"Successfully connected to {stream_name}!")
46-
inlet = StreamInlet(resolved_streams[0])
46+
inlet = StreamInlet(resolved_streams[0]) # Create an inlet to receive data from the stream
4747
break
4848
else:
4949
print(f"Failed to connect to {stream_name}.")
@@ -52,7 +52,7 @@ def plot_lsl_data():
5252
print("Could not connect to any stream.")
5353
return None
5454

55-
info = inlet.info()
55+
info = inlet.info() # Get stream info. and initialize data structures
5656
num_channels = info.channel_count()
5757
print(f"Detected {num_channels} channels.")
5858

0 commit comments

Comments
 (0)