2021-12-12 20:52:03 +00:00
|
|
|
#!/usr/bin/env python3
|
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
|
|
|
|
import ctypes
|
|
|
|
from ctypes import *
|
|
|
|
import sys
|
|
|
|
|
|
|
|
|
2021-12-12 21:00:50 +00:00
|
|
|
print("loading codec2 module", file=sys.stderr)
|
2021-12-12 20:52:03 +00:00
|
|
|
|
|
|
|
|
|
|
|
# LOAD FREEDV
|
|
|
|
libname = "libcodec2.so"
|
|
|
|
api = ctypes.CDLL(libname)
|
|
|
|
|
|
|
|
# ctypes function init
|
|
|
|
|
|
|
|
api.freedv_open.argype = [c_int]
|
|
|
|
api.freedv_open.restype = c_void_p
|
|
|
|
|
|
|
|
api.freedv_get_bits_per_modem_frame.argtype = [c_void_p]
|
|
|
|
api.freedv_get_bits_per_modem_frame.restype = c_int
|
|
|
|
|
|
|
|
api.freedv_nin.argtype = [c_void_p]
|
|
|
|
api.freedv_nin.restype = c_int
|
|
|
|
|
|
|
|
api.freedv_rawdatarx.argtype = [c_void_p, c_char_p, c_char_p]
|
|
|
|
api.freedv_rawdatarx.restype = c_int
|
|
|
|
|
2021-12-12 21:00:50 +00:00
|
|
|
api.freedv_rawdatatx.argtype = [c_void_p, c_char_p, c_char_p]
|
|
|
|
api.freedv_rawdatatx.restype = c_int
|
|
|
|
|
|
|
|
api.freedv_rawdatapostambletx.argtype = [c_void_p, c_char_p, c_char_p]
|
|
|
|
api.freedv_rawdatapostambletx.restype = c_int
|
|
|
|
|
|
|
|
api.freedv_rawdatapreambletx.argtype = [c_void_p, c_char_p, c_char_p]
|
|
|
|
api.freedv_rawdatapreambletx.restype = c_int
|
|
|
|
|
2021-12-12 20:52:03 +00:00
|
|
|
api.freedv_get_n_max_modem_samples.argtype = [c_void_p]
|
|
|
|
api.freedv_get_n_max_modem_samples.restype = c_int
|
|
|
|
|
|
|
|
api.freedv_set_frames_per_burst.argtype = [c_void_p, c_int]
|
|
|
|
api.freedv_set_frames_per_burst.restype = c_void_p
|
|
|
|
|
|
|
|
api.freedv_get_rx_status.argtype = [c_void_p]
|
|
|
|
api.freedv_get_rx_status.restype = c_int
|
2021-12-12 21:00:50 +00:00
|
|
|
|
|
|
|
api.freedv_get_n_tx_postamble_modem_samples.argtype = [c_void_p]
|
|
|
|
api.freedv_get_n_tx_postamble_modem_samples.restype = c_int
|
|
|
|
|
|
|
|
api.freedv_get_n_tx_preamble_modem_samples.argtype = [c_void_p]
|
|
|
|
api.freedv_get_n_tx_preamble_modem_samples.restype = c_int
|
|
|
|
|
|
|
|
api.freedv_get_n_tx_modem_samples.argtype = [c_void_p]
|
|
|
|
api.freedv_get_n_tx_modem_samples.restype = c_int
|
|
|
|
|