ggwave : refactoring + comments

This commit is contained in:
Georgi Gerganov
2021-01-17 21:19:33 +02:00
parent e1ba135da7
commit cd332b5919
10 changed files with 143 additions and 75 deletions

View File

@@ -1 +1,5 @@
ggwave.so
README.rst
ggwave.bycython.cpp
ggwave.cpython-36m-x86_64-linux-gnu.so
ggwave/

View File

@@ -4,7 +4,7 @@ cdef extern from "ggwave.h" nogil:
GGWAVE_SAMPLE_FORMAT_I16,
GGWAVE_SAMPLE_FORMAT_F32
ctypedef enum ggwave_TxProtocol:
ctypedef enum ggwave_TxProtocolId:
GGWAVE_TX_PROTOCOL_AUDIBLE_NORMAL,
GGWAVE_TX_PROTOCOL_AUDIBLE_FAST,
GGWAVE_TX_PROTOCOL_AUDIBLE_FASTEST,
@@ -31,7 +31,7 @@ cdef extern from "ggwave.h" nogil:
ggwave_Instance instance,
const char * dataBuffer,
int dataSize,
ggwave_TxProtocol txProtocol,
ggwave_TxProtocolId txProtocolId,
int volume,
char * outputBuffer);

View File

@@ -18,7 +18,7 @@ def init(parameters = None):
def free(instance):
return cggwave.ggwave_free(instance)
def encode(payload, txProtocol = 1, volume = 10, instance = None):
def encode(payload, txProtocolId = 1, volume = 10, instance = None):
""" Encode payload into an audio waveform.
@param {string} payload, the data to be encoded
@return Generated audio waveform bytes representing 16-bit signed integer samples.
@@ -35,7 +35,7 @@ def encode(payload, txProtocol = 1, volume = 10, instance = None):
own = True
instance = init(defaultParameters())
n = cggwave.ggwave_encode(instance, cdata, len(data_bytes), txProtocol, volume, coutput)
n = cggwave.ggwave_encode(instance, cdata, len(data_bytes), txProtocolId, volume, coutput)
if (own):
free(instance)