Fixed too many open files
This commit is contained in:
parent
05d55f0d77
commit
72576d1732
@ -32,8 +32,8 @@ class SlicedRecorder(Thread):
|
|||||||
self._active = True
|
self._active = True
|
||||||
|
|
||||||
def _request_new_file(self) -> Tuple[str, wave.Wave_write]:
|
def _request_new_file(self) -> Tuple[str, wave.Wave_write]:
|
||||||
_, record_path = tempfile.mkstemp(prefix="rec", suffix=".wav", dir=self._dest_folder)
|
file_handle, record_path = tempfile.mkstemp(prefix="rec", suffix=".wav", dir=self._dest_folder)
|
||||||
wavefile = wave.open(record_path, 'wb')
|
wavefile = wave.open(open(file_handle, 'wb'), 'wb')
|
||||||
wavefile.setnchannels(1) # mono
|
wavefile.setnchannels(1) # mono
|
||||||
wavefile.setframerate(self._sample_rate)
|
wavefile.setframerate(self._sample_rate)
|
||||||
wavefile.setsampwidth(self.BYTES_PER_SAMPLE) # 16bit
|
wavefile.setsampwidth(self.BYTES_PER_SAMPLE) # 16bit
|
||||||
|
Loading…
Reference in New Issue
Block a user