2525 QPlainTextEdit ,
2626 QPushButton ,
2727 QRadioButton ,
28+ QDoubleSpinBox ,
2829 QTabWidget ,
2930 QVBoxLayout ,
3031 QWidget ,
@@ -258,6 +259,14 @@ def _build_audio_tab(self) -> None:
258259 tab = QWidget ()
259260 form = QFormLayout (tab )
260261
262+ hint = QLabel (
263+ "No external mic needed: use System Default for the built-in laptop mic, "
264+ "or pick the device named Microphone Array, Internal Mic, Realtek, DMIC, "
265+ "or Intel Smart Sound. Avoid Monitor, Stereo Mix, HDMI, and output devices."
266+ )
267+ hint .setWordWrap (True )
268+ form .addRow (hint )
269+
261270 self ._device_combo = QComboBox ()
262271 self ._populate_devices ()
263272 form .addRow ("Input Device:" , self ._device_combo )
@@ -268,6 +277,13 @@ def _build_audio_tab(self) -> None:
268277 self ._calibrate_btn .setEnabled (False )
269278 form .addRow (self ._calibrate_btn )
270279
280+ self ._rms_spin = QDoubleSpinBox ()
281+ self ._rms_spin .setRange (0.0 , 32767.0 )
282+ self ._rms_spin .setDecimals (1 )
283+ self ._rms_spin .setSingleStep (1.0 )
284+ self ._rms_spin .setSpecialValueText ("Disabled" )
285+ form .addRow ("RMS Threshold:" , self ._rms_spin )
286+
271287 self ._rms_label = QLabel ("Threshold: —" )
272288 form .addRow (self ._rms_label )
273289
@@ -313,6 +329,7 @@ def _populate(self, cfg: AppConfig) -> None:
313329 self ._llm_fb_headers .setText (cfg .llm_fallback_custom_headers )
314330
315331 # Audio
332+ self ._rms_spin .setValue (cfg .rms_threshold )
316333 self ._rms_label .setText (f"Threshold: { cfg .rms_threshold :.1f} " )
317334
318335 def _collect (self ) -> None :
@@ -351,6 +368,7 @@ def _collect(self) -> None:
351368
352369 # Audio
353370 cfg .audio_device_id = self ._device_combo .currentData ()
371+ cfg .rms_threshold = self ._rms_spin .value ()
354372 cfg .audio_device_name = ""
355373 if cfg .audio_device_id is not None :
356374 text = self ._device_combo .currentText ()
@@ -362,7 +380,7 @@ def _collect(self) -> None:
362380
363381 def _populate_devices (self ) -> None :
364382 """Fill the device combo from the pre-fetched device list."""
365- self ._device_combo .addItem ("( System Default)" , None )
383+ self ._device_combo .addItem ("System Default (usually built-in laptop mic )" , None )
366384 for dev_id , dev_name in self ._devices :
367385 self ._device_combo .addItem (f"[{ dev_id } ] { dev_name } " , dev_id )
368386
@@ -387,6 +405,7 @@ def _on_calibrate(self) -> None:
387405 )
388406 threshold = self ._calibrate_fn (device_id )
389407 self ._working .rms_threshold = threshold
408+ self ._rms_spin .setValue (threshold )
390409 self ._rms_label .setText (f"Threshold: { threshold :.1f} " )
391410 except Exception as e :
392411 QMessageBox .warning (self , "Calibration Failed" , str (e ))
@@ -398,13 +417,9 @@ def _on_calibrate(self) -> None:
398417 def _set_dynamic_group_visible (self , group : QWidget , visible : bool ) -> None :
399418 group .setVisible (visible )
400419
401- parent = group .parentWidget ()
402- if parent is not None and parent .layout () is not None :
403- parent .layout ().invalidate ()
404-
405420 if self .layout () is not None :
406- self .layout ().invalidate ()
407- self .adjustSize ( )
421+ self .layout ().activate ()
422+ self .resize ( self . sizeHint () )
408423
409424 # ------------------------------------------------------------------
410425 # Validation
0 commit comments