Added PTT playback queue and playback lock while recording. Added database operation thread locking.
This commit is contained in:
parent
08bf53c998
commit
19c54319a6
|
@ -1052,12 +1052,10 @@ class SidebandApp(MDApp):
|
||||||
elif keycode == 40:
|
elif keycode == 40:
|
||||||
self.msg_rec_a_save(None)
|
self.msg_rec_a_save(None)
|
||||||
|
|
||||||
elif not self.rec_dialog_is_open:
|
elif not self.rec_dialog_is_open and not self.messages_view.ids.message_text.focus and self.messages_view.ptt_enabled and keycode == 44:
|
||||||
if not self.messages_view.ids.message_text.focus:
|
if not self.key_ptt_down:
|
||||||
if self.messages_view.ptt_enabled and keycode == 44:
|
self.key_ptt_down = True
|
||||||
if not self.key_ptt_down:
|
self.message_ptt_down_action()
|
||||||
self.key_ptt_down = True
|
|
||||||
self.message_ptt_down_action()
|
|
||||||
|
|
||||||
elif len(modifiers) > 1 and "shift" in modifiers and "ctrl" in modifiers:
|
elif len(modifiers) > 1 and "shift" in modifiers and "ctrl" in modifiers:
|
||||||
def clear_att():
|
def clear_att():
|
||||||
|
@ -1763,6 +1761,9 @@ class SidebandApp(MDApp):
|
||||||
RNS.trace_exception(e)
|
RNS.trace_exception(e)
|
||||||
|
|
||||||
def message_ptt_down_action(self, sender=None):
|
def message_ptt_down_action(self, sender=None):
|
||||||
|
if self.sideband.ui_recording:
|
||||||
|
return
|
||||||
|
|
||||||
self.sideband.ui_started_recording()
|
self.sideband.ui_started_recording()
|
||||||
self.audio_msg_mode = LXMF.AM_CODEC2_2400
|
self.audio_msg_mode = LXMF.AM_CODEC2_2400
|
||||||
self.message_attach_action(attach_type="audio", nodialog=True)
|
self.message_attach_action(attach_type="audio", nodialog=True)
|
||||||
|
@ -1782,7 +1783,9 @@ class SidebandApp(MDApp):
|
||||||
|
|
||||||
|
|
||||||
def message_ptt_up_action(self, sender=None):
|
def message_ptt_up_action(self, sender=None):
|
||||||
self.sideband.ui_stopped_recording()
|
if not self.sideband.ui_recording:
|
||||||
|
return
|
||||||
|
|
||||||
self.rec_dialog.recording = False
|
self.rec_dialog.recording = False
|
||||||
el_button = self.messages_view.ids.message_ptt_button
|
el_button = self.messages_view.ids.message_ptt_button
|
||||||
el_icon = self.messages_view.ids.message_ptt_button.children[0].children[1]
|
el_icon = self.messages_view.ids.message_ptt_button.children[0].children[1]
|
||||||
|
@ -1792,10 +1795,16 @@ class SidebandApp(MDApp):
|
||||||
el_icon.theme_text_color="Custom"
|
el_icon.theme_text_color="Custom"
|
||||||
el_icon.text_color=mdc("BlueGray","500")
|
el_icon.text_color=mdc("BlueGray","500")
|
||||||
def cb_s(dt):
|
def cb_s(dt):
|
||||||
self.msg_audio.stop()
|
try:
|
||||||
self.message_process_audio()
|
self.msg_audio.stop()
|
||||||
self.message_send_action()
|
except Exception as e:
|
||||||
Clock.schedule_once(cb_s, 0.25)
|
RNS.log("An error occurred while stopping recording: "+str(e), RNS.LOG_ERROR)
|
||||||
|
RNS.trace_exception(e)
|
||||||
|
|
||||||
|
self.sideband.ui_stopped_recording()
|
||||||
|
if self.message_process_audio():
|
||||||
|
self.message_send_action()
|
||||||
|
Clock.schedule_once(cb_s, 0.35)
|
||||||
|
|
||||||
def message_process_audio(self):
|
def message_process_audio(self):
|
||||||
if self.audio_msg_mode == LXMF.AM_OPUS_OGG:
|
if self.audio_msg_mode == LXMF.AM_OPUS_OGG:
|
||||||
|
@ -1850,7 +1859,9 @@ class SidebandApp(MDApp):
|
||||||
os.unlink(self.msg_audio._file_path)
|
os.unlink(self.msg_audio._file_path)
|
||||||
else:
|
else:
|
||||||
self.display_codec2_error()
|
self.display_codec2_error()
|
||||||
return
|
return False
|
||||||
|
|
||||||
|
return True
|
||||||
|
|
||||||
def message_init_rec_dialog(self):
|
def message_init_rec_dialog(self):
|
||||||
ss = int(dp(18))
|
ss = int(dp(18))
|
||||||
|
|
|
@ -68,13 +68,21 @@ class AndroidAudio(Audio):
|
||||||
|
|
||||||
def _stop(self):
|
def _stop(self):
|
||||||
if self._recorder:
|
if self._recorder:
|
||||||
self._recorder.stop()
|
try:
|
||||||
self._recorder.release()
|
self._recorder.stop()
|
||||||
|
self._recorder.release()
|
||||||
|
except Exception as e:
|
||||||
|
print("Could not stop recording: "+str(e))
|
||||||
|
|
||||||
self._recorder = None
|
self._recorder = None
|
||||||
|
|
||||||
if self._player:
|
if self._player:
|
||||||
self._player.stop()
|
try:
|
||||||
self._player.release()
|
self._player.stop()
|
||||||
|
self._player.release()
|
||||||
|
except Exception as e:
|
||||||
|
print("Could not stop playback: "+str(e))
|
||||||
|
|
||||||
self._player = None
|
self._player = None
|
||||||
|
|
||||||
self.is_playing = False
|
self.is_playing = False
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue