Skip to content

Commit

Permalink
Merge pull request psychopy#6908 from TEParsons/dev-bf-mic-error
Browse files Browse the repository at this point in the history
BF: Better error handling when getting recording from mic that's still recording
  • Loading branch information
peircej authored Oct 11, 2024
2 parents 830a05e + bfa7d59 commit 6922b9b
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions psychopy/hardware/microphone.py
Original file line number Diff line number Diff line change
Expand Up @@ -953,9 +953,10 @@ def getRecording(self):
"""
if self.isStarted:
raise AudioStreamError(
"Cannot get audio clip, recording was in progress. Be sure to "
"call `Microphone.stop` first.")
logging.warn(
"Cannot get audio clip while recording is in progress, so stopping recording now."
)
self.stop()

return self._recording.getSegment() # full recording

Expand Down

0 comments on commit 6922b9b

Please sign in to comment.