mirror of
https://github.com/DJ2LS/FreeDATA
synced 2024-05-14 08:04:33 +00:00
improvement of audio to stream
This commit is contained in:
parent
2c120065f5
commit
465926cf4d
1 changed files with 19 additions and 19 deletions
38
modem.py
38
modem.py
|
@ -56,7 +56,8 @@ class RF():
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
self.streambuffer = bytes(2)
|
self.streambuffer = bytes(0)
|
||||||
|
self.audio_writing_to_stream = False
|
||||||
#--------------------------------------------START DECODER THREAD
|
#--------------------------------------------START DECODER THREAD
|
||||||
FREEDV_DECODER_THREAD_10 = threading.Thread(target=self.receive, args=[10], name="FREEDV_DECODER_THREAD_10")
|
FREEDV_DECODER_THREAD_10 = threading.Thread(target=self.receive, args=[10], name="FREEDV_DECODER_THREAD_10")
|
||||||
FREEDV_DECODER_THREAD_10.start()
|
FREEDV_DECODER_THREAD_10.start()
|
||||||
|
@ -102,26 +103,21 @@ class RF():
|
||||||
|
|
||||||
self.my_rig.set_ptt(self.hamlib_ptt_type,0)
|
self.my_rig.set_ptt(self.hamlib_ptt_type,0)
|
||||||
|
|
||||||
|
#--------------------------------------------------------------------------------------------------------
|
||||||
def play_audio(self):
|
def play_audio(self):
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
time.sleep(0.11)
|
time.sleep(0.01)
|
||||||
state_before_transmit = static.CHANNEL_STATE
|
#state_before_transmit = static.CHANNEL_STATE
|
||||||
#print(len(self.streambuffer))
|
|
||||||
#print(bytes(self.streambuffer))
|
|
||||||
#print(static.CHANNEL_STATE)
|
|
||||||
|
|
||||||
#print(len(self.streambuffer))
|
|
||||||
while len(self.streambuffer) > 0:
|
while len(self.streambuffer) > 0:
|
||||||
static.CHANNEL_STATE = 'SENDING_SIGNALLING'
|
time.sleep(0.01)
|
||||||
if len(self.streambuffer) > 0:
|
if len(self.streambuffer) > 0:
|
||||||
print("test")
|
self.audio_writing_to_stream = True
|
||||||
print(len(self.streambuffer))
|
|
||||||
self.stream_tx.write(self.streambuffer)
|
self.stream_tx.write(self.streambuffer)
|
||||||
time.sleep(0.1)
|
self.streambuffer = bytes()
|
||||||
self.streambuffer = bytes(0)
|
#static.CHANNEL_STATE = state_before_transmit
|
||||||
static.CHANNEL_STATE = state_before_transmit
|
self.audio_writing_to_stream = False
|
||||||
#--------------------------------------------------------------------------------------------------------
|
#--------------------------------------------------------------------------------------------------------
|
||||||
def transmit_signalling(self,data_out):
|
def transmit_signalling(self,data_out):
|
||||||
|
|
||||||
|
@ -160,12 +156,16 @@ class RF():
|
||||||
|
|
||||||
# -------------- transmit audio
|
# -------------- transmit audio
|
||||||
logging.debug("SENDING SIGNALLING FRAME " + str(data_out))
|
logging.debug("SENDING SIGNALLING FRAME " + str(data_out))
|
||||||
#asyncio.run(self.stream_tx.write(bytes(txbuffer)))
|
|
||||||
#self.stream_tx.write(bytes(txbuffer))
|
|
||||||
self.streambuffer = bytes()
|
self.streambuffer = bytes()
|
||||||
self.streambuffer = bytes(txbuffer)
|
self.streambuffer = bytes(txbuffer)
|
||||||
#print(self.streambuffer)
|
self.audio_writing_to_stream = True
|
||||||
#print(len(self.streambuffer))
|
|
||||||
|
#wait until audio has been processed
|
||||||
|
while self.audio_writing_to_stream == True:
|
||||||
|
time.sleep(0.01)
|
||||||
|
static.CHANNEL_STATE = 'SENDING_SIGNALLING'
|
||||||
|
|
||||||
self.my_rig.set_ptt(self.hamlib_ptt_type,0)
|
self.my_rig.set_ptt(self.hamlib_ptt_type,0)
|
||||||
static.PTT_STATE = False
|
static.PTT_STATE = False
|
||||||
static.CHANNEL_STATE = state_before_transmit
|
static.CHANNEL_STATE = state_before_transmit
|
||||||
|
|
Loading…
Reference in a new issue