audio: add -> None return annotations
This commit is contained in:
@@ -55,7 +55,7 @@ class AudioPipeline:
|
|||||||
self._input_gain = 1.0
|
self._input_gain = 1.0
|
||||||
self._output_gain = 1.0
|
self._output_gain = 1.0
|
||||||
|
|
||||||
def start(self):
|
def start(self) -> None:
|
||||||
"""Open audio streams."""
|
"""Open audio streams."""
|
||||||
import sounddevice as sd
|
import sounddevice as sd
|
||||||
|
|
||||||
@@ -81,7 +81,7 @@ class AudioPipeline:
|
|||||||
|
|
||||||
log.info("audio pipeline started (rate=%d)", self._sample_rate)
|
log.info("audio pipeline started (rate=%d)", self._sample_rate)
|
||||||
|
|
||||||
def stop(self):
|
def stop(self) -> None:
|
||||||
"""Close audio streams and drain stale frames."""
|
"""Close audio streams and drain stale frames."""
|
||||||
for stream in (self._input_stream, self._output_stream):
|
for stream in (self._input_stream, self._output_stream):
|
||||||
if stream is not None:
|
if stream is not None:
|
||||||
@@ -129,7 +129,7 @@ class AudioPipeline:
|
|||||||
def output_gain(self, value: float):
|
def output_gain(self, value: float):
|
||||||
self._output_gain = max(0.0, min(2.0, value))
|
self._output_gain = max(0.0, min(2.0, value))
|
||||||
|
|
||||||
def _capture_callback(self, indata, frames, time_info, status):
|
def _capture_callback(self, indata, frames, time_info, status) -> None:
|
||||||
"""Called by sounddevice when input data is available."""
|
"""Called by sounddevice when input data is available."""
|
||||||
if status:
|
if status:
|
||||||
log.warning("capture status: %s", status)
|
log.warning("capture status: %s", status)
|
||||||
@@ -142,7 +142,7 @@ class AudioPipeline:
|
|||||||
except queue.Full:
|
except queue.Full:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def _playback_callback(self, outdata, frames, time_info, status):
|
def _playback_callback(self, outdata, frames, time_info, status) -> None:
|
||||||
"""Called by sounddevice when output buffer needs data."""
|
"""Called by sounddevice when output buffer needs data."""
|
||||||
if status:
|
if status:
|
||||||
log.warning("playback status: %s", status)
|
log.warning("playback status: %s", status)
|
||||||
@@ -173,7 +173,7 @@ class AudioPipeline:
|
|||||||
except queue.Empty:
|
except queue.Empty:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
def queue_playback(self, pcm_data: bytes):
|
def queue_playback(self, pcm_data: bytes) -> None:
|
||||||
"""Queue raw PCM data for playback (16-bit, mono, 48kHz)."""
|
"""Queue raw PCM data for playback (16-bit, mono, 48kHz)."""
|
||||||
if self._deafened:
|
if self._deafened:
|
||||||
return
|
return
|
||||||
|
|||||||
Reference in New Issue
Block a user