mirror of
https://github.com/DJ2LS/FreeDATA
synced 2024-05-14 08:04:33 +00:00
possible fix of crashing audio device
This commit is contained in:
parent
722f1ef785
commit
e82592bab7
|
@ -135,13 +135,13 @@ class RF:
|
||||||
|
|
||||||
def start_modem(self):
|
def start_modem(self):
|
||||||
if not TESTMODE and HamlibParam.hamlib_radiocontrol not in ["tci"]:
|
if not TESTMODE and HamlibParam.hamlib_radiocontrol not in ["tci"]:
|
||||||
self.init_audio()
|
result = self.init_audio()
|
||||||
|
|
||||||
elif not TESTMODE:
|
elif not TESTMODE:
|
||||||
self.init_tci()
|
result = self.init_tci()
|
||||||
else:
|
else:
|
||||||
self.init_mkfifo()
|
result = self.init_mkfifo()
|
||||||
|
if result not in [False]:
|
||||||
# init codec2 instances
|
# init codec2 instances
|
||||||
self.init_codec2()
|
self.init_codec2()
|
||||||
|
|
||||||
|
@ -154,6 +154,8 @@ class RF:
|
||||||
# init decoding threads
|
# init decoding threads
|
||||||
self.init_data_threads()
|
self.init_data_threads()
|
||||||
atexit.register(self.stream.stop)
|
atexit.register(self.stream.stop)
|
||||||
|
else:
|
||||||
|
return False
|
||||||
|
|
||||||
def stop_modem(self):
|
def stop_modem(self):
|
||||||
try:
|
try:
|
||||||
|
@ -167,7 +169,6 @@ class RF:
|
||||||
self.log.error("[MDM] Error stopping modem", e=err)
|
self.log.error("[MDM] Error stopping modem", e=err)
|
||||||
|
|
||||||
def init_audio(self):
|
def init_audio(self):
|
||||||
try:
|
|
||||||
self.log.info(f"[MDM] init: get audio devices", input_device=self.audio_input_device,
|
self.log.info(f"[MDM] init: get audio devices", input_device=self.audio_input_device,
|
||||||
output_device=self.audio_output_device)
|
output_device=self.audio_output_device)
|
||||||
try:
|
try:
|
||||||
|
@ -200,15 +201,15 @@ class RF:
|
||||||
blocksize=4800,
|
blocksize=4800,
|
||||||
)
|
)
|
||||||
self.stream.start()
|
self.stream.start()
|
||||||
|
return True
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
except Exception as audioerr:
|
except Exception as audioerr:
|
||||||
self.log.error("[MDM] init: starting pyaudio callback failed", e=audioerr)
|
self.log.error("[MDM] init: starting pyaudio callback failed", e=audioerr)
|
||||||
|
|
||||||
except Exception as err:
|
|
||||||
self.log.warning("[MDM] init: can't open audio device. Stopping modem", e=err)
|
|
||||||
self.stop_modem()
|
self.stop_modem()
|
||||||
|
return False
|
||||||
|
|
||||||
|
|
||||||
def init_tci(self):
|
def init_tci(self):
|
||||||
# placeholder area for processing audio via TCI
|
# placeholder area for processing audio via TCI
|
||||||
|
|
|
@ -42,3 +42,4 @@ class SM:
|
||||||
del self.data_handler
|
del self.data_handler
|
||||||
self.modem = False
|
self.modem = False
|
||||||
self.data_handler = False
|
self.data_handler = False
|
||||||
|
threading.Event().wait(0.5)
|
||||||
|
|
Loading…
Reference in a new issue