forked from genewildish/Mainline
fix(sensors): add inlet/outlet types to SensorStage
- Add DataType properties to SensorStage - Fix MicSensor import issues (remove conflicting TYPE_CHECKING) - Add numpy to main dependencies for type hints
This commit is contained in:
@@ -18,9 +18,9 @@ try:
|
||||
|
||||
_HAS_AUDIO = True
|
||||
except Exception:
|
||||
_HAS_AUDIO = False
|
||||
np = None # type: ignore
|
||||
sd = None # type: ignore
|
||||
_HAS_AUDIO = False
|
||||
|
||||
|
||||
from engine.events import MicLevelEvent
|
||||
@@ -58,7 +58,7 @@ class MicSensor(Sensor):
|
||||
|
||||
def start(self) -> bool:
|
||||
"""Start the microphone stream."""
|
||||
if not _HAS_AUDIO:
|
||||
if not _HAS_AUDIO or sd is None:
|
||||
return False
|
||||
|
||||
try:
|
||||
@@ -84,9 +84,7 @@ class MicSensor(Sensor):
|
||||
pass
|
||||
self._stream = None
|
||||
|
||||
def _audio_callback(
|
||||
self, indata: np.ndarray, frames: int, time_info: Any, status: Any
|
||||
) -> None:
|
||||
def _audio_callback(self, indata, frames, time_info, status) -> None:
|
||||
"""Process audio data from sounddevice."""
|
||||
if not _HAS_AUDIO or np is None:
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user