mirror of
https://github.com/ggerganov/ggwave.git
synced 2026-02-06 16:47:59 +08:00
ggwave : refactoring + comments
This commit is contained in:
4
bindings/python/.gitignore
vendored
4
bindings/python/.gitignore
vendored
@@ -1 +1,5 @@
|
||||
ggwave.so
|
||||
README.rst
|
||||
ggwave.bycython.cpp
|
||||
ggwave.cpython-36m-x86_64-linux-gnu.so
|
||||
ggwave/
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user