mirror of
https://github.com/DJ2LS/FreeDATA
synced 2024-05-14 08:04:33 +00:00
added time measurement
writing to stdout seems to be really slow after the first run...
This commit is contained in:
parent
e79aa0b457
commit
cd8f522f85
|
@ -48,10 +48,10 @@ if AUDIO_OUTPUT_DEVICE != 0:
|
|||
output_device_index=AUDIO_OUTPUT_DEVICE,
|
||||
)
|
||||
|
||||
|
||||
modes = [14,10,12]
|
||||
for m in modes:
|
||||
|
||||
|
||||
freedv = cast(codec2.api.freedv_open(m), c_void_p)
|
||||
|
||||
n_tx_modem_samples = codec2.api.freedv_get_n_tx_modem_samples(freedv)
|
||||
|
@ -103,6 +103,7 @@ for m in modes:
|
|||
mod_out_silence = create_string_buffer(samples_delay)
|
||||
txbuffer += bytes(mod_out_silence)
|
||||
|
||||
|
||||
# check if we want to use an audio device or stdout
|
||||
if AUDIO_OUTPUT_DEVICE != 0:
|
||||
|
||||
|
@ -111,12 +112,22 @@ for m in modes:
|
|||
stream_tx.write(audio[0])
|
||||
|
||||
else:
|
||||
|
||||
# this test needs a lot of time, so we are having a look at times...
|
||||
starttime = time.time()
|
||||
|
||||
# print data to terminal for piping the output to other programs
|
||||
sys.stdout.buffer.write(txbuffer)
|
||||
sys.stdout.flush()
|
||||
|
||||
# and at least print the needed time to see which time we needed
|
||||
timeneeded = time.time()-starttime
|
||||
print(f"time: {timeneeded}", file=sys.stderr)
|
||||
|
||||
|
||||
# and at last check if we had an openend pyaudio instance and close it
|
||||
if AUDIO_OUTPUT_DEVICE != 0:
|
||||
stream_tx.close()
|
||||
p.terminate()
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue