mirror of
https://github.com/ggerganov/ggwave.git
synced 2026-02-06 16:47:59 +08:00
@@ -78,4 +78,14 @@ EMSCRIPTEN_BINDINGS(ggwave) {
|
||||
|
||||
return std::string();
|
||||
}));
|
||||
|
||||
emscripten::function("disableLog", emscripten::optional_override(
|
||||
[]() {
|
||||
ggwave_setLogFile(NULL);
|
||||
}));
|
||||
|
||||
emscripten::function("enableLog", emscripten::optional_override(
|
||||
[]() {
|
||||
ggwave_setLogFile(stderr);
|
||||
}));
|
||||
}
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -47,3 +47,5 @@ cdef extern from "ggwave.h" nogil:
|
||||
const char * dataBuffer,
|
||||
int dataSize,
|
||||
char * outputBuffer);
|
||||
|
||||
void ggwave_setLogFile(void * fptr);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -3,6 +3,9 @@ import ggwave
|
||||
|
||||
testFailed = False
|
||||
|
||||
ggwave.disableLog()
|
||||
ggwave.enableLog()
|
||||
|
||||
samples = ggwave.encode("hello python")
|
||||
|
||||
if not (samples):
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
import sys
|
||||
import ggwave
|
||||
|
||||
# optionally disable logging
|
||||
#ggwave.disableLog()
|
||||
|
||||
# create ggwave instance with default parameters
|
||||
instance = ggwave.init()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user