Fixed error display and audio playback on missing codec2 library

This commit is contained in:
Mark Qvist 2024-06-29 13:51:27 +02:00
parent 42cfd91ec3
commit 2a784499e0

View File

@ -1,6 +1,6 @@
__debug_build__ = False __debug_build__ = False
__disable_shaders__ = False __disable_shaders__ = False
__version__ = "0.9.0" __version__ = "0.9.1"
__variant__ = "beta" __variant__ = "beta"
import sys import sys
@ -1633,6 +1633,7 @@ class SidebandApp(MDApp):
else: else:
RNS.log("OGG write failed", RNS.LOG_DEBUG) RNS.log("OGG write failed", RNS.LOG_DEBUG)
else: else:
self.last_msg_audio = None
self.display_codec2_error() self.display_codec2_error()
return return
@ -1654,9 +1655,13 @@ class SidebandApp(MDApp):
if self.msg_sound != None and self.msg_sound.playing(): if self.msg_sound != None and self.msg_sound.playing():
RNS.log("Stopping playback", RNS.LOG_DEBUG) RNS.log("Stopping playback", RNS.LOG_DEBUG)
self.msg_sound.stop() self.msg_sound.stop()
else: else:
RNS.log("Starting playback", RNS.LOG_DEBUG) if self.msg_sound != None:
self.msg_sound.play() RNS.log("Starting playback", RNS.LOG_DEBUG)
self.msg_sound.play()
else:
RNS.log("Playback was requested, but no audio data was loaded for playback", RNS.LOG_ERROR)
except Exception as e: except Exception as e:
RNS.log("Error while playing message audio:"+str(e)) RNS.log("Error while playing message audio:"+str(e))
RNS.trace_exception(e) RNS.trace_exception(e)
@ -1684,7 +1689,10 @@ class SidebandApp(MDApp):
el.text_color=mdc("Red","400") el.text_color=mdc("Red","400")
el.icon = "stop-circle" el.icon = "stop-circle"
self.rec_dialog.rec_item.text = "[size="+str(ss)+"]Stop Recording[/size]" self.rec_dialog.rec_item.text = "[size="+str(ss)+"]Stop Recording[/size]"
self.msg_audio.start() def cb(dt):
self.msg_audio.start()
Clock.schedule_once(cb, 0.15)
else: else:
RNS.log("Stopping recording...") # TODO: Remove RNS.log("Stopping recording...") # TODO: Remove
self.rec_dialog.recording = False self.rec_dialog.recording = False