File tree Expand file tree Collapse file tree 1 file changed +9
-9
lines changed Expand file tree Collapse file tree 1 file changed +9
-9
lines changed Original file line number Diff line number Diff line change @@ -199,22 +199,22 @@ def _find_device_id(
199199 devices = sd .query_devices ()
200200 channel_key = f"max_{ device_type } _channels"
201201
202- # return default device with appropriate channels
202+ # First try: Search for device by specific name (e.g., "respeaker")
203203 for idx , dev in enumerate (devices ):
204- if dev .get (channel_key , 0 ) > 0 :
204+ if (
205+ name_contains .lower () in dev ["name" ].lower ()
206+ and dev .get (channel_key , 0 ) > 0
207+ ):
205208 return idx
206209
207- # Log warning if default device not found
210+ # Log warning if device with specific name not found
208211 self .logger .warning (
209- f"No default { device_type } found. Trying another device containing '{ name_contains } '."
212+ f"No { device_type } device containing '{ name_contains } ' found. Using first available { device_type } device ."
210213 )
211214
212- # Fallback: Search for device by specific name
215+ # Fallback: Return first device with appropriate channels
213216 for idx , dev in enumerate (devices ):
214- if (
215- name_contains .lower () in dev ["name" ].lower ()
216- and dev .get (channel_key , 0 ) > 0
217- ):
217+ if dev .get (channel_key , 0 ) > 0 :
218218 return idx
219219
220220 raise RuntimeError (
You can’t perform that action at this time.
0 commit comments