ggwave : update bindings to toggle logging on and off (#55)

ref #54
This commit is contained in:
Georgi Gerganov
2021-11-22 20:17:16 +02:00
committed by GitHub
parent 43bf2f17e1
commit 1ebe881ea9
6 changed files with 26 additions and 1 deletions

View File

@@ -47,3 +47,5 @@ cdef extern from "ggwave.h" nogil:
const char * dataBuffer,
int dataSize,
char * outputBuffer);
void ggwave_setLogFile(void * fptr);

View File

@@ -1,5 +1,6 @@
cimport cython
from libc.stdio cimport stderr
from cpython.mem cimport PyMem_Malloc, PyMem_Free
import re
@@ -62,3 +63,9 @@ def decode(instance, waveform):
return coutput[0:rxDataLength]
return None
def disableLog():
cggwave.ggwave_setLogFile(NULL);
def enableLog():
cggwave.ggwave_setLogFile(stderr);

View File

@@ -3,6 +3,9 @@ import ggwave
testFailed = False
ggwave.disableLog()
ggwave.enableLog()
samples = ggwave.encode("hello python")
if not (samples):